Skip to content

Commit 2ebba16

Browse files
dreamiurgclaude
andauthored
ci: optimize GitHub Actions performance (#30)
Implements multiple optimizations to reduce CI time and resource usage: - Split linting into dedicated job (runs once instead of 5x per matrix) - Add Python package caching to all workflows - Add concurrency groups to cancel outdated PR runs - Remove redundant test job from release workflow (CI already tests) - Add path filters to skip CI for docs-only changes on main Expected improvements: - ~80% faster linting (1 job vs 5 jobs) - ~50% faster releases (no redundant testing) - Faster dependency installation (Python caching) - Reduced CI queue times (concurrency cancellation) - No wasted runs for documentation updates 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude <noreply@anthropic.com>
1 parent 97ccf10 commit 2ebba16

File tree

2 files changed

+51
-34
lines changed

2 files changed

+51
-34
lines changed

.github/workflows/ci.yml

Lines changed: 48 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,56 @@ name: CI
33
on:
44
push:
55
branches: [main]
6+
# Skip CI for docs-only changes on push to main
7+
paths-ignore:
8+
- '**.md'
9+
- 'docs/**'
10+
- 'examples/**'
11+
- '.github/**'
12+
- '!.github/workflows/**'
613
pull_request:
714
branches: [main]
15+
# Always run on PRs (for review), but individual jobs can skip if needed
16+
17+
# Cancel in-progress runs when a new workflow with the same group name starts
18+
concurrency:
19+
group: ${{ github.workflow }}-${{ github.ref }}
20+
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
821

922
jobs:
23+
# Separate lint job - runs once instead of on every matrix combination
24+
lint:
25+
name: Lint and format check
26+
runs-on: ubuntu-latest
27+
steps:
28+
- uses: actions/checkout@v4
29+
30+
- name: Set up Python
31+
uses: actions/setup-python@v6
32+
with:
33+
python-version: "3.14"
34+
cache: pip
35+
cache-dependency-path: pyproject.toml
36+
37+
- name: Install uv
38+
uses: astral-sh/setup-uv@v5
39+
with:
40+
enable-cache: true
41+
cache-dependency-glob: "pyproject.toml"
42+
43+
- name: Install dependencies
44+
run: uv sync --extra dev
45+
46+
- name: Run ruff check
47+
run: uv run ruff check peakbagger tests
48+
49+
- name: Run ruff format check
50+
run: uv run ruff format --check peakbagger tests
51+
52+
- name: Run mypy
53+
run: uv run mypy peakbagger --pretty
54+
continue-on-error: true
55+
1056
test:
1157
name: Test on ${{ matrix.os }} - Python ${{ matrix.python-version }}
1258
runs-on: ${{ matrix.os }}
@@ -30,6 +76,8 @@ jobs:
3076
uses: actions/setup-python@v6
3177
with:
3278
python-version: ${{ matrix.python-version }}
79+
cache: pip
80+
cache-dependency-path: pyproject.toml
3381

3482
- name: Install uv
3583
uses: astral-sh/setup-uv@v5
@@ -40,16 +88,6 @@ jobs:
4088
- name: Install dependencies
4189
run: uv sync --extra dev
4290

43-
- name: Run ruff check
44-
run: uv run ruff check peakbagger tests
45-
46-
- name: Run ruff format check
47-
run: uv run ruff format --check peakbagger tests
48-
49-
- name: Run mypy
50-
run: uv run mypy peakbagger --pretty
51-
continue-on-error: true
52-
5391
- name: Run tests with coverage
5492
run: uv run pytest --cov=peakbagger --cov-report=xml --cov-report=term
5593

.github/workflows/release.yml

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,32 +9,9 @@ permissions:
99
contents: write # Required for semantic-release to create releases and push commits
1010

1111
jobs:
12-
test:
13-
runs-on: ubuntu-latest
14-
steps:
15-
- name: Checkout
16-
uses: actions/checkout@v4
17-
18-
- name: Set up Python
19-
uses: actions/setup-python@v6
20-
with:
21-
python-version: '3.12'
22-
23-
- name: Install uv
24-
uses: astral-sh/setup-uv@v5
25-
with:
26-
enable-cache: true
27-
cache-dependency-glob: "pyproject.toml"
28-
29-
- name: Install dependencies
30-
run: uv sync
31-
32-
- name: Run tests
33-
run: uv run pytest -v
34-
12+
# Skip test job - CI workflow already runs comprehensive tests on push to main
3513
release:
3614
runs-on: ubuntu-latest
37-
needs: test
3815
steps:
3916
- name: Checkout
4017
uses: actions/checkout@v4
@@ -46,6 +23,8 @@ jobs:
4623
uses: actions/setup-python@v6
4724
with:
4825
python-version: '3.12'
26+
cache: pip
27+
cache-dependency-path: pyproject.toml
4928

5029
- name: Install uv
5130
uses: astral-sh/setup-uv@v5

0 commit comments

Comments
 (0)