|
| 1 | +name: Run tests |
| 2 | + |
| 3 | +on: |
| 4 | + # run on push in main or rel_* branches excluding changes are only on doc or example folders |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - "staging" |
| 8 | + paths-ignore: |
| 9 | + - "examples/**" |
| 10 | + |
| 11 | +env: |
| 12 | + # global env to all steps |
| 13 | + TOX_WORKERS: -n4 |
| 14 | + |
| 15 | +permissions: |
| 16 | + contents: read |
| 17 | + |
| 18 | +jobs: |
| 19 | + run-test: |
| 20 | + name: test-${{ matrix.python-version }}-${{ matrix.os }}-${{ matrix.architecture }}-${{ matrix.build-type }} |
| 21 | + runs-on: ${{ matrix.os }} |
| 22 | + strategy: |
| 23 | + # run this job using this matrix, excluding some combinations below. |
| 24 | + matrix: |
| 25 | + os: |
| 26 | + - "ubuntu-22.04" |
| 27 | + - "ubuntu-22.04-arm" |
| 28 | + - "windows-latest" |
| 29 | + - "macos-latest" |
| 30 | + - "macos-13" |
| 31 | + python-version: |
| 32 | + - "3.9" |
| 33 | + - "3.10" |
| 34 | + - "3.11" |
| 35 | + - "3.12" |
| 36 | + - "3.13" |
| 37 | + - "pypy-3.10" |
| 38 | + build-type: |
| 39 | + - "cext" |
| 40 | + - "nocext" |
| 41 | + architecture: |
| 42 | + - x64 |
| 43 | + - x86 |
| 44 | + - arm64 |
| 45 | + |
| 46 | + include: |
| 47 | + # autocommit tests fail on the ci for some reason |
| 48 | + - python-version: "pypy-3.10" |
| 49 | + pytest-args: "-k 'not test_autocommit_on and not test_turn_autocommit_off_via_default_iso_level and not test_autocommit_isolation_level'" |
| 50 | + - os: "ubuntu-22.04" |
| 51 | + pytest-args: "--dbdriver pysqlite --dbdriver aiosqlite" |
| 52 | + - os: "ubuntu-22.04-arm" |
| 53 | + pytest-args: "--dbdriver pysqlite --dbdriver aiosqlite" |
| 54 | + |
| 55 | + |
| 56 | + exclude: |
| 57 | + # linux do not have x86 / arm64 python |
| 58 | + - os: "ubuntu-22.04" |
| 59 | + architecture: x86 |
| 60 | + - os: "ubuntu-22.04" |
| 61 | + architecture: arm64 |
| 62 | + # linux-arm do not have x86 / x64 python |
| 63 | + - os: "ubuntu-22.04-arm" |
| 64 | + architecture: x86 |
| 65 | + - os: "ubuntu-22.04-arm" |
| 66 | + architecture: x64 |
| 67 | + # windows des not have arm64 python |
| 68 | + - os: "windows-latest" |
| 69 | + architecture: arm64 |
| 70 | + # macos: latests uses arm macs. only 3.10+; no x86/x64 |
| 71 | + - os: "macos-latest" |
| 72 | + architecture: x86 |
| 73 | + - os: "macos-latest" |
| 74 | + architecture: x64 |
| 75 | + - os: "macos-latest" |
| 76 | + python-version: "3.9" |
| 77 | + # macos 13: uses intel macs. no arm64, x86 |
| 78 | + - os: "macos-13" |
| 79 | + architecture: arm64 |
| 80 | + - os: "macos-13" |
| 81 | + architecture: x86 |
| 82 | + # pypy does not have cext or x86 or arm on linux |
| 83 | + - python-version: "pypy-3.10" |
| 84 | + build-type: "cext" |
| 85 | + - os: "ubuntu-22.04-arm" |
| 86 | + python-version: "pypy-3.10" |
| 87 | + - os: "windows-latest" |
| 88 | + python-version: "pypy-3.10" |
| 89 | + architecture: x86 |
| 90 | + |
| 91 | + fail-fast: false |
| 92 | + |
| 93 | + # steps to run in each job. Some are github actions, others run shell commands |
| 94 | + steps: |
| 95 | + - name: Checkout repo |
| 96 | + uses: actions/checkout@v4 |
| 97 | + |
| 98 | + - name: Set up python |
| 99 | + uses: actions/setup-python@v5 |
| 100 | + with: |
| 101 | + python-version: ${{ matrix.python-version }} |
| 102 | + architecture: ${{ matrix.architecture }} |
| 103 | + |
| 104 | + - name: Remove greenlet |
| 105 | + if: ${{ matrix.no-greenlet == 'true' }} |
| 106 | + shell: pwsh |
| 107 | + run: | |
| 108 | + (cat setup.cfg) | %{$_ -replace "^\s*greenlet.+",""} | set-content setup.cfg |
| 109 | +
|
| 110 | + - name: Install dependencies |
| 111 | + run: | |
| 112 | + python -m pip install --upgrade pip |
| 113 | + pip install --upgrade tox setuptools |
| 114 | + pip list |
| 115 | +
|
| 116 | + - name: Run tests |
| 117 | + run: tox -e github-${{ matrix.build-type }} -- -q --nomemory --notimingintensive ${{ matrix.pytest-args }} |
| 118 | + continue-on-error: ${{ matrix.python-version == 'pypy-3.10' }} |
| 119 | + |
| 120 | + run-tox: |
| 121 | + name: ${{ matrix.tox-env }}-${{ matrix.python-version }} |
| 122 | + runs-on: ${{ matrix.os }} |
| 123 | + strategy: |
| 124 | + # run this job using this matrix, excluding some combinations below. |
| 125 | + matrix: |
| 126 | + os: |
| 127 | + - "ubuntu-22.04" |
| 128 | + python-version: |
| 129 | + - "3.9" |
| 130 | + - "3.10" |
| 131 | + - "3.11" |
| 132 | + - "3.12" |
| 133 | + - "3.13" |
| 134 | + tox-env: |
| 135 | + - mypy |
| 136 | + - pep484 |
| 137 | + |
| 138 | + include: |
| 139 | + # run lint only on 3.12 |
| 140 | + - tox-env: lint |
| 141 | + python-version: "3.12" |
| 142 | + os: "ubuntu-22.04" |
| 143 | + exclude: |
| 144 | + # run pep484 only on 3.10+ |
| 145 | + - tox-env: pep484 |
| 146 | + python-version: "3.9" |
| 147 | + |
| 148 | + fail-fast: false |
| 149 | + |
| 150 | + # steps to run in each job. Some are github actions, others run shell commands |
| 151 | + steps: |
| 152 | + - name: Checkout repo |
| 153 | + uses: actions/checkout@v4 |
| 154 | + |
| 155 | + - name: Set up python |
| 156 | + uses: actions/setup-python@v5 |
| 157 | + with: |
| 158 | + python-version: ${{ matrix.python-version }} |
| 159 | + architecture: ${{ matrix.architecture }} |
| 160 | + |
| 161 | + - name: Install dependencies |
| 162 | + run: | |
| 163 | + python -m pip install --upgrade pip |
| 164 | + pip install --upgrade tox setuptools |
| 165 | + pip list |
| 166 | +
|
| 167 | + - name: Run tox |
| 168 | + run: tox -e ${{ matrix.tox-env }} ${{ matrix.pytest-args }} |
0 commit comments