Skip to content

Commit 23d85a0

Browse files
feat(ci): add separate lint workflow
1 parent 29c1ab2 commit 23d85a0

File tree

2 files changed

+47
-6
lines changed

2 files changed

+47
-6
lines changed

.github/workflows/lint.yml

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Lint
2+
3+
on:
4+
push:
5+
workflow_call:
6+
inputs:
7+
working-directory:
8+
type: string
9+
required: false
10+
default: '.'
11+
12+
jobs:
13+
pre-commit:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
19+
- name: Set up Python
20+
id: setup-python
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: '3.12'
24+
cache: 'pip'
25+
26+
- uses: actions/cache@v4
27+
with:
28+
path: ~/.cache/pre-commit
29+
key: >
30+
${{ format('pre-commit-{0}-{1}',
31+
steps.setup-python.outputs.python-version,
32+
hashFiles('.pre-commit-config.yaml')
33+
) }}
34+
35+
- name: Install pre-commit
36+
run: |
37+
pip install --upgrade pip
38+
pip install pre-commit
39+
pre-commit install
40+
41+
- name: Run pre-commit hooks
42+
working-directory: ${{ inputs.working-directory }}
43+
run: |
44+
git ls-files | xargs pre-commit run \
45+
--show-diff-on-failure \
46+
--color=always \
47+
--files

.github/workflows/unit-test.yml

-6
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,6 @@ jobs:
3434
python -m pip install --upgrade pip
3535
pip install -r requirements.txt
3636
37-
- name: Run pre-commit hooks
38-
run: |
39-
pip install -r requirements-dev.txt
40-
pre-commit install
41-
pre-commit run --all-files
42-
4337
- name: Run unit tests with pytest
4438
env:
4539
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)