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