Skip to content

Commit 3b807a4

Browse files
authored
Use matrix, set up environments separately from running tests. (#44)
1 parent b697167 commit 3b807a4

File tree

1 file changed

+44
-40
lines changed

1 file changed

+44
-40
lines changed

.github/workflows/nox.yml

Lines changed: 44 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -19,47 +19,63 @@ env:
1919
FORCE_COLOR: "1"
2020

2121
jobs:
22-
nox-lint:
23-
runs-on: ubuntu-latest
24-
defaults:
25-
run:
26-
working-directory: antsibull-docs-parser
27-
steps:
28-
- name: Check out antsibull-docs-parser
29-
uses: actions/checkout@v4
30-
with:
31-
path: antsibull-docs-parser
32-
- name: Setup nox
33-
uses: wntrblm/[email protected]
34-
with:
35-
python-versions: "3.11"
36-
- run: |
37-
nox -v -e lint
38-
nox-test:
22+
nox:
3923
runs-on: ubuntu-latest
4024
defaults:
4125
run:
4226
working-directory: antsibull-docs-parser
27+
strategy:
28+
fail-fast: false
29+
matrix:
30+
include:
31+
- session: test
32+
python-versions: "3.7, 3.8, 3.9, 3.10, 3.11, 3.12"
33+
other-args: "-p 3.7 3.8 3.9 3.10 3.11 3.12"
34+
codecov: true
35+
packages: ""
36+
37+
- session: lint
38+
python-versions: "3.12"
39+
other-args: ""
40+
codecov: false
41+
packages: ""
42+
43+
- session: create_vectors
44+
python-versions: "3.12"
45+
other-args: ""
46+
codecov: false
47+
packages: ""
48+
name: "Run nox ${{ matrix.session }} session"
4349
steps:
4450
- name: Check out antsibull-docs-parser
4551
uses: actions/checkout@v4
4652
with:
4753
path: antsibull-docs-parser
54+
- name: Install extra packages
55+
if: "matrix.packages != ''"
56+
run: |
57+
sudo apt-get install -y ${{ matrix.packages }}
4858
- name: Setup nox
4959
uses: wntrblm/[email protected]
5060
with:
51-
python-versions: "3.7, 3.8, 3.9, 3.10, 3.11"
52-
- name: Run unit tests
61+
python-versions: "${{ matrix.python-versions }}"
62+
- name: Set up nox environments
63+
run: |
64+
nox -v -e "${{ matrix.session }}" ${{ matrix.other-args }} --install-only
65+
${{ matrix.codecov && 'nox -v -e coverage --install-only' || '' }}
66+
- name: "Run nox -e ${{ matrix.session }} ${{ matrix.other-args }}"
5367
run: |
54-
nox -v -e test -p 3.7 3.8 3.9 3.10 3.11
68+
nox -v -e "${{ matrix.session }}" ${{ matrix.other-args }} --reuse-existing-virtualenvs --no-install
5569
- name: Report coverage
70+
if: ${{ matrix.codecov }}
5671
run: |
57-
nox -v -e coverage
72+
nox -v -e coverage --reuse-existing-virtualenvs --no-install
5873
- name: Upload coverage
74+
if: ${{ matrix.codecov }}
5975
uses: codecov/codecov-action@v3
6076
with:
61-
name: nox-test
6277
directory: antsibull-docs-parser
78+
name: "${{ matrix.session }}"
6379
env:
6480
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
6581
nox-test-36:
@@ -82,32 +98,20 @@ jobs:
8298
- name: Setup nox - downgrade virtualenv
8399
run: |
84100
pipx inject nox 'virtualenv<20.22.0'
101+
- name: Set up nox environments
102+
run: |
103+
nox -v -e test -p 3.6 --install-only
104+
nox -v -e coverage --install-only
85105
- name: Run unit tests
86106
run: |
87-
nox -v -e test -p 3.6
107+
nox -v -e test -p 3.6 --reuse-existing-virtualenvs --no-install
88108
- name: Report coverage
89109
run: |
90-
nox -v -e coverage
110+
nox -v -e coverage --reuse-existing-virtualenvs --no-install
91111
- name: Upload coverage
92112
uses: codecov/codecov-action@v3
93113
with:
94114
name: nox-test-36
95115
directory: antsibull-docs-parser
96116
env:
97117
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
98-
nox-vectors:
99-
runs-on: ubuntu-latest
100-
defaults:
101-
run:
102-
working-directory: antsibull-docs-parser
103-
steps:
104-
- name: Check out antsibull-docs-parser
105-
uses: actions/checkout@v4
106-
with:
107-
path: antsibull-docs-parser
108-
- name: Setup nox
109-
uses: wntrblm/[email protected]
110-
with:
111-
python-versions: "3.11"
112-
- run: |
113-
nox -v -e create_vectors

0 commit comments

Comments
 (0)