Skip to content

Commit 4ed13b0

Browse files
committed
ci: consolidate workflows and add caching
- Merge pr-check.yml and docs-quality.yml into test.yml (now CI.yml) - Add actions/cache@v4 for PDM packages (~15s → ~2s per job) - Remove redundant workflow files - All PR checks now run in parallel (test, lint, commitlint, docs) Cost reduction: - PR: 3 workflows → 1 workflow - Each job: cache hit skips dependency download
1 parent ce33f53 commit 4ed13b0

File tree

4 files changed

+63
-69
lines changed

4 files changed

+63
-69
lines changed

.github/workflows/cd.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@ jobs:
3737
with:
3838
python-version: '3.12'
3939

40+
- name: Cache PDM packages
41+
uses: actions/cache@v4
42+
with:
43+
path: ~/.cache/pdm
44+
key: ${{ runner.os }}-pdm-${{ hashFiles('pdm.lock') }}
45+
restore-keys: |
46+
${{ runner.os }}-pdm-
47+
4048
- run: pdm install --with dev
4149

4250
- run: pdm run pytest -v

.github/workflows/docs-quality.yml

Lines changed: 0 additions & 39 deletions
This file was deleted.

.github/workflows/pr-check.yml

Lines changed: 0 additions & 27 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 55 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
# .github/workflows/test.yml
22
#
3-
# Test and lint on pull requests
4-
# Parallel jobs for faster feedback
3+
# CI for pull requests
4+
# Runs test, lint, commit message, and docs checks in parallel
55
#
66

7-
name: Test
7+
name: CI
88

99
on:
1010
pull_request:
1111
branches: [main]
1212

1313
permissions:
1414
contents: read
15+
pull-requests: read
1516

1617
jobs:
1718
test:
@@ -21,9 +22,19 @@ jobs:
2122
cancel-in-progress: true
2223
steps:
2324
- uses: actions/checkout@v4
25+
2426
- uses: pdm-project/setup-pdm@v4
2527
with:
2628
python-version: '3.12'
29+
30+
- name: Cache PDM packages
31+
uses: actions/cache@v4
32+
with:
33+
path: ~/.cache/pdm
34+
key: ${{ runner.os }}-pdm-${{ hashFiles('pdm.lock') }}
35+
restore-keys: |
36+
${{ runner.os }}-pdm-
37+
2738
- run: pdm install --with dev
2839
- run: pdm run pytest -v
2940

@@ -34,10 +45,51 @@ jobs:
3445
cancel-in-progress: true
3546
steps:
3647
- uses: actions/checkout@v4
48+
3749
- uses: pdm-project/setup-pdm@v4
3850
with:
3951
python-version: '3.12'
52+
53+
- name: Cache PDM packages
54+
uses: actions/cache@v4
55+
with:
56+
path: ~/.cache/pdm
57+
key: ${{ runner.os }}-pdm-${{ hashFiles('pdm.lock') }}
58+
restore-keys: |
59+
${{ runner.os }}-pdm-
60+
4061
- run: pdm install --with dev
4162
- run: pdm run black --check src/ tests/
4263
- run: pdm run isort --check-only src/ tests/
4364
- run: pdm run flake8 --max-line-length=100 --ignore=E501,W503,F401,F841 src/ tests/
65+
66+
commitlint:
67+
runs-on: ubuntu-latest
68+
if: github.event_name == 'pull_request'
69+
concurrency:
70+
group: ${{ github.workflow }}-${{ github.ref }}-commitlint
71+
cancel-in-progress: true
72+
steps:
73+
- uses: actions/checkout@v4
74+
with:
75+
fetch-depth: 0
76+
- uses: wagoid/commitlint-github-action@v6
77+
with:
78+
configFile: .commitlintrc.json
79+
80+
docs:
81+
runs-on: ubuntu-latest
82+
if: github.event_name == 'pull_request'
83+
concurrency:
84+
group: ${{ github.workflow }}-${{ github.ref }}-docs
85+
cancel-in-progress: true
86+
steps:
87+
- uses: actions/checkout@v4
88+
89+
- uses: actions/setup-python@v5
90+
with:
91+
python-version: '3.12'
92+
93+
- name: Run documentation quality checker
94+
run: |
95+
python scripts/check-docs-quality.py .

0 commit comments

Comments
 (0)