File: main.yml

package info (click to toggle)
python-hypothesis 6.148.7-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 15,728 kB
  • sloc: python: 64,147; ruby: 1,107; sh: 270; makefile: 43; javascript: 6
file content (337 lines) | stat: -rw-r--r-- 11,048 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
name: Hypothesis CI

env:
  # Tell pytest and other tools to produce coloured terminal output.
  # Make sure this is also in the "passenv" section of the tox config.
  PY_COLORS: 1

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]
  workflow_dispatch:

# Cancel in-progress PR builds if another commit is pushed.
# On non-PR builds, fall back to the globally-unique run_id and don't cancel.
concurrency:
  group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
  cancel-in-progress: true

jobs:
  basic:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        task:
          - tox-cover
          - tox-nocover
          - tox-rest
          - check-whole-repo-tests
          - check-types-hypothesis
          - lint
          - check-format
      fail-fast: false
    env:
      PYTHON_VERSION: "3.10"
    steps:
    - uses: actions/checkout@v3
      with:
        fetch-depth: 0
    - name: "Install base for Python ${{ env.PYTHON_VERSION }}"
      uses: ./.github/actions/install-base
      with:
        python-version: ${{ env.PYTHON_VERSION }}
        task: ${{ matrix.task }}
    - name: Install tox
      if: ${{ startsWith(matrix.task, 'tox-') }}
      run: |
        pip install --upgrade setuptools pip wheel
        pip install tox
    - name: Run tests
      run: |
        export TASK=${{ matrix.task }}
        if [[ $TASK == tox-* ]]; then
           TOX_TASK="${TASK#tox-}"
           cd hypothesis-python
           tox -e $TOX_TASK
        else
          ./build.sh
        fi

  req:
    needs: [basic]
    runs-on: ubuntu-latest
    strategy:
      matrix:
        task:
          - check-documentation
          - check-types-api
          - check-coverage
          - check-conjecture-coverage
          - check-py310-cover
          - check-py310-nocover
          - check-py310-niche
          - check-pypy310-cover
          # - check-py310-pyjion  # see notes in tox.ini
          - check-py311-cover
          - check-py311-nocover
          - check-py311-niche
          - check-pypy311-cover
          - check-py312-cover
          - check-py312-nocover
          - check-py312-niche
          - check-py313-cover
          - check-py313-nocover
          - check-py313-niche
          - check-py313t-cover
          - check-py313t-nocover
          - check-py313t-niche
          - check-quality
          - check-pytest62
          - check-pytest62
          - check-django51
          - check-django42
          - check-pandas22
          - check-pandas21
          - check-pandas20
          - check-pandas15
          - check-pandas14
          - check-pandas13
          ## FIXME: actions update means Python builds without eg _bz2, which was required
          # - check-py310-pandas12
          # - check-py310-pandas11
      fail-fast: false
    env:
      PYTHON_VERSION: "3.10"
    steps:
    - uses: actions/checkout@v3
      with:
        fetch-depth: 0
    - name: "Install base for Python ${{ env.PYTHON_VERSION }}"
      uses: ./.github/actions/install-base
      with:
        python-version: ${{ env.PYTHON_VERSION }}
        task: ${{ matrix.task }}
    - name: Run tests
      run: |
        export TASK=${{ matrix.task }}
        if [[ $TASK == check-crosshair-custom-* ]]; then
          GROUP="${TASK#check-crosshair-custom-}"
          ./build.sh check-crosshair-custom -- -n auto $(cd hypothesis-python && echo tests/$GROUP | xargs -n1 echo | grep -Ev "_py312|_py314" | xargs)
        else
          ./build.sh
        fi
    - name: Upload coverage data
      uses: actions/upload-artifact@v4
      # Invoke the magic `always` function to run on both success and failure.
      if: ${{ always() && endsWith(matrix.task, '-coverage') }}
      with:
        name: ${{ matrix.task }}-data
        include-hidden-files: true
        path: |
          hypothesis-python/.coverage*
          !hypothesis-python/.coveragerc
          hypothesis-python/branch-check*

  nonreq:
    needs: [basic]
    runs-on: ubuntu-latest
    strategy:
      matrix:
        task:
          - check-py314-cover
          - check-py314-nocover
          # Blocked by a 3.14rc1 bug. see
          # https://github.com/HypothesisWorks/hypothesis/pull/4490#issuecomment-3144989862.
          # Can revisit in 3.14rc2.
          # - check-py314-niche
          - check-py314t-cover
          - check-py314t-nocover
          - check-py314t-niche
          # - check-py315-cover
          # - check-py315-nocover
          # - check-py315-niche
          # - check-py315t-cover
          # - check-py315t-nocover
          # - check-py315t-niche
          - check-django52
          ## `-cover` is too slow under crosshair; use a custom split
          - check-crosshair-custom-cover/test_[a-d]*
          - check-crosshair-custom-cover/test_[e-i]*
          - check-crosshair-custom-cover/test_[j-r]*
          - check-crosshair-custom-cover/test_[s-z]*
          - check-crosshair-custom-pytest/test_*
          - check-crosshair-custom-nocover/test_[a-d]*
          - check-crosshair-custom-nocover/test_[e-i]*
          - check-crosshair-custom-nocover/test_[j-r]*
          - check-crosshair-custom-nocover/test_[s-z]*
          # - check-crosshair-niche
          - check-threading
          - check-py310-oldestnumpy
          - check-numpy-nightly
          ## Skip all the (inactive/old) Rust and Ruby tests pending fixes
          # - lint-ruby
          # - check-ruby-tests
          # - check-rust-in-ruby-format
          # - lint-rust-in-ruby
          # - audit-rust-in-ruby
          # - check-conjecture-rust-format
          # - check-rust-tests
          # - audit-conjecture-rust
          # - lint-conjecture-rust
      fail-fast: false
    env:
      PYTHON_VERSION: "3.10"
    steps:
    - uses: actions/checkout@v3
      with:
        fetch-depth: 0
    - name: "Install base for Python ${{ env.PYTHON_VERSION }}"
      uses: ./.github/actions/install-base
      with:
        python-version: ${{ env.PYTHON_VERSION }}
        task: ${{ matrix.task }}
    - name: Run tests
      run: |
        export TASK=${{ matrix.task }}
        if [[ $TASK == check-crosshair-custom-* ]]; then
          GROUP="${TASK#check-crosshair-custom-}"
          ./build.sh check-crosshair-custom -- -n auto $(cd hypothesis-python && echo tests/$GROUP | xargs -n1 echo | grep -Ev "_py312|_py314" | xargs)
        else
          ./build.sh
        fi

  cross:
    needs: [basic]
    strategy:
      matrix:
        os:
          - windows-latest
          - macos-latest
        python-version:
          - "3.11"
          - "3.13"
        python-architecture:
          - null
          - "x86"
        task:
          - cover
          - nocover
          - rest
          - alt-nocover
          - alt-rest
        exclude:
          - { os: macos-latest, python-architecture: "x86" }
          - { python-version: "3.13", python-architecture: "x86" }
          - { python-version: "3.11", task: nocover }
          - { python-version: "3.11", task: rest }
          - { python-version: "3.13", task: alt-nocover }
          - { python-version: "3.13", task: alt-rest }
      fail-fast: false
    runs-on: ${{ matrix.os }}
    env:
      # Override default from tox.ini
      PYTHONWARNDEFAULTENCODING: ""
    steps:
    - uses: actions/checkout@v3
      with:
        fetch-depth: 0
    - name: "Install base for Python ${{ matrix.python-version }} ${{ matrix.python-architecture }}"
      uses: ./.github/actions/install-base
      with:
        python-version: ${{ matrix.python-version }}
        python-architecture: ${{ matrix.python-architecture }}
        task: ${{ matrix.task }}
    - name: Install tox
      run: |
        pip install --upgrade setuptools pip wheel
        pip install tox
    - name: Run tests
      working-directory: ./hypothesis-python
      run: |
        tox -e ${{ matrix.task }}

  # See https://pyodide.org/en/stable/usage/building-and-testing-packages.html
  # and https://github.com/numpy/numpy/blob/9a650391651c8486d8cb8b27b0e75aed5d36033e/.github/workflows/emscripten.yml
  test-pyodide:
    needs: [basic]
    runs-on: ubuntu-latest
    env:
      NODE_VERSION: 22
      # Note that the versions below are updated by `update_pyodide_versions()` in our weekly cronjob.
      # The versions of pyodide-build and the Pyodide runtime may differ.
      PYODIDE_VERSION: 0.29.0
      PYODIDE_BUILD_VERSION: 0.30.9
      PYTHON_VERSION: 3.13.2
    steps:
    - uses: actions/checkout@v3
      with:
        fetch-depth: 0
    - name: "Install base for Python ${{ env.PYTHON_VERSION }}"
      uses: ./.github/actions/install-base
      with:
        python-version: ${{ env.PYTHON_VERSION }}
        task: pyodide
    - name: Set up Node
      uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1
      with:
        node-version: ${{ env.NODE_VERSION }}
    - name: Install pyodide-build and Pyodide cross-build environment
      run: |
        pip install pyodide-build==${{ env.PYODIDE_BUILD_VERSION }}
        pyodide xbuildenv install ${{ env.PYODIDE_VERSION }}
    - name: Set up Pyodide venv and install dependencies
      run: |
        pip install --upgrade setuptools pip wheel build
        python -m build --wheel hypothesis-python --outdir dist/
        pip download --dest=dist/ hypothesis-python/ pytest tzdata  # fetch all the wheels
         rm dist/packaging-*.whl  # fails with `invalid metadata entry 'name'`
         pyodide venv .venv-pyodide
        source .venv-pyodide/bin/activate
        pip install dist/*.whl
    - name: Run tests
      run: |
        source .venv-pyodide/bin/activate
        # pyodide can't run multiple processes internally, so parallelize explicitly over
        # discovered test files instead (20 at a time)
        TEST_FILES=$(ls hypothesis-python/tests/cover/test*.py | grep -v "_py314")
        echo "test files: $TEST_FILES"
        parallel --max-procs 100% --max-args 20 --keep-order --line-buffer \
          python -m pytest -p no:cacheprovider <<< $TEST_FILES

  check-required:
    if: always()
    needs: [basic, req, cross]
    runs-on: ubuntu-latest
    steps:
    - name: Check required jobs
      uses: re-actors/alls-green@release/v1
      with:
        jobs: ${{ toJSON(needs) }}

  deploy:
    if: "github.event_name == 'push' && github.repository == 'HypothesisWorks/hypothesis'"
    runs-on: ubuntu-latest
    needs: [check-required]
    strategy:
      matrix:
        task:
          - deploy
      fail-fast: false
    steps:
    - uses: actions/checkout@v3
      with:
        fetch-depth: 0
        token: ${{ secrets.GH_TOKEN }}
    - uses: ./.github/actions/install-base
      with:
        python-version: "3.10"
    - name: Deploy package
      env:
        GH_TOKEN: ${{ secrets.GH_TOKEN }}
        TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
        GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_TOKEN }}
        CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
      run: |
        TASK=${{ matrix.task }} ./build.sh