Merge pull request #512 from afuetterer/ci #496
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: [master] | |
pull_request: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
PYTHONUNBUFFERED: 1 | |
FORCE_COLOR: 1 # colored output by pytest etc. | |
permissions: {} # Set permissions at the job level. | |
jobs: | |
lint: | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
cache: pip | |
- uses: pre-commit/[email protected] | |
with: | |
extra_args: --all-files --color=always | |
tests: | |
runs-on: ubuntu-22.04 | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
cache: pip | |
- name: Install python dependencies | |
run: | | |
python -m pip install --upgrade pip setuptools wheel | |
python -m pip install --upgrade hatch | |
- name: Run test suite with coverage | |
run: hatch run cov-ci | |
- name: Upload test results | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: test-results | |
retention-days: 1 | |
path: pytest-junit.xml | |
- name: Upload coverage results | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-results | |
retention-days: 1 | |
path: pytest-cobertura.xml | |
- run: rm ./reports/coverage/.gitignore | |
- name: Generate coverage badge | |
if: github.ref == 'refs/heads/master' | |
run: hatch run cov-badge | |
- name: Deploy reports to GitHub Pages | |
if: github.ref == 'refs/heads/master' | |
uses: JamesIves/github-pages-deploy-action@65b5dfd4f5bcd3a7403bbc2959c144256167464e # v4.5.0 | |
with: | |
folder: ./reports | |
event_file: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: event-file | |
retention-days: 1 | |
path: ${{ github.event_path }} |