Skip to content

Commit a39f587

Browse files
committed
fix: deduplicate CI test run for Python 3.12, add Makefile lefthook/ci-deps recipes
- Fix ci.yml: Python 3.12 no longer runs pytest twice (plain + coverage) - Add `make ci-deps` to check/install uv, lefthook, actionlint - Add `make lefthook-install` to activate pre-commit hooks - Add `make lefthook-run` to manually run all pre-commit checks - Add PROJECTS.md for project tracking
1 parent b9d0169 commit a39f587

File tree

3 files changed

+67
-2
lines changed

3 files changed

+67
-2
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,12 @@ jobs:
2828
run: uv sync --group dev
2929

3030
- name: Run tests
31+
if: matrix.python-version != '3.12'
3132
run: uv run pytest tests/ -v --tb=short
3233

3334
- name: Run tests with coverage
3435
if: matrix.python-version == '3.12'
35-
run: uv run pytest tests/ --cov=worktreeflow --cov-report=term-missing --cov-fail-under=35
36+
run: uv run pytest tests/ --cov=worktreeflow --cov-report=term-missing --cov-fail-under=35 -v --tb=short
3637

3738
lint:
3839
runs-on: ubuntu-latest

Makefile

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: test lint format typecheck coverage build clean help completions-bash completions-zsh completions-fish version bump-patch bump-minor bump-major release
1+
.PHONY: test lint format typecheck coverage build clean help completions-bash completions-zsh completions-fish version bump-patch bump-minor bump-major release ci-deps lefthook-install lefthook-run
22

33
help: ## Show this help message
44
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-15s\033[0m %s\n", $$1, $$2}'
@@ -58,3 +58,20 @@ completions-zsh: ## Generate zsh completions
5858

5959
completions-fish: ## Generate fish completions
6060
_WTF_COMPLETE=fish_source uv run wtf
61+
62+
ci-deps: ## Install CI/dev dependencies (lefthook, actionlint)
63+
@echo "Checking CI dependencies..."
64+
@command -v uv >/dev/null 2>&1 && echo " uv: installed" || { echo " uv: installing..."; curl -LsSf https://astral.sh/uv/install.sh | sh; }
65+
@command -v lefthook >/dev/null 2>&1 && echo " lefthook: installed" || { echo " lefthook: installing..."; brew install lefthook; }
66+
@command -v actionlint >/dev/null 2>&1 && echo " actionlint: installed" || { echo " actionlint: installing..."; brew install actionlint; }
67+
uv sync --group dev
68+
@echo "All CI dependencies ready."
69+
70+
lefthook-install: ## Install and activate lefthook pre-commit hooks
71+
@command -v lefthook >/dev/null 2>&1 || { echo "lefthook not found. Run 'make ci-deps' first."; exit 1; }
72+
lefthook install
73+
@echo "Lefthook pre-commit hooks activated."
74+
75+
lefthook-run: ## Manually run all lefthook pre-commit checks
76+
@command -v lefthook >/dev/null 2>&1 || { echo "lefthook not found. Run 'make ci-deps' first."; exit 1; }
77+
lefthook run pre-commit

PROJECTS.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Projects
2+
3+
**Legend:**
4+
- `[x]` Completed
5+
- `[-]` In Progress
6+
- `[ ]` Not Started
7+
- `[~]` Won't fix / Invalid / False positive
8+
9+
---
10+
11+
## [-] Project P16: Fix GitHub Actions Bugs + Makefile CI/Lefthook Recipes (v0.3.4)
12+
**Goal**: Fix duplicate test execution bug in CI workflow, add Makefile recipes for CI dependency management, lefthook install, and manual lefthook runs
13+
14+
**Out of Scope**
15+
- Raising the coverage threshold (currently 35%)
16+
- Adding `permissions:` block to ci.yml (not a bug, just best practice)
17+
18+
### Tests & Tasks
19+
- [x] [P16-T01] Fix duplicate pytest run for Python 3.12 in ci.yml
20+
Added `if: matrix.python-version != '3.12'` to plain test step so 3.12 only runs the coverage variant
21+
- [x] [P16-T02] Add `-v --tb=short` flags to coverage test step for consistent verbose output
22+
Ensures 3.12 coverage run has same verbosity as other versions
23+
- [x] [P16-T03] Add `make ci-deps` recipe — checks if uv/lefthook/actionlint are installed before installing, then runs `uv sync --group dev`
24+
- [x] [P16-T04] Add `make lefthook-install` recipe — activates pre-commit hooks (errors if lefthook not found)
25+
- [x] [P16-T05] Add `make lefthook-run` recipe — manually runs all pre-commit checks (errors if lefthook not found)
26+
- [x] [P16-TS01] Validate ci.yml with actionlint — passed with no errors
27+
- [x] [P16-TS02] Run full test suite — 159 tests passed
28+
- [x] [P16-TS03] Verify `make help` shows all new targets
29+
- [x] [P16-TS04] Verify `make ci-deps` detects already-installed tools
30+
- [x] [P16-TS05] Verify `make lefthook-install` activates hooks
31+
- [x] [P16-TS06] Verify `make lefthook-run` executes pre-commit checks
32+
- [ ] [P16-TS07] Regression — push to branch and confirm CI passes on all 3 Python versions
33+
34+
### Deliverable
35+
- `.github/workflows/ci.yml` — Python 3.12 no longer runs the test suite twice
36+
- `Makefile` — 3 new recipes: `ci-deps`, `lefthook-install`, `lefthook-run`
37+
38+
### Automated Verification
39+
- `actionlint .github/workflows/ci.yml` passes
40+
- `make test` — 159 tests pass
41+
- `make ci-deps` — detects installed tools, installs missing ones
42+
- `make lefthook-install` — activates hooks
43+
- `make lefthook-run` — runs pre-commit checks
44+
45+
### Manual Verification
46+
- Push to a branch and confirm CI passes on all 3 Python versions (3.11, 3.12, 3.13)
47+
- Confirm 3.12 job only shows one pytest execution (with coverage)

0 commit comments

Comments
 (0)