| 1 | name: Test |
| 2 | |
| 3 | on: |
| 4 | pull_request: |
| 5 | push: |
| 6 | branches: |
| 7 | - "main" |
| 8 | |
| 9 | jobs: |
| 10 | actionlint: |
| 11 | runs-on: ubuntu-latest |
| 12 | steps: |
| 13 | - uses: actions/checkout@v5 |
| 14 | - name: Download actionlint |
| 15 | run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash) 1.6.21 |
| 16 | shell: bash |
| 17 | - name: Check workflow files |
| 18 | run: ./actionlint -color |
| 19 | shell: bash |
| 20 | |
| 21 | lint-cruft: |
| 22 | name: Check if automatic project update was successful |
| 23 | runs-on: ubuntu-latest |
| 24 | steps: |
| 25 | - uses: actions/checkout@v5 |
| 26 | - name: Fail if .rej files exist as structure update was not successful |
| 27 | run: test -z "$(find . -iname '*.rej')" |
| 28 | |
| 29 | pre-commit: |
| 30 | runs-on: ubuntu-latest |
| 31 | steps: |
| 32 | - uses: actions/checkout@v5 |
| 33 | - uses: ./.github/actions/python-poetry-env |
| 34 | - run: poetry run pre-commit run --all-files |
| 35 | |
| 36 | test: |
| 37 | runs-on: ubuntu-latest |
| 38 | strategy: |
| 39 | fail-fast: false |
| 40 | matrix: |
| 41 | python-version: ["3.9", "3.10", "3.11", "3.12"] |
| 42 | steps: |
| 43 | - uses: actions/checkout@v5 |
| 44 | - uses: ./.github/actions/python-poetry-env |
| 45 | with: |
| 46 | python-version: ${{ matrix.python-version }} |
| 47 | - run: poetry run pytest --cov=src tests --cov-report=xml |
| 48 | - name: Upload coverage artifact |
| 49 | uses: actions/[email protected] |
| 50 | with: |
| 51 | name: coverage-${{ matrix.python-version }} |
| 52 | path: coverage.xml |
| 53 | |
| 54 | docs: |
| 55 | runs-on: ubuntu-latest |
| 56 | steps: |
| 57 | - uses: actions/checkout@v5 |
| 58 | - uses: ./.github/actions/python-poetry-env |
| 59 | - run: poetry run mkdocs build |
| 60 | |
| 61 | coverage: |
| 62 | runs-on: ubuntu-latest |
| 63 | needs: test |
| 64 | steps: |
| 65 | - name: Checkout code from GitHub |
| 66 | uses: actions/checkout@v5 |
| 67 | - name: Download coverage artifacts |
| 68 | uses: actions/[email protected] |
| 69 | - name: Upload coverage reports to Codecov |
| 70 | uses: codecov/[email protected] |
| 71 | with: |
| 72 | token: ${{ secrets.CODECOV_TOKEN }} |