Skip to content

Commit

Permalink
ci: Add integration and deployment pipelines
Browse files Browse the repository at this point in the history
  • Loading branch information
georgkrause committed Jan 10, 2024
1 parent 3532c31 commit de6129e
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/cd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Continous Delivery

on:
release:
types: [published]

jobs:
deploy:
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/pylistenbrainz
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.12'
- name: Install dependencies
run: pip install .[build]
- name: Build package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
48 changes: 48 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Continous Integration

on: [pull_request]

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9"] #, "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install
run: pip install .[tests]
- name: Run tests
run: pytest --junitxml=junit/test-results-${{ matrix.python-version }}.xml --cov=pylistenbrainz --cov-report=xml:junit/coverage-${{ matrix.python-version }}.xml
- name: Upload
uses: actions/upload-artifact@v4
with:
name: junit-${{ matrix.python-version }}
path: junit/*

report:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/download-artifact@v4
- name: Publish Test Reports
uses: EnricoMi/publish-unit-test-result-action/composite@v2
if: always()
with:
files: junit-*/test-results-*.xml
- name: Create Coverage Report
uses: irongut/CodeCoverageSummary@v1.3.0
with:
filename: junit-*/coverage-*.xml
format: markdown
output: both
- name: Add coverage PR comment
uses: marocchino/sticky-pull-request-comment@v2
with:
recreate: true
path: code-coverage-results.md
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
junit
htmlcov/
.tox/
.nox/
Expand Down

0 comments on commit de6129e

Please sign in to comment.