--- name: Tests on: push: branches: - main pull_request: jobs: tests: runs-on: ubuntu-latest strategy: fail-fast: false matrix: python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] steps: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Ensure latest setuptools run: | python -m pip install --upgrade pip setuptools - name: Install dependencies run: | python -m pip install coverage[toml] tox tox-py unittest-xml-reporting - name: Run tox run: | python -m pip --version python -m tox --version python -m tox --py current - name: Coverage reporting run: | coverage combine coverage report --show-missing mv .coverage .coverage.${{ matrix.python-version }} - name: Store coverage file uses: actions/upload-artifact@v4 with: include-hidden-files: true name: coverage-${{ matrix.python-version }} path: .coverage.${{ matrix.python-version }} coverage: name: Coverage runs-on: ubuntu-latest needs: tests permissions: # If the author is a maintainer, the permission level is set by the # values below. # `pull-requests: write` is needed for publishing new comments in pull # requests. # `contents: write` is needed for pushing data to the # `python-coverage-comment-action` branch, and for editing existing # comments (to avoid publishing multiple comments in the same PR) # In case the pull request comes from a forked repository, the maximum # permission level is read, so the permissions below won't be acted upon # by GitHub. # https://docs.github.com/en/actions/security-guides/automatic-token-authentication#permissions-for-the-github_token pull-requests: write contents: write steps: - uses: actions/checkout@v4 - uses: actions/download-artifact@v4 id: download with: pattern: coverage-* merge-multiple: true - name: Coverage comment id: coverage_comment uses: py-cov-action/python-coverage-comment-action@v3 with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} MERGE_COVERAGE_FILES: true - name: Store Pull Request comment to be posted uses: actions/upload-artifact@v4 if: steps.coverage_comment.outputs.COMMENT_FILE_WRITTEN == 'true' with: name: python-coverage-comment-action path: python-coverage-comment-action.txt isort: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v5 with: python-version: "3.13" - name: Ensure latest setuptools run: | python -m pip install --upgrade pip setuptools - name: Install dependencies run: | python -m pip install tox - name: Run tox run: | python -m pip --version python -m tox --version python -m tox -e isort,lint,docs warnings: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v5 with: python-version: "3.13" - name: Ensure latest setuptools run: | python -m pip install --upgrade pip setuptools - name: Install dependencies run: | python -m pip install tox - name: Run tox run: | python -m pip --version python -m tox --version python -m tox -e warnings