|
| 1 | +name: tests |
| 2 | + |
| 3 | +on: |
| 4 | + merge_group: |
| 5 | + push: |
| 6 | + branches-ignore: |
| 7 | + # temporary GH branches relating to merge queues (jaraco/skeleton#93) |
| 8 | + - gh-readonly-queue/** |
| 9 | + tags: |
| 10 | + # required if branches-ignore is supplied (jaraco/skeleton#103) |
| 11 | + - '**' |
| 12 | + pull_request: |
| 13 | + |
| 14 | +permissions: |
| 15 | + contents: read |
| 16 | + |
| 17 | +env: |
| 18 | + # Environment variable to support color support (jaraco/skeleton#66) |
| 19 | + FORCE_COLOR: 1 |
| 20 | + |
| 21 | + # Suppress noisy pip warnings |
| 22 | + PIP_DISABLE_PIP_VERSION_CHECK: 'true' |
| 23 | + PIP_NO_PYTHON_VERSION_WARNING: 'true' |
| 24 | + PIP_NO_WARN_SCRIPT_LOCATION: 'true' |
| 25 | + |
| 26 | + # Ensure tests can sense settings about the environment |
| 27 | + TOX_OVERRIDE: >- |
| 28 | + testenv.pass_env+=GITHUB_*,FORCE_COLOR |
| 29 | +
|
| 30 | +
|
| 31 | +jobs: |
| 32 | + test: |
| 33 | + strategy: |
| 34 | + # https://blog.jaraco.com/efficient-use-of-ci-resources/ |
| 35 | + matrix: |
| 36 | + python: |
| 37 | + - "3.8" |
| 38 | + - "3.12" |
| 39 | + platform: |
| 40 | + - ubuntu-latest |
| 41 | + - macos-latest |
| 42 | + - windows-latest |
| 43 | + include: |
| 44 | + - python: "3.9" |
| 45 | + platform: ubuntu-latest |
| 46 | + - python: "3.10" |
| 47 | + platform: ubuntu-latest |
| 48 | + - python: "3.11" |
| 49 | + platform: ubuntu-latest |
| 50 | + - python: pypy3.10 |
| 51 | + platform: ubuntu-latest |
| 52 | + runs-on: ${{ matrix.platform }} |
| 53 | + continue-on-error: ${{ matrix.python == '3.13' }} |
| 54 | + steps: |
| 55 | + - uses: actions/checkout@v4 |
| 56 | + - name: Setup Python |
| 57 | + uses: actions/setup-python@v4 |
| 58 | + with: |
| 59 | + python-version: ${{ matrix.python }} |
| 60 | + allow-prereleases: true |
| 61 | + - name: Install tox |
| 62 | + run: python -m pip install tox |
| 63 | + - name: Run |
| 64 | + run: tox |
| 65 | + |
| 66 | + collateral: |
| 67 | + strategy: |
| 68 | + fail-fast: false |
| 69 | + matrix: |
| 70 | + job: |
| 71 | + - diffcov |
| 72 | + - docs |
| 73 | + runs-on: ubuntu-latest |
| 74 | + steps: |
| 75 | + - uses: actions/checkout@v4 |
| 76 | + with: |
| 77 | + fetch-depth: 0 |
| 78 | + - name: Setup Python |
| 79 | + uses: actions/setup-python@v4 |
| 80 | + with: |
| 81 | + python-version: 3.x |
| 82 | + - name: Install tox |
| 83 | + run: python -m pip install tox |
| 84 | + - name: Eval ${{ matrix.job }} |
| 85 | + run: tox -e ${{ matrix.job }} |
| 86 | + |
| 87 | + check: # This job does nothing and is only used for the branch protection |
| 88 | + if: always() |
| 89 | + |
| 90 | + needs: |
| 91 | + - test |
| 92 | + - collateral |
| 93 | + |
| 94 | + runs-on: ubuntu-latest |
| 95 | + |
| 96 | + steps: |
| 97 | + - name: Decide whether the needed jobs succeeded or failed |
| 98 | + uses: re-actors/alls-green@release/v1 |
| 99 | + with: |
| 100 | + jobs: ${{ toJSON(needs) }} |
| 101 | + |
| 102 | + release: |
| 103 | + permissions: |
| 104 | + contents: write |
| 105 | + needs: |
| 106 | + - check |
| 107 | + if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') |
| 108 | + runs-on: ubuntu-latest |
| 109 | + |
| 110 | + steps: |
| 111 | + - uses: actions/checkout@v4 |
| 112 | + - name: Setup Python |
| 113 | + uses: actions/setup-python@v4 |
| 114 | + with: |
| 115 | + python-version: 3.x |
| 116 | + - name: Install tox |
| 117 | + run: python -m pip install tox |
| 118 | + - name: Run |
| 119 | + run: tox -e release |
| 120 | + env: |
| 121 | + TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} |
| 122 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments