Skip to content

Commit 483c5d9

Browse files
committed
Move tox run to custom action
Signed-off-by: Samuel Monson <[email protected]>
1 parent 1ced2ce commit 483c5d9

File tree

3 files changed

+47
-44
lines changed

3 files changed

+47
-44
lines changed

.github/actions/run-tox/action.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: 'Run tox with environment'
2+
description: 'Runs tox with pdm as the package manager'
3+
inputs:
4+
python-version:
5+
type: string
6+
required: true
7+
tox-env:
8+
type: string
9+
required: true
10+
tox-args:
11+
type: string
12+
required: false
13+
runs:
14+
using: "composite"
15+
steps:
16+
- name: Set up Python
17+
uses: actions/setup-python@v5
18+
with:
19+
python-version: ${{ inputs.python-version }}
20+
- name: Install dependencies
21+
run: |
22+
curl -sSL https://pdm-project.org/install-pdm.py | python3 -
23+
pip install tox tox-pdm
24+
shell: bash
25+
- name: Run tox
26+
run: |
27+
tox run -e "${{ inputs.tox-env }}" -- ${{ inputs.tox-args }}
28+
shell: bash

.github/workflows/quality.yml

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,43 +12,30 @@ jobs:
1212
runs-on: ubuntu-latest
1313
steps:
1414
- uses: actions/checkout@v4
15-
- name: Set up Python
16-
uses: actions/setup-python@v5
15+
- name: Run quality checks
16+
uses: ./.github/actions/run-tox
1717
with:
1818
python-version: ${{ inputs.python }}
19-
- name: Install dependencies
20-
run: |
21-
curl -sSL https://pdm-project.org/install-pdm.py | python3 -
22-
pip install tox tox-pdm
23-
- name: Run quality checks
24-
run: tox -e quality
19+
tox-env: quality
2520

2621
type-checks:
2722
runs-on: ubuntu-latest
2823
steps:
2924
- uses: actions/checkout@v4
30-
- name: Set up Python
31-
uses: actions/setup-python@v5
25+
- name: Run type checks
26+
uses: ./.github/actions/run-tox
3227
with:
3328
python-version: ${{ inputs.python }}
34-
- name: Install dependencies
35-
run: |
36-
curl -sSL https://pdm-project.org/install-pdm.py | python3 -
37-
pip install tox tox-pdm
38-
- name: Run quality checks
39-
run: tox -e types
29+
tox-env: types
4030

4131
precommit-checks:
4232
runs-on: ubuntu-latest
43-
strategy:
44-
matrix:
45-
python: ["3.10"]
4633
steps:
4734
- uses: actions/checkout@v4
4835
- name: Set up Python
4936
uses: actions/setup-python@v5
5037
with:
51-
python-version: ${{ matrix.python }}
38+
python-version: ${{ inputs.python }}
5239
- name: Install dependencies
5340
run: pip install pre-commit
5441
- name: Run pre-commit checks

.github/workflows/testing.yml

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -15,31 +15,23 @@ jobs:
1515
runs-on: ubuntu-latest
1616
steps:
1717
- uses: actions/checkout@v4
18-
- name: Set up Python
19-
uses: actions/setup-python@v5
18+
- name: Run unit tests
19+
uses: ./.github/actions/run-tox
2020
with:
2121
python-version: ${{ inputs.python }}
22-
- name: Install dependencies
23-
run: |
24-
curl -sSL https://pdm-project.org/install-pdm.py | python3 -
25-
pip install tox tox-pdm
26-
- name: Run unit tests
27-
run: tox -e test-unit -- ${{ inputs.args }}
22+
tox-env: test-unit
23+
tox-args: ${{ inputs.args }}
2824

2925
integration-tests:
3026
runs-on: ubuntu-latest
3127
steps:
3228
- uses: actions/checkout@v4
33-
- name: Set up Python
34-
uses: actions/setup-python@v5
29+
- name: Run integration tests
30+
uses: ./.github/actions/run-tox
3531
with:
3632
python-version: ${{ inputs.python }}
37-
- name: Install dependencies
38-
run: |
39-
curl -sSL https://pdm-project.org/install-pdm.py | python3 -
40-
pip install tox tox-pdm
41-
- name: Run integration tests
42-
run: tox -e test-integration -- ${{ inputs.args }}
33+
tox-env: test-integration
34+
tox-args: ${{ inputs.args }}
4335

4436
e2e-tests:
4537
runs-on: ubuntu-latest
@@ -77,13 +69,9 @@ jobs:
7769
exit 1
7870
fi
7971
shell: bash
80-
- name: Set up Python
81-
uses: actions/setup-python@v5
72+
- name: Run end-to-end tests
73+
uses: ./.github/actions/run-tox
8274
with:
8375
python-version: ${{ inputs.python }}
84-
- name: Install dependencies
85-
run: |
86-
curl -sSL https://pdm-project.org/install-pdm.py | python3 -
87-
pip install tox tox-pdm
88-
- name: Run end-to-end tests
89-
run: tox -e test-e2e -- ${{ inputs.args }}
76+
tox-env: test-e2e
77+
tox-args: ${{ inputs.args }}

0 commit comments

Comments
 (0)