Skip to content

Commit 1d80bba

Browse files
committed
ci: use hatch in test.yml, split pre-commit check from test.yml
Refs: KEH-282
1 parent c21d328 commit 1d80bba

2 files changed

Lines changed: 34 additions & 40 deletions

File tree

.github/workflows/pre-commit.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Run pre-commit hooks
2+
3+
env:
4+
DEFAULT_PYTHON: "3.10"
5+
6+
on:
7+
push:
8+
branches: [ main ]
9+
pull_request:
10+
branches: [ main ]
11+
12+
jobs:
13+
pre-commit:
14+
name: Run pre-commit hooks
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
20+
21+
- name: Setup Python ${{ env.DEFAULT_PYTHON }}
22+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
23+
with:
24+
python-version: ${{ env.DEFAULT_PYTHON }}
25+
26+
- name: Run pre-commit
27+
uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1

.github/workflows/test.yml

Lines changed: 7 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -7,56 +7,23 @@ on:
77
branches: [ main ]
88

99
jobs:
10-
commitlint:
11-
name: Check commit messages
12-
runs-on: ubuntu-latest
13-
steps:
14-
- name: Checkout
15-
uses: actions/checkout@v4
16-
- name: Run commitlint
17-
uses: wagoid/commitlint-github-action@3d28780bbf0365e29b144e272b2121204d5be5f3 # v6.1.2
18-
19-
pre-commit:
20-
name: Run pre-commit hooks
21-
runs-on: ubuntu-latest
22-
steps:
23-
- name: Checkout
24-
uses: actions/checkout@v4
25-
- name: Setup Python 3.10
26-
uses: actions/setup-python@v5
27-
with:
28-
python-version: '3.10'
29-
- name: Run pre-commit
30-
uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
31-
3210
test:
3311
name: Python ${{ matrix.python_version }}
3412
runs-on: ubuntu-latest
35-
env:
36-
TOX_POSARGS: -- --cov=. --cov-report=xml
3713
strategy:
3814
matrix:
39-
python_version: ['3.10', '3.11', '3.12', '3.13', '3.14']
15+
python_version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
4016

4117
steps:
42-
- uses: actions/checkout@v4
18+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
4319

4420
- name: Set up Python ${{ matrix.python_version }}
45-
uses: actions/setup-python@v5
21+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
4622
with:
4723
python-version: ${{ matrix.python_version }}
48-
cache: 'pip'
49-
cache-dependency-path: 'requirements-test.txt'
50-
51-
- name: Upgrade packaging tools
52-
run: python -m pip install --upgrade pip setuptools wheel
53-
54-
- name: Install dependencies
55-
run: python -m pip install --upgrade codecov tox
5624

57-
- name: Run tox targets for Python ${{ matrix.python_version }}
58-
run: tox run -f py$(echo ${{ matrix.python_version }} | tr -d .) ${{ env.TOX_POSARGS }}
25+
- name: Install hatch
26+
run: python -m pip install hatch
5927

60-
- name: Upload Coverage to Codecov
61-
if: ${{ matrix.python_version == '3.10' }}
62-
uses: codecov/codecov-action@v3
28+
- name: Tests
29+
run: hatch test -i py=${{ matrix.python_version }}

0 commit comments

Comments
 (0)