Skip to content

Commit 248fb5f

Browse files
alexclaude
authored andcommitted
perf(ci): optimiser workflow build -25% temps execution
Retrait redondances et conditionnement : 1. Fusionner apt-get installs (1 seul update au lieu de 2) → -2min15s 2. Supprimer pre-commit redondant (doublon Black/Ruff/mypy) → -35s 3. Supprimer E2E Docker (continue-on-error, redondant avec E2E native) → -35s 4. Benchmark conditionnel main uniquement → -14s sur PR Résultat attendu : - PR : 8min50s (au lieu de 11min53s, -25%) - Main : 9min04s (au lieu de 11min53s, -24%) Qualité préservée : coverage 89%+, E2E complet, strict mode, tests unitaires Refs: ADR-012 (à créer) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 76ccdd1 commit 248fb5f

1 file changed

Lines changed: 12 additions & 70 deletions

File tree

.github/workflows/build.yml

Lines changed: 12 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,16 @@ jobs:
3434
- name: Install security tools
3535
run: pip install -r requirements-security.txt
3636

37-
# ===== PRE-COMMIT VERIFICATION =====
38-
- name: Verify pre-commit hooks configuration
37+
- name: Install system dependencies (qpdf + WeasyPrint + E2E libs)
3938
run: |
40-
echo "=== Pre-commit Hooks Verification ==="
41-
pip install pre-commit
42-
pre-commit run --all-files || true
43-
echo ""
44-
echo "=== Pre-commit hooks verified ==="
39+
sudo apt-get update
40+
sudo apt-get install -y \
41+
qpdf \
42+
libpango-1.0-0 \
43+
libpangocairo-1.0-0 \
44+
libgdk-pixbuf2.0-0 \
45+
libffi-dev \
46+
shared-mime-info
4547
4648
# ===== QUALITY CHECKS =====
4749
- name: Run Black formatter check
@@ -140,29 +142,27 @@ jobs:
140142
fi
141143
echo "✅ Thème DSFR correctement appliqué"
142144
143-
- name: Install qpdf
144-
run: sudo apt-get update && sudo apt-get install -y qpdf
145-
146145
- name: Validate PDF structure
147146
run: qpdf --check exports/span-sg.pdf
148147

149-
# ===== BENCHMARK =====
148+
# ===== BENCHMARK (main only) =====
150149
- name: Run benchmark
150+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
151151
run: |
152152
echo "Running performance benchmarks..."
153153
python scripts/benchmark.py > benchmark-${{ github.sha }}.json
154154
echo "Benchmark complete"
155155
cat benchmark-${{ github.sha }}.json
156156
157157
- name: Upload benchmark metrics
158+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
158159
uses: actions/upload-artifact@v4
159160
with:
160161
name: benchmark-${{ github.run_number }}
161162
path: benchmark-${{ github.sha }}.json
162163
retention-days: 365
163164

164165
# ===== E2E TESTS (run on all events) =====
165-
# Phase 1: E2E native (GitHub Actions environment)
166166
- name: Run E2E tests (native environment)
167167
run: |
168168
echo "🧪 Running E2E tests in native GitHub Actions environment..."
@@ -184,64 +184,6 @@ jobs:
184184
path: tests/e2e/accessibility_report.json
185185
retention-days: 30
186186

187-
# Phase 2: E2E Docker (containerized environment)
188-
- name: Install system dependencies for E2E
189-
run: |
190-
sudo apt-get update
191-
sudo apt-get install -y \
192-
libpango-1.0-0 \
193-
libpangocairo-1.0-0 \
194-
libgdk-pixbuf2.0-0 \
195-
libffi-dev \
196-
shared-mime-info
197-
198-
- name: Setup Docker Buildx
199-
uses: docker/setup-buildx-action@v2
200-
201-
- name: Cache Docker layers
202-
uses: actions/cache@v3
203-
with:
204-
path: /tmp/.buildx-cache
205-
key: ${{ runner.os }}-buildx-${{ hashFiles('Dockerfile.mkdocs-test', 'requirements-dsfr.txt') }}
206-
restore-keys: |
207-
${{ runner.os }}-buildx-
208-
209-
- name: Build E2E test Docker image (with mkdocs-dsfr)
210-
run: |
211-
docker buildx build \
212-
-f Dockerfile.mkdocs-test \
213-
-t mkdocs-test:latest \
214-
--cache-from type=local,src=/tmp/.buildx-cache \
215-
--cache-to type=local,dest=/tmp/.buildx-cache-new,mode=max \
216-
--load \
217-
.
218-
219-
- name: Move Docker cache
220-
run: |
221-
rm -rf /tmp/.buildx-cache
222-
mv /tmp/.buildx-cache-new /tmp/.buildx-cache || true
223-
224-
- name: Run E2E tests (Docker environment)
225-
continue-on-error: true # TODO: Remove once Docker environment validated
226-
run: |
227-
docker run --rm -v $PWD:/docs --entrypoint bash mkdocs-test:latest tests/e2e/ci_runner.sh
228-
229-
- name: Upload E2E Docker report
230-
if: always()
231-
uses: actions/upload-artifact@v4
232-
with:
233-
name: e2e-docker-report-${{ github.run_number }}
234-
path: tests/e2e/report.html
235-
retention-days: 30
236-
237-
- name: Upload E2E Docker accessibility report
238-
if: always()
239-
uses: actions/upload-artifact@v4
240-
with:
241-
name: e2e-docker-accessibility-${{ github.run_number }}
242-
path: tests/e2e/accessibility_report.json
243-
retention-days: 30
244-
245187
# ===== FIX: Rebuild DSFR après E2E tests =====
246188
# CRITIQUE: Les E2E tests (scenario_erreur_markdown.sh) font `mkdocs build --strict`
247189
# sans --config-file ni --site-dir, écrasant site/ avec Material theme.

0 commit comments

Comments
 (0)