Skip to content

Commit 7f4c752

Browse files
committed
make nox-session reusable workflow
1 parent 7bebc4d commit 7f4c752

File tree

2 files changed

+59
-68
lines changed

2 files changed

+59
-68
lines changed

.github/workflows/.nox-session.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Nox Session
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
session-name:
7+
required: true
8+
type: string
9+
session-arguments:
10+
required: false
11+
type: string
12+
runs-on-array:
13+
required: false
14+
type: string
15+
default: '["ubuntu-latest"]'
16+
python-version-array:
17+
required: false
18+
type: string
19+
default: '["3.x"]'
20+
21+
jobs:
22+
nox-session:
23+
strategy:
24+
matrix:
25+
runs-on: ${{fromJson(inputs.runs-on-array)}}
26+
python-version: ${{fromJson(inputs.python-version-array)}}
27+
runs-on: ${{ matrix.runs-on }}
28+
steps:
29+
- uses: actions/checkout@v2
30+
- uses: actions/setup-node@v2
31+
with:
32+
node-version: "14.x"
33+
- name: Install Specific NPM Version
34+
run: npm install -g npm@8.3
35+
- name: Use Python ${{ matrix.python-version }}
36+
uses: actions/setup-python@v2
37+
with:
38+
python-version: ${{ matrix.python-version }}
39+
- name: Install Python Dependencies
40+
run: pip install -r requirements/nox-deps.txt
41+
- name: Run Tests
42+
env: { "CI": "true" }
43+
run: nox -s ${{ inputs.session-name }} --stop-on-first-error -- ${{ inputs.session-arguments }}

.github/workflows/test.yml

Lines changed: 16 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -12,74 +12,22 @@ on:
1212

1313
jobs:
1414
test-python-coverage:
15-
runs-on: ubuntu-latest
16-
steps:
17-
- uses: actions/checkout@v2
18-
- uses: actions/setup-node@v2
19-
with:
20-
node-version: "14.x"
21-
- name: Install Specific NPM Version
22-
run: npm install -g npm@8.3
23-
- name: Use Latest Python
24-
uses: actions/setup-python@v2
25-
with:
26-
python-version: "3.9"
27-
- name: Install Python Dependencies
28-
run: pip install -r requirements/nox-deps.txt
29-
- name: Run Tests
30-
env: { "CI": "true" }
31-
run: nox -s test_python_suite -- --maxfail=3
15+
uses: ./.github/workflows/.nox-session.yml
16+
with:
17+
session-name: test_python_suite
18+
session-arguments: --maxfail=3
3219
test-python-environments:
33-
runs-on: ${{ matrix.os }}
34-
strategy:
35-
matrix:
36-
python-version: ["3.7", "3.8", "3.9", "3.10"]
37-
os: [ubuntu-latest, macos-latest, windows-latest]
38-
steps:
39-
- uses: actions/checkout@v2
40-
- uses: actions/setup-node@v2
41-
with:
42-
node-version: "14.x"
43-
- name: Install Specific NPM Version
44-
run: npm install -g npm@8.3
45-
- name: Use Python ${{ matrix.python-version }}
46-
uses: actions/setup-python@v2
47-
with:
48-
python-version: ${{ matrix.python-version }}
49-
- name: Install Python Dependencies
50-
run: pip install -r requirements/nox-deps.txt
51-
- name: Run Tests
52-
env: { "CI": "true" }
53-
run: nox -s test_python --stop-on-first-error -- --maxfail=3 --no-cov
20+
uses: ./.github/workflows/.nox-session.yml
21+
with:
22+
session-name: test_python_suite
23+
session-arguments: --maxfail=3 --no-cov
24+
runs-on-array: '["ubuntu-latest", "macos-latest", "windows-latest"]'
25+
python-version-array: '["3.7", "3.8", "3.9", "3.10"]'
5426
test-docs:
55-
runs-on: ubuntu-latest
56-
steps:
57-
- uses: actions/checkout@v2
58-
- uses: actions/setup-node@v2
59-
with:
60-
node-version: "14.x"
61-
- name: Install Specific NPM Version
62-
run: npm install -g npm@8.3
63-
- name: Use Latest Python
64-
uses: actions/setup-python@v2
65-
with:
66-
python-version: "3.9"
67-
- name: Install Python Dependencies
68-
run: pip install -r requirements/nox-deps.txt
69-
- name: Run Tests
70-
env: { "CI": "true" }
71-
run: nox -s test_docs
27+
uses: ./.github/workflows/.nox-session.yml
28+
with:
29+
session-name: test_docs
7230
test-javascript:
73-
runs-on: ubuntu-latest
74-
steps:
75-
- uses: actions/checkout@v2
76-
- uses: actions/setup-node@v2
77-
with:
78-
node-version: "14.x"
79-
- name: Install Specific NPM Version
80-
run: npm install -g npm@8.3
81-
- name: Install Python Dependencies
82-
run: pip install -r requirements/nox-deps.txt
83-
- name: Run Tests
84-
env: { "CI": "true" }
85-
run: nox -s test_javascript
31+
uses: ./.github/workflows/.nox-session.yml
32+
with:
33+
session-name: test_javascript

0 commit comments

Comments
 (0)