| 1 |
name: Hypothesis CI |
| 2 |
|
| 3 |
env: |
| 4 |
|
| 5 |
|
| 6 |
PY_COLORS: 1 |
| 7 |
|
| 8 |
on: |
| 9 |
push: |
| 10 |
branches: [ master ] |
| 11 |
pull_request: |
| 12 |
branches: [ master ] |
| 13 |
workflow_dispatch: |
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
concurrency: |
| 18 |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} |
| 19 |
cancel-in-progress: true |
| 20 |
|
| 21 |
jobs: |
| 22 |
basic: |
| 23 |
runs-on: ubuntu-latest |
| 24 |
strategy: |
| 25 |
matrix: |
| 26 |
task: |
| 27 |
- tox-cover |
| 28 |
- tox-nocover |
| 29 |
- tox-rest |
| 30 |
- check-whole-repo-tests |
| 31 |
- check-types-hypothesis |
| 32 |
- lint |
| 33 |
- check-format |
| 34 |
fail-fast: false |
| 35 |
env: |
| 36 |
PYTHON_VERSION: "3.14" |
| 37 |
steps: |
| 38 |
- uses: actions/checkout@v3 |
| 39 |
with: |
| 40 |
fetch-depth: 0 |
| 41 |
- name: "Install base for Python ${{ env.PYTHON_VERSION }}" |
| 42 |
uses: ./.github/actions/install-base |
| 43 |
with: |
| 44 |
python-version: ${{ env.PYTHON_VERSION }} |
| 45 |
task: ${{ matrix.task }} |
| 46 |
- name: Install tox |
| 47 |
if: ${{ startsWith(matrix.task, 'tox-') }} |
| 48 |
run: | |
| 49 |
pip install --upgrade setuptools pip wheel |
| 50 |
pip install tox |
| 51 |
- name: Run tests |
| 52 |
run: | |
| 53 |
export TASK=${{ matrix.task }} |
| 54 |
if [[ $TASK == tox-* ]]; then |
| 55 |
TOX_TASK="${TASK#tox-}" |
| 56 |
cd hypothesis-python |
| 57 |
tox -e $TOX_TASK |
| 58 |
else |
| 59 |
./build.sh |
| 60 |
fi |
| 61 |
|
| 62 |
req: |
| 63 |
needs: [basic] |
| 64 |
runs-on: ubuntu-latest |
| 65 |
strategy: |
| 66 |
matrix: |
| 67 |
task: |
| 68 |
- check-documentation |
| 69 |
- check-types-api |
| 70 |
- check-coverage |
| 71 |
- check-conjecture-coverage |
| 72 |
- check-py310-cover |
| 73 |
- check-py310-nocover |
| 74 |
- check-py310-niche |
| 75 |
- check-pypy310-cover |
| 76 |
|
| 77 |
- check-py311-cover |
| 78 |
- check-py311-nocover |
| 79 |
- check-py311-niche |
| 80 |
- check-pypy311-cover |
| 81 |
- check-py312-cover |
| 82 |
- check-py312-nocover |
| 83 |
- check-py312-niche |
| 84 |
- check-py313-cover |
| 85 |
- check-py313-nocover |
| 86 |
- check-py313-niche |
| 87 |
- check-py313t-cover |
| 88 |
- check-py313t-nocover |
| 89 |
- check-py313t-niche |
| 90 |
- check-quality |
| 91 |
- check-pytest9 |
| 92 |
- check-pytest84 |
| 93 |
- check-pytest74 |
| 94 |
- check-py311-pytest62 |
| 95 |
- check-django60 |
| 96 |
- check-django42 |
| 97 |
- check-py313-pandas22 |
| 98 |
- check-py312-pandas21 |
| 99 |
- check-py311-pandas20 |
| 100 |
- check-py311-pandas15 |
| 101 |
- check-py310-pandas14 |
| 102 |
- check-py310-pandas13 |
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
fail-fast: false |
| 107 |
env: |
| 108 |
PYTHON_VERSION: "3.14" |
| 109 |
steps: |
| 110 |
- uses: actions/checkout@v3 |
| 111 |
with: |
| 112 |
fetch-depth: 0 |
| 113 |
- name: "Install base for Python ${{ env.PYTHON_VERSION }}" |
| 114 |
uses: ./.github/actions/install-base |
| 115 |
with: |
| 116 |
python-version: ${{ env.PYTHON_VERSION }} |
| 117 |
task: ${{ matrix.task }} |
| 118 |
- name: Run tests |
| 119 |
run: | |
| 120 |
export TASK=${{ matrix.task }} |
| 121 |
if [[ $TASK == check-crosshair-custom-* ]]; then |
| 122 |
GROUP="${TASK#check-crosshair-custom-}" |
| 123 |
./build.sh check-crosshair-custom -- -n auto $(cd hypothesis-python && echo tests/$GROUP | xargs -n1 echo | grep -Ev "_py312|_py314" | xargs) |
| 124 |
else |
| 125 |
./build.sh |
| 126 |
fi |
| 127 |
- name: Upload coverage data |
| 128 |
uses: actions/upload-artifact@v4 |
| 129 |
|
| 130 |
if: ${{ always() && endsWith(matrix.task, '-coverage') }} |
| 131 |
with: |
| 132 |
name: ${{ matrix.task }}-data |
| 133 |
include-hidden-files: true |
| 134 |
path: | |
| 135 |
hypothesis-python/.coverage* |
| 136 |
!hypothesis-python/.coveragerc |
| 137 |
hypothesis-python/branch-check* |
| 138 |
|
| 139 |
nonreq: |
| 140 |
needs: [basic] |
| 141 |
runs-on: ubuntu-latest |
| 142 |
strategy: |
| 143 |
matrix: |
| 144 |
task: |
| 145 |
- check-py314-cover |
| 146 |
- check-py314-nocover |
| 147 |
|
| 148 |
|
| 149 |
|
| 150 |
|
| 151 |
- check-py314t-cover |
| 152 |
- check-py314t-nocover |
| 153 |
- check-py314t-niche |
| 154 |
|
| 155 |
|
| 156 |
|
| 157 |
|
| 158 |
|
| 159 |
|
| 160 |
- check-django52 |
| 161 |
|
| 162 |
- check-crosshair-custom-cover/test_[a-d]* |
| 163 |
- check-crosshair-custom-cover/test_[e-i]* |
| 164 |
- check-crosshair-custom-cover/test_[j-r]* |
| 165 |
- check-crosshair-custom-cover/test_[s-z]* |
| 166 |
- check-crosshair-custom-pytest/test_* |
| 167 |
- check-crosshair-custom-nocover/test_[a-d]* |
| 168 |
- check-crosshair-custom-nocover/test_[e-i]* |
| 169 |
- check-crosshair-custom-nocover/test_[j-r]* |
| 170 |
- check-crosshair-custom-nocover/test_[s-z]* |
| 171 |
|
| 172 |
- check-threading |
| 173 |
- check-py310-oldestnumpy |
| 174 |
- check-numpy-nightly |
| 175 |
fail-fast: false |
| 176 |
env: |
| 177 |
PYTHON_VERSION: "3.14" |
| 178 |
steps: |
| 179 |
- uses: actions/checkout@v3 |
| 180 |
with: |
| 181 |
fetch-depth: 0 |
| 182 |
- name: "Install base for Python ${{ env.PYTHON_VERSION }}" |
| 183 |
uses: ./.github/actions/install-base |
| 184 |
with: |
| 185 |
python-version: ${{ env.PYTHON_VERSION }} |
| 186 |
task: ${{ matrix.task }} |
| 187 |
- name: Run tests |
| 188 |
run: | |
| 189 |
export TASK=${{ matrix.task }} |
| 190 |
if [[ $TASK == check-crosshair-custom-* ]]; then |
| 191 |
GROUP="${TASK#check-crosshair-custom-}" |
| 192 |
./build.sh check-crosshair-custom -- -n auto $(cd hypothesis-python && echo tests/$GROUP | xargs -n1 echo | grep -Ev "_py312|_py314" | xargs) |
| 193 |
else |
| 194 |
./build.sh |
| 195 |
fi |
| 196 |
|
| 197 |
cross: |
| 198 |
needs: [basic] |
| 199 |
strategy: |
| 200 |
matrix: |
| 201 |
os: |
| 202 |
- windows-latest |
| 203 |
- macos-latest |
| 204 |
python-version: |
| 205 |
- "3.11" |
| 206 |
- "3.14" |
| 207 |
python-architecture: |
| 208 |
- null |
| 209 |
- "x86" |
| 210 |
task: |
| 211 |
- cover |
| 212 |
- nocover |
| 213 |
- rest |
| 214 |
- alt-nocover |
| 215 |
- alt-rest |
| 216 |
exclude: |
| 217 |
- { os: macos-latest, python-architecture: "x86" } |
| 218 |
- { python-version: "3.14", python-architecture: "x86" } |
| 219 |
- { python-version: "3.11", task: nocover } |
| 220 |
- { python-version: "3.11", task: rest } |
| 221 |
- { python-version: "3.14", task: alt-nocover } |
| 222 |
- { python-version: "3.14", task: alt-rest } |
| 223 |
fail-fast: false |
| 224 |
runs-on: ${{ matrix.os }} |
| 225 |
env: |
| 226 |
|
| 227 |
PYTHONWARNDEFAULTENCODING: "" |
| 228 |
steps: |
| 229 |
- uses: actions/checkout@v3 |
| 230 |
with: |
| 231 |
fetch-depth: 0 |
| 232 |
- name: "Install base for Python ${{ matrix.python-version }} ${{ matrix.python-architecture }}" |
| 233 |
uses: ./.github/actions/install-base |
| 234 |
with: |
| 235 |
python-version: ${{ matrix.python-version }} |
| 236 |
python-architecture: ${{ matrix.python-architecture }} |
| 237 |
task: ${{ matrix.task }} |
| 238 |
- name: Install tox |
| 239 |
run: | |
| 240 |
pip install --upgrade setuptools pip wheel |
| 241 |
pip install tox |
| 242 |
- name: Run tests |
| 243 |
working-directory: ./hypothesis-python |
| 244 |
run: | |
| 245 |
tox -e ${{ matrix.task }} |
| 246 |
|
| 247 |
|
| 248 |
|
| 249 |
test-pyodide: |
| 250 |
needs: [basic] |
| 251 |
runs-on: ubuntu-latest |
| 252 |
env: |
| 253 |
NODE_VERSION: 22 |
| 254 |
|
| 255 |
|
| 256 |
PYODIDE_VERSION: 0.29.3 |
| 257 |
PYODIDE_BUILD_VERSION: 0.34.1 |
| 258 |
|
| 259 |
PYTHON_VERSION: 3.13.2 |
| 260 |
steps: |
| 261 |
- uses: actions/checkout@v3 |
| 262 |
with: |
| 263 |
fetch-depth: 0 |
| 264 |
- name: "Install base for Python ${{ env.PYTHON_VERSION }}" |
| 265 |
uses: ./.github/actions/install-base |
| 266 |
with: |
| 267 |
python-version: ${{ env.PYTHON_VERSION }} |
| 268 |
task: pyodide |
| 269 |
- name: Set up Node |
| 270 |
uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 |
| 271 |
with: |
| 272 |
node-version: ${{ env.NODE_VERSION }} |
| 273 |
- name: Install pyodide-build and Pyodide cross-build environment |
| 274 |
run: | |
| 275 |
pip install pyodide-build==${{ env.PYODIDE_BUILD_VERSION }} |
| 276 |
pyodide xbuildenv install ${{ env.PYODIDE_VERSION }} |
| 277 |
- name: Set up Pyodide venv and install dependencies |
| 278 |
run: | |
| 279 |
pip install --upgrade setuptools pip wheel build |
| 280 |
python -m build --wheel hypothesis-python --outdir dist/ |
| 281 |
pip download --dest=dist/ hypothesis-python/ pytest tzdata syrupy # fetch all the wheels |
| 282 |
rm dist/packaging-*.whl # fails with `invalid metadata entry 'name'` |
| 283 |
pyodide venv .venv-pyodide |
| 284 |
source .venv-pyodide/bin/activate |
| 285 |
pip install dist/*.whl |
| 286 |
- name: Run tests |
| 287 |
run: | |
| 288 |
source .venv-pyodide/bin/activate |
| 289 |
# pyodide can't run multiple processes internally, so parallelize explicitly over |
| 290 |
# discovered test files instead (20 at a time) |
| 291 |
TEST_FILES=$(ls hypothesis-python/tests/cover/test*.py | grep -v "_py314") |
| 292 |
echo "test files: $TEST_FILES" |
| 293 |
parallel --max-procs 100% --max-args 20 --keep-order --line-buffer \ |
| 294 |
python -m pytest -p no:cacheprovider <<< $TEST_FILES |
| 295 |
|
| 296 |
check-required: |
| 297 |
if: always() |
| 298 |
needs: [basic, req, cross] |
| 299 |
runs-on: ubuntu-latest |
| 300 |
steps: |
| 301 |
- name: Check required jobs |
| 302 |
uses: re-actors/alls-green@release/v1 |
| 303 |
with: |
| 304 |
jobs: ${{ toJSON(needs) }} |
| 305 |
|
| 306 |
deploy: |
| 307 |
if: "github.event_name == 'push' && github.repository == 'HypothesisWorks/hypothesis'" |
| 308 |
runs-on: ubuntu-latest |
| 309 |
needs: [check-required] |
| 310 |
strategy: |
| 311 |
matrix: |
| 312 |
task: |
| 313 |
- deploy |
| 314 |
fail-fast: false |
| 315 |
steps: |
| 316 |
- uses: actions/checkout@v3 |
| 317 |
with: |
| 318 |
fetch-depth: 0 |
| 319 |
token: ${{ secrets.GH_TOKEN }} |
| 320 |
- uses: ./.github/actions/install-base |
| 321 |
with: |
| 322 |
python-version: "3.14" |
| 323 |
- name: Deploy package |
| 324 |
env: |
| 325 |
GH_TOKEN: ${{ secrets.GH_TOKEN }} |
| 326 |
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} |
| 327 |
run: | |
| 328 |
TASK=${{ matrix.task }} ./build.sh |