Skip to content

[pre-commit.ci] pre-commit autoupdate #332

[pre-commit.ci] pre-commit autoupdate

[pre-commit.ci] pre-commit autoupdate #332

Workflow file for this run

name: Tests
on:
push:
branches:
- develop
pull_request:
branches-ignore:
- master
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
env:
DEFAULT_PYTHON: '3.14'
MIN_COVERAGE: 100
permissions:
contents: write
checks: write
pull-requests: write
jobs:
tests:
name: Run tests (${{ matrix.python-version }} on ${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- python-version: '3.7'
os: ubuntu-22.04
- python-version: '3.14'
os: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: 'false'
# no uv cache here because fresh install takes about 1 second
- name: Run tests
run: |
mkdir reports/ || echo "Directory exists"
make test-ci PYTEST_ARGS="--junitxml=reports/junit/python${{ matrix.python-version }}.xml"
- name: Upload coverage results
uses: actions/upload-artifact@v7
if: success() || failure()
with:
name: coverage-${{ matrix.python-version }}-os-${{ matrix.os }}
path: reports/*
# https://github.com/actions/upload-artifact/issues/602
include-hidden-files: true
all_done:
name: Tests done
runs-on: ubuntu-latest
permissions:
contents: write
checks: write
pull-requests: write
if: success() || failure()
needs: [tests]
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Download all coverage reports
uses: actions/download-artifact@v8
with:
path: reports/
pattern: coverage-*
merge-multiple: true
- name: Show test results
uses: mikepenz/action-junit-report@v6
with:
report_paths: reports/junit/*.xml
- name: Set up Python ${{ env. DEFAULT_PYTHON }}
uses: actions/setup-python@v6
with:
python-version: ${{ env.DEFAULT_PYTHON }}
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: 'false'
# no uv cache here because fresh install takes about 1 second
- name: Generate coverate reports
run: |
uv run --group test coverage combine
uv run --group test coverage xml -o reports/coverage.xml
- name: Coverage comment
id: coverage
uses: MishaKav/pytest-coverage-comment@v1
with:
pytest-xml-coverage-path: ./reports/coverage.xml
default-branch: develop
xml-skip-covered: true
report-only-changed-files: true
hide-comment: ${{ github.event_name != 'pull_request' }}
- name: Dynamic Badges
uses: schneegans/[email protected]
if: github.repository == 'MTSWebServices/evacuator' && github.event_name == 'push'
with:
auth: ${{ secrets.AUTOMERGE_TOKEN }}
gistID: 03e73a82ecc4709934540ce8201cc3b4
filename: evacuator_badge.json
label: Coverage
message: ${{ steps.coverage.outputs.coverage }}
color: ${{ steps.coverage.outputs.color }}
- name: Fail if coverage too low
if: ${{ steps.coverage.outputs.coverage < env.MIN_COVERAGE }}
run: |
echo "Coverage is below ${{ env.MIN_COVERAGE }}%!"
exit 1
- name: All done
run: echo 1