Skip to content

Commit 1c10d25

Browse files
authored
Revert "Add optional run_pre and run_post commands to tox workflow (#224)" (#225)
This reverts commit 93ac79f.
1 parent 93ac79f commit 1c10d25

File tree

2 files changed

+57
-33
lines changed

2 files changed

+57
-33
lines changed

.github/workflows/test.yml

Lines changed: 52 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,60 @@
11
---
2-
name: tox
2+
name: test
33
on:
44
pull_request:
55
jobs:
6+
pre:
7+
name: pre
8+
runs-on: ubuntu-24.04
9+
outputs:
10+
matrix: ${{ steps.generate_matrix.outputs.matrix }}
11+
steps:
12+
- name: Determine matrix
13+
id: generate_matrix
14+
uses: coactions/dynamic-matrix@v3
15+
with:
16+
min_python: "3.12"
17+
max_python: "3.12"
18+
default_python: "3.12"
19+
other_names: |
20+
lint
21+
docs
622
test:
7-
# tests reusable tox workflow
8-
uses: ./.github/workflows/tox.yml
9-
with:
10-
default_python: "3.10"
11-
jobs_producing_coverage: 0
12-
max_python: "3.13"
13-
min_python: "3.10"
14-
run_post: echo 'Running post'
15-
run_pre: echo 'Running pre'
23+
needs: pre
24+
name: ${{ matrix.name || matrix.tox_env }}
25+
runs-on: ${{ matrix.runs-on || 'ubuntu-latest' }}
26+
strategy:
27+
fail-fast: true
28+
matrix: ${{ fromJson(needs.pre.outputs.matrix) }}
29+
steps:
30+
- name: Check out src from Git
31+
uses: actions/checkout@v4
32+
with:
33+
fetch-depth: 0 # needed by setuptools-scm
34+
submodules: recursive
35+
36+
- name: Install a default Python
37+
uses: actions/setup-python@v5
38+
with:
39+
python-version: ${{ matrix.python_version }}
40+
41+
- name: Install dependencies
42+
run: |
43+
python3 -m pip install 'tox>=4.0.0'
44+
45+
- run: ${{ matrix.command }}
46+
47+
- run: ${{ matrix.command2 }}
48+
if: ${{ matrix.command2 }}
49+
50+
- run: ${{ matrix.command3 }}
51+
if: ${{ matrix.command3 }}
52+
53+
- run: ${{ matrix.command4 }}
54+
if: ${{ matrix.command4 }}
55+
56+
- run: ${{ matrix.command5 }}
57+
if: ${{ matrix.command5 }}
1658

1759
check: # This job does nothing and is only used for the branch protection
1860
if: always()

.github/workflows/tox.yml

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,6 @@ on:
2929
description: Additional names for the matrix
3030
required: false
3131
type: string
32-
run_pre:
33-
default: ""
34-
description: Preparatory command to run before test commands.
35-
required: false
36-
type: string
37-
run_post:
38-
default: ""
39-
description: Command to run after test commands.
40-
required: false
41-
type: string
4232

4333
env:
4434
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # might be needed by tox commands
@@ -59,10 +49,11 @@ jobs:
5949
min_python: ${{ inputs.min_python }}
6050
max_python: ${{ inputs.max_python }}
6151
default_python: ${{ inputs.default_python }}
62-
# we must use tox to query these
6352
other_names: |
6453
docs
6554
lint
55+
pkg
56+
py312-milestone
6657
${{ inputs.other_names_also }}
6758
platforms: linux,macos
6859

@@ -95,16 +86,12 @@ jobs:
9586
key: pre-commit-${{ matrix.name }}-${{ hashFiles('.pre-commit-config.yaml') }}
9687

9788
- name: Set up Python ${{ matrix.python_version || '3.12' }}
98-
if: ${{ !contains(matrix.shell, 'wsl') }}
89+
if: "!contains(matrix.shell, 'wsl')"
9990
uses: actions/setup-python@v5
10091
with:
101-
cache: ${{ hashFiles('requirements.txt', 'pyproject.toml') && 'pip' || '' }}
92+
cache: pip
10293
python-version: ${{ matrix.python_version || '3.12' }}
10394

104-
- name: Run pre
105-
if: ${{ inputs.run_pre }}
106-
run: ${{ inputs.run_pre }}
107-
10895
- name: Install tox
10996
run: |
11097
python3 -m pip install --upgrade pip
@@ -127,10 +114,6 @@ jobs:
127114
- run: ${{ matrix.command5 }}
128115
if: ${{ matrix.command5 }}
129116

130-
- name: Run post
131-
if: ${{ inputs.run_post }}
132-
run: ${{ inputs.run_post }}
133-
134117
- name: Archive logs and coverage data
135118
uses: actions/upload-artifact@v4
136119
with:
@@ -193,15 +176,14 @@ jobs:
193176
fi
194177
195178
- name: Upload coverage data
196-
if: ${{ inputs.jobs_producing_coverage }}
197179
uses: codecov/codecov-action@v4
198180
with:
199181
name: ${{ matrix.name }}
200182
fail_ci_if_error: true
201183
use_oidc: true
202184

203185
- name: Check codecov.io status
204-
if: github.event_name == 'pull_request' && inputs.jobs_producing_coverage
186+
if: github.event_name == 'pull_request'
205187
uses: coactions/codecov-status@main
206188

207189
- name: Decide whether the needed jobs succeeded or failed

0 commit comments

Comments
 (0)