33 push :
44 branches :
55 - main
6- paths-ignore :
7- - " docs/**"
8- - " *.md"
9- - " *.rst"
106 pull_request :
117 branches :
128 - main
13- paths-ignore :
14- - " docs/**"
15- - " *.md"
16- - " *.rst"
179 schedule :
1810 - cron : " 0 8 * * *"
1911 workflow_dispatch :
@@ -23,129 +15,31 @@ concurrency:
2315 cancel-in-progress : true
2416
2517jobs :
26- pytest :
27- runs-on : ${{ matrix.os }}-latest
28- env :
29- PYTEST_ADDOPTS : " --run-integration --showlocals -vv --durations=10 --reruns 5 --only-rerun subprocess.CalledProcessError"
30- strategy :
31- fail-fast : false
32- matrix :
33- os :
34- - ubuntu
35- - macos
36- - windows
37- py :
38- - " pypy-3.7"
39- - " pypy-3.8"
40- - " pypy-3.9"
41- - " 3.11"
42- - " 3.10"
43- - " 3.9"
44- - " 3.8"
45- - " 3.7"
46- tox-target :
47- - " tox"
48- - " min"
49-
50- continue-on-error : >- # jobs not required in branch protection
51- ${{
52- (
53- startsWith(matrix.py, 'pypy-')
54- && (!endsWith(matrix.py, '-3.7') || matrix.os == 'windows')
55- )
56- && true
57- || false
58- }}
59-
60- steps :
61- - uses : actions/checkout@v3
62- with :
63- fetch-depth : 0
64-
65- - name : Setup python for test ${{ matrix.py }}
66- uses : actions/setup-python@v4
67- with :
68- python-version : ${{ matrix.py }}
69-
70- - name : Pick environment to run
71- run : |
72- import platform
73- import os
74- import sys
75-
76- if platform.python_implementation() == "PyPy":
77- base = f"pypy{sys.version_info.major}{sys.version_info.minor}"
78- else:
79- base = f"py{sys.version_info.major}{sys.version_info.minor}"
80- env = f"BASE={base}\n"
81- print(f"Picked:\n{env}for {sys.version}")
82- with open(os.environ["GITHUB_ENV"], "a", encoding="utf-8") as file:
83- file.write(env)
84- shell : python
85-
86- - name : Setup python for tox
87- uses : actions/setup-python@v4
88- with :
89- python-version : 3.9
90-
91- - name : Install tox
92- run : python -m pip install tox
18+ change-detection :
19+ uses : ./.github/workflows/reusable-change-detection.yml
9320
94- - name : Run test suite via tox
95- if : matrix.tox-target == 'tox'
96- run : |
97- tox -vv --notest -e ${{env.BASE}}
98- tox -e ${{env.BASE}} --skip-pkg-install
21+ check-docs :
22+ needs : change-detection
23+ if : fromJSON(needs.change-detection.outputs.run-docs)
24+ uses : ./.github/workflows/reusable-docs.yml
9925
100- - name : Run minimum version test
101- if : matrix.tox-target == 'min'
102- run : tox -e ${{env.BASE}}-${{ matrix.tox-target }}
103-
104- - name : Run path test
105- if : matrix.tox-target == 'tox' && matrix.py == '3.10'
106- run : tox -e path
107-
108- - name : Combine coverage files
109- if : always()
110- run : tox -e coverage
111-
112- - uses : codecov/codecov-action@v3
113- if : always()
114- env :
115- PYTHON : ${{ matrix.python }}
116- with :
117- file : ./.tox/coverage.xml
118- flags : tests
119- env_vars : PYTHON
120- name : ${{ matrix.py }} - ${{ matrix.os }}
26+ pytest :
27+ needs : change-detection
28+ if : fromJSON(needs.change-detection.outputs.run-tests)
29+ uses : ./.github/workflows/reusable-pytest.yml
12130
12231 type :
123- runs-on : ubuntu-latest
124- env :
125- PY_COLORS : 1
126- TOX_PARALLEL_NO_SPINNER : 1
127- steps :
128- - uses : actions/checkout@v3
129-
130- - name : Setup Python 3.9
131- uses : actions/setup-python@v4
132- with :
133- python-version : 3.9
134-
135- - name : Install tox
136- run : python -m pip install tox
137-
138- - name : Setup run environment
139- run : tox -vv --notest -e type
140-
141- - name : Run check for type
142- run : tox -e type --skip-pkg-install
32+ needs : change-detection
33+ if : fromJSON(needs.change-detection.outputs.run-tests)
34+ uses : ./.github/workflows/reusable-type.yml
14335
14436 # https://github.com/marketplace/actions/alls-green#why
14537 required-checks-pass : # This job does nothing and is only used for the branch protection
14638 if : always()
14739
14840 needs :
41+ - change-detection # transitive
42+ - check-docs
14943 - pytest
15044 - type
15145
@@ -155,4 +49,20 @@ jobs:
15549 - name : Decide whether the needed jobs succeeded or failed
15650 uses : re-actors/alls-green@release/v1
15751 with :
52+ allowed-skips : >-
53+ ${{
54+ fromJSON(needs.change-detection.outputs.run-docs)
55+ && ''
56+ || '
57+ check-docs,
58+ '
59+ }}
60+ ${{
61+ fromJSON(needs.change-detection.outputs.run-tests)
62+ && ''
63+ || '
64+ pytest,
65+ type,
66+ '
67+ }}
15868 jobs : ${{ toJSON(needs) }}
0 commit comments