|
| 1 | +--- |
1 | 2 | name: tox
|
| 3 | + |
2 | 4 | on:
|
3 |
| - create: # is used for publishing to PyPI and TestPyPI |
4 |
| - tags: # any tag regardless of its name, no branches |
5 |
| - - "**" |
6 |
| - push: # only publishes pushes to the main branch to TestPyPI |
7 |
| - branches: # any integration branch but not tag |
| 5 | + push: |
| 6 | + branches: |
8 | 7 | - "main"
|
| 8 | + - "releases/**" |
| 9 | + - "stable/**" |
9 | 10 | pull_request:
|
10 |
| - schedule: |
11 |
| - - cron: 1 0 * * * # Run daily at 0:01 UTC |
| 11 | + branches: |
| 12 | + - "main" |
12 | 13 | workflow_call:
|
13 | 14 |
|
14 |
| -jobs: |
15 |
| - prepare: |
16 |
| - name: prepare |
17 |
| - runs-on: ubuntu-22.04 |
18 |
| - outputs: |
19 |
| - matrix: ${{ steps.generate_matrix.outputs.matrix }} |
20 |
| - steps: |
21 |
| - - name: Determine matrix |
22 |
| - id: generate_matrix |
23 |
| - uses: coactions/dynamic-matrix@v4 |
24 |
| - with: |
25 |
| - min_python: "3.9" |
26 |
| - max_python: "3.13" |
27 |
| - default_python: "3.10" |
28 |
| - other_names: | |
29 |
| - lint |
30 |
| - docs |
31 |
| - pkg |
32 |
| - py39-ansible214 |
33 |
| - py39-ansible215 |
34 |
| - py310-ansible215 |
35 |
| - py310-ansible217 |
36 |
| - py311-ansible215 |
37 |
| - py312-ansible216 |
38 |
| - py312-ansible217 |
39 |
| - py312-devel |
40 |
| - py313-devel |
41 |
| - smoke |
42 |
| - platforms: linux,macos |
43 |
| - macos: minmax |
44 |
| - build: |
45 |
| - name: ${{ matrix.name }} |
46 |
| - |
47 |
| - runs-on: ${{ matrix.os || 'ubuntu-22.04' }} |
48 |
| - needs: prepare |
49 |
| - strategy: |
50 |
| - fail-fast: false |
51 |
| - matrix: ${{ fromJson(needs.prepare.outputs.matrix) }} |
52 |
| - env: |
53 |
| - FORCE_COLOR: 1 |
54 |
| - PYTEST_REQPASS: 109 |
55 |
| - steps: |
56 |
| - - uses: actions/checkout@v4 |
57 |
| - with: |
58 |
| - fetch-depth: 0 # needed by setuptools-scm |
59 |
| - submodules: true |
60 |
| - |
61 |
| - - name: Set up Python ${{ matrix.python_version }} |
62 |
| - uses: actions/setup-python@v5 |
63 |
| - with: |
64 |
| - python-version: ${{ matrix.python_version }} |
65 |
| - |
66 |
| - - name: Pre-commit cache |
67 |
| - uses: actions/cache@v4 |
68 |
| - with: |
69 |
| - path: ~/.cache/pre-commit |
70 |
| - key: ${{ matrix.name }}-pre-commit-${{ hashFiles('setup.cfg', 'tox.ini', 'pyproject.toml', '.pre-commit-config.yaml') }} |
71 |
| - |
72 |
| - - name: Pip cache |
73 |
| - uses: actions/cache@v4 |
74 |
| - with: |
75 |
| - path: ~/.cache/pip |
76 |
| - key: ${{ matrix.name }}-pip-${{ hashFiles('setup.cfg', 'tox.ini', 'pyproject.toml', '.pre-commit-config.yaml') }} |
77 |
| - |
78 |
| - - name: Install tox |
79 |
| - run: python3 -m pip install --upgrade 'tox>=4.0.3' |
80 |
| - |
81 |
| - - run: ${{ matrix.command }} |
82 |
| - |
83 |
| - - run: ${{ matrix.command2 }} |
84 |
| - if: ${{ matrix.command2 }} |
85 |
| - |
86 |
| - - run: ${{ matrix.command3 }} |
87 |
| - if: ${{ matrix.command3 }} |
88 |
| - |
89 |
| - - run: ${{ matrix.command4 }} |
90 |
| - if: ${{ matrix.command4 }} |
91 |
| - |
92 |
| - - run: ${{ matrix.command5 }} |
93 |
| - if: ${{ matrix.command5 }} |
94 |
| - |
95 |
| - - name: Archive logs |
96 |
| - uses: actions/upload-artifact@v4 |
97 |
| - with: |
98 |
| - name: logs-${{ matrix.name }}.zip |
99 |
| - include-hidden-files: true |
100 |
| - path: | |
101 |
| - .tox/**/log/ |
102 |
| - .tox/**/.coverage* |
103 |
| - .tox/**/coverage.xml |
| 15 | +concurrency: |
| 16 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} |
| 17 | + cancel-in-progress: true |
104 | 18 |
|
105 |
| - - name: Report failure if git reports dirty status |
106 |
| - run: | |
107 |
| - if [[ -n $(git status -s) ]]; then |
108 |
| - # shellcheck disable=SC2016 |
109 |
| - echo -n '::error file=git-status::' |
110 |
| - printf '### Failed as git reported modified and/or untracked files\n```\n%s\n```\n' "$(git status -s)" | tee -a "$GITHUB_STEP_SUMMARY" |
111 |
| - exit 99 |
112 |
| - fi |
113 |
| - # https://github.com/actions/toolkit/issues/193 |
114 |
| - |
115 |
| - check: |
116 |
| - if: always() |
117 |
| - permissions: |
118 |
| - id-token: write |
119 |
| - checks: read |
120 |
| - |
121 |
| - needs: |
122 |
| - - build |
123 |
| - runs-on: ubuntu-latest |
124 |
| - |
125 |
| - steps: |
126 |
| - # checkout needed for codecov action which needs codecov.yml file |
127 |
| - - uses: actions/checkout@v4 |
128 |
| - |
129 |
| - - name: Set up Python # likely needed for coverage |
130 |
| - uses: actions/setup-python@v5 |
131 |
| - with: |
132 |
| - python-version: "3.12" |
133 |
| - |
134 |
| - - run: pip3 install 'coverage>=7.5.1' |
135 |
| - |
136 |
| - - name: Merge logs into a single archive |
137 |
| - uses: actions/upload-artifact/merge@v4 |
138 |
| - with: |
139 |
| - name: logs.zip |
140 |
| - include-hidden-files: true |
141 |
| - pattern: logs-*.zip |
142 |
| - # artifacts like py312.zip and py312-macos do have overlapping files |
143 |
| - separate-directories: true |
144 |
| - |
145 |
| - - name: Download artifacts |
146 |
| - uses: actions/download-artifact@v4 |
147 |
| - with: |
148 |
| - name: logs.zip |
149 |
| - path: . |
150 |
| - |
151 |
| - - name: Check for expected number of coverage.xml reports |
152 |
| - run: | |
153 |
| - JOBS_PRODUCING_COVERAGE=16 |
154 |
| - if [ "$(find . -name coverage.xml | wc -l | bc)" -ne "${JOBS_PRODUCING_COVERAGE}" ]; then |
155 |
| - echo "::error::Number of coverage.xml files was not the expected one (${JOBS_PRODUCING_COVERAGE}): $(find . -name coverage.xml |xargs echo)" |
156 |
| - exit 1 |
157 |
| - fi |
158 |
| -
|
159 |
| - - name: Upload coverage data |
160 |
| - uses: codecov/codecov-action@v4 |
161 |
| - with: |
162 |
| - name: ${{ matrix.name }} |
163 |
| - # verbose: true # optional (default = false) |
164 |
| - fail_ci_if_error: true |
165 |
| - use_oidc: true # cspell:ignore oidc |
166 |
| - |
167 |
| - - name: Check codecov.io status |
168 |
| - if: github.event_name == 'pull_request' |
169 |
| - uses: coactions/codecov-status@main |
170 |
| - |
171 |
| - - name: Decide whether the needed jobs succeeded or failed |
172 |
| - uses: re-actors/alls-green@release/v1 |
173 |
| - with: |
174 |
| - jobs: ${{ toJSON(needs) }} |
175 |
| - |
176 |
| - - name: Delete Merged Artifacts |
177 |
| - uses: actions/upload-artifact/merge@v4 |
178 |
| - with: |
179 |
| - include-hidden-files: true |
180 |
| - delete-merged: true |
| 19 | +jobs: |
| 20 | + tox: |
| 21 | + uses: ansible/team-devtools/.github/workflows/tox.yml@main |
| 22 | + with: |
| 23 | + jobs_producing_coverage: 11 |
| 24 | + other_names: | |
| 25 | + docs |
| 26 | + lint |
| 27 | + pkg |
| 28 | + py39-ansible214 |
| 29 | + py39-ansible215 |
| 30 | + py310-ansible215 |
| 31 | + py310-ansible217 |
| 32 | + py311-ansible215 |
| 33 | + py312-ansible216 |
| 34 | + py312-ansible217 |
| 35 | + py312-devel |
| 36 | + py313-devel |
| 37 | + py310-macos:tox -e py310 |
| 38 | + py313-macos:tox -e py313 |
| 39 | + smoke |
| 40 | + skip_explode: "1" |
0 commit comments