Skip to content

Commit 642776b

Browse files
committed
only run GitHub actions tests when Python files have changed
1 parent 64890ad commit 642776b

File tree

2 files changed

+49
-37
lines changed

2 files changed

+49
-37
lines changed

.github/workflows/linters.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Linters
2+
3+
on:
4+
pull_request:
5+
workflow_dispatch:
6+
7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.ref }}
9+
cancel-in-progress: true
10+
11+
jobs:
12+
lint:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
- uses: actions/setup-python@v5
17+
with:
18+
python-version: '3.10'
19+
cache: 'pip'
20+
cache-dependency-path: 'pyproject.toml'
21+
- name: Install Python dependencies
22+
run: |
23+
python -m pip install -U pip pre-commit
24+
- name: Run linters
25+
run: |
26+
pre-commit run --hook-stage=manual --all-files
27+
docs:
28+
name: Docs Checks
29+
runs-on: ubuntu-latest
30+
steps:
31+
- uses: actions/checkout@v4
32+
- uses: actions/setup-python@v5
33+
with:
34+
cache: 'pip'
35+
cache-dependency-path: 'pyproject.toml'
36+
python-version: '3.10'
37+
- name: Install dependencies
38+
run: |
39+
pip install -U pip
40+
pip install -e ".[docs]"
41+
- name: Build docs
42+
run: |
43+
cd docs
44+
make html

.github/workflows/test-python.yml

Lines changed: 5 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,21 @@ name: Python Tests
22

33
on:
44
pull_request:
5+
paths:
6+
- '**.py'
7+
- '!setup.py'
8+
- '.github/workflows/tests.yml'
59
workflow_dispatch:
610

711
concurrency:
8-
group: tests-${{ github.ref }}
12+
group: ${{ github.workflow }}-${{ github.ref }}
913
cancel-in-progress: true
1014

1115
defaults:
1216
run:
1317
shell: bash -eux {0}
1418

1519
jobs:
16-
17-
lint:
18-
runs-on: ubuntu-latest
19-
steps:
20-
- uses: actions/checkout@v4
21-
- uses: actions/setup-python@v5
22-
with:
23-
python-version: '3.10'
24-
cache: 'pip'
25-
cache-dependency-path: 'pyproject.toml'
26-
- name: Install Python dependencies
27-
run: |
28-
python -m pip install -U pip pre-commit
29-
- name: Run linters
30-
run: |
31-
pre-commit run --hook-stage=manual --all-files
32-
3320
build:
3421
name: Django Test Suite
3522
runs-on: ubuntu-latest
@@ -121,22 +108,3 @@ jobs:
121108
timezones
122109
update
123110
xor_lookups
124-
125-
docs:
126-
name: Docs Checks
127-
runs-on: ubuntu-latest
128-
steps:
129-
- uses: actions/checkout@v4
130-
- uses: actions/setup-python@v5
131-
with:
132-
cache: 'pip'
133-
cache-dependency-path: 'pyproject.toml'
134-
python-version: '3.10'
135-
- name: Install dependencies
136-
run: |
137-
pip install -U pip
138-
pip install -e ".[docs]"
139-
- name: Build docs
140-
run: |
141-
cd docs
142-
make html

0 commit comments

Comments
 (0)