|
| 1 | +name: CI |
| 2 | + |
| 3 | +permissions: {} |
| 4 | + |
| 5 | +on: |
| 6 | + push: |
| 7 | + branches-ignore: |
| 8 | + - "dependabot/**" |
| 9 | + pull_request: |
| 10 | + |
| 11 | +concurrency: |
| 12 | + group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) && format('-{0}', github.sha) || '' }} |
| 13 | + cancel-in-progress: true |
| 14 | + |
| 15 | +jobs: |
| 16 | + Windows: |
| 17 | + name: 'Windows (${{ matrix.python }}, ${{ matrix.arch }}${{ matrix.extra_name }})' |
| 18 | + timeout-minutes: 20 |
| 19 | + runs-on: 'windows-latest' |
| 20 | + strategy: |
| 21 | + fail-fast: false |
| 22 | + matrix: |
| 23 | + python: ['3.9', '3.10', '3.11', '3.12', '3.13'] |
| 24 | + arch: ['x86', 'x64'] |
| 25 | + continue-on-error: >- |
| 26 | + ${{ |
| 27 | + ( |
| 28 | + endsWith(matrix.python, '-dev') |
| 29 | + || endsWith(matrix.python, '-nightly') |
| 30 | + ) |
| 31 | + && true |
| 32 | + || false |
| 33 | + }} |
| 34 | + steps: |
| 35 | + - name: Checkout |
| 36 | + uses: actions/checkout@v4 |
| 37 | + with: |
| 38 | + persist-credentials: false |
| 39 | + - name: Setup python |
| 40 | + uses: actions/setup-python@v5 |
| 41 | + with: |
| 42 | + # This allows the matrix to specify just the major.minor version while still |
| 43 | + # expanding it to get the latest patch version including alpha releases. |
| 44 | + # This avoids the need to update for each new alpha, beta, release candidate, |
| 45 | + # and then finally an actual release version. actions/setup-python doesn't |
| 46 | + # support this for PyPy presently so we get no help there. |
| 47 | + # |
| 48 | + # 'CPython' -> '3.9.0-alpha - 3.9.X' |
| 49 | + # 'PyPy' -> 'pypy-3.9' |
| 50 | + python-version: ${{ fromJSON(format('["{0}", "{1}"]', format('{0}.0-alpha - {0}.X', matrix.python), matrix.python))[startsWith(matrix.python, 'pypy')] }} |
| 51 | + architecture: '${{ matrix.arch }}' |
| 52 | + cache: pip |
| 53 | + cache-dependency-path: test-requirements.txt |
| 54 | + - name: Run tests |
| 55 | + run: ./ci.sh |
| 56 | + shell: bash |
| 57 | + |
| 58 | + Ubuntu: |
| 59 | + name: 'Ubuntu (${{ matrix.python }}${{ matrix.extra_name }})' |
| 60 | + timeout-minutes: 10 |
| 61 | + runs-on: 'ubuntu-latest' |
| 62 | + strategy: |
| 63 | + fail-fast: false |
| 64 | + matrix: |
| 65 | + python: ['3.9', '3.10', '3.11', '3.12', '3.13'] |
| 66 | + check_formatting: ['0'] |
| 67 | + extra_name: [''] |
| 68 | + include: |
| 69 | + - python: '3.12' |
| 70 | + check_formatting: '1' |
| 71 | + extra_name: ', check formatting' |
| 72 | + continue-on-error: >- |
| 73 | + ${{ |
| 74 | + ( |
| 75 | + endsWith(matrix.python, '-dev') |
| 76 | + || endsWith(matrix.python, '-nightly') |
| 77 | + ) |
| 78 | + && true |
| 79 | + || false |
| 80 | + }} |
| 81 | + steps: |
| 82 | + - name: Checkout |
| 83 | + with: |
| 84 | + persist-credentials: false |
| 85 | + uses: actions/checkout@v4 |
| 86 | + - name: Setup python |
| 87 | + uses: actions/setup-python@v5 |
| 88 | + if: "!endsWith(matrix.python, '-dev')" |
| 89 | + with: |
| 90 | + python-version: ${{ fromJSON(format('["{0}", "{1}"]', format('{0}.0-alpha - {0}.X', matrix.python), matrix.python))[startsWith(matrix.python, 'pypy')] }} |
| 91 | + cache: pip |
| 92 | + cache-dependency-path: test-requirements.txt |
| 93 | + - name: Setup python (dev) |
| 94 | + uses: deadsnakes/action@v2.0.2 |
| 95 | + if: endsWith(matrix.python, '-dev') |
| 96 | + with: |
| 97 | + python-version: '${{ matrix.python }}' |
| 98 | + - name: Run tests |
| 99 | + run: ./ci.sh |
| 100 | + env: |
| 101 | + CHECK_FORMATTING: '${{ matrix.check_formatting }}' |
| 102 | + |
| 103 | + macOS: |
| 104 | + name: 'macOS (${{ matrix.python }})' |
| 105 | + timeout-minutes: 15 |
| 106 | + runs-on: 'macos-latest' |
| 107 | + strategy: |
| 108 | + fail-fast: false |
| 109 | + matrix: |
| 110 | + python: ['3.9', '3.10', '3.11', '3.12', '3.13'] |
| 111 | + continue-on-error: >- |
| 112 | + ${{ |
| 113 | + ( |
| 114 | + endsWith(matrix.python, '-dev') |
| 115 | + || endsWith(matrix.python, '-nightly') |
| 116 | + ) |
| 117 | + && true |
| 118 | + || false |
| 119 | + }} |
| 120 | + steps: |
| 121 | + - name: Checkout |
| 122 | + uses: actions/checkout@v4 |
| 123 | + with: |
| 124 | + persist-credentials: false |
| 125 | + - name: Setup python |
| 126 | + uses: actions/setup-python@v5 |
| 127 | + with: |
| 128 | + python-version: ${{ fromJSON(format('["{0}", "{1}"]', format('{0}.0-alpha - {0}.X', matrix.python), matrix.python))[startsWith(matrix.python, 'pypy')] }} |
| 129 | + cache: pip |
| 130 | + cache-dependency-path: test-requirements.txt |
| 131 | + - name: Run tests |
| 132 | + run: ./ci.sh |
| 133 | + |
| 134 | + # https://github.com/marketplace/actions/alls-green#why |
| 135 | + check: # This job does nothing and is only used for the branch protection |
| 136 | + |
| 137 | + if: always() |
| 138 | + |
| 139 | + needs: |
| 140 | + - Windows |
| 141 | + - Ubuntu |
| 142 | + - macOS |
| 143 | + |
| 144 | + runs-on: ubuntu-latest |
| 145 | + |
| 146 | + steps: |
| 147 | + - name: Decide whether the needed jobs succeeded or failed |
| 148 | + uses: re-actors/alls-green@release/v1 |
| 149 | + with: |
| 150 | + jobs: ${{ toJSON(needs) }} |
0 commit comments