Skip to content

ci: add GitHub Actions CI workflow#2

Merged
thlaure merged 9 commits into
masterfrom
ci/add-github-actions
May 16, 2026
Merged

ci: add GitHub Actions CI workflow#2
thlaure merged 9 commits into
masterfrom
ci/add-github-actions

Conversation

@thlaure
Copy link
Copy Markdown
Owner

@thlaure thlaure commented May 16, 2026

Summary

Modeled after the Signalist and INSEE-City-API CI pipelines, adapted for this project's tooling.

Jobs

Job What it does
Tests Builds test image (compose.test.yaml, frankenphp_test target with pcov), starts services, installs deps, generates JWT keypair, runs PHPUnit + Behat, enforces ≥80% unit coverage, audits composer deps, runs CS Fixer / PHPStan / Rector in dry-run, YAML lint, Doctrine schema validate
Secret Scan TruffleHog verified-only scan on full git history
Trivy Scans prod image (frankenphp_prod) and repository filesystem for CRITICAL/HIGH CVEs
Docker Lint hadolint on .docker/api/Dockerfile, failure on error

Key differences from reference CIs

  • Uses compose.test.yaml (has built-in healthchecks for Postgres + Redis; no port exposed — Behat runs via KernelBrowser, not HTTP)
  • Uses pcov (not xdebug) for coverage — no XDEBUG_MODE env needed
  • Single Dockerfile with multi-stage targets, so hadolint job targets .docker/api/Dockerfile directly
  • No landing/frontend jobs (out of scope for this repo)

Test plan

  • Push to this branch — all 4 jobs should trigger
  • Verify coverage threshold check output in Tests job logs
  • Verify Trivy does not flag known unfixed CRITICAL/HIGH CVEs

🤖 Generated with Claude Code

Thomas Laure and others added 9 commits May 16, 2026 15:04
Jobs: tests (PHPUnit + Behat + coverage ≥80% + CS Fixer + PHPStan + Rector + YAML lint + Doctrine schema + composer audit), secret-scan (TruffleHog), trivy (prod image + fs CRITICAL/HIGH), lint (hadolint Dockerfile).
Uses compose.test.yaml with pcov coverage; generates JWT keypair before tests.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
… base image CVEs

- Remove --no-cache from build (was causing excessive memory use on CI)
- Add COMPOSER_MEMORY_LIMIT=-1 to composer install exec (exit 137 = OOM kill)
- Add .trivyignore for 8 CVEs in Go libs bundled in dunglas/frankenphp base image;
  these cannot be patched at app level — track upgrading base image separately

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…nore

Trivy reports remain visible in CI logs as warnings but no longer fail the job.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Runner has 7GB RAM; image build + postgres + redis + app + composer install
exhausts physical memory. Swap prevents the kernel OOM killer from firing.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Running composer inside the container OOM-killed even with runner swap.
Install PHP 8.5 + composer on the host; vendor/ mounts into the container
via the existing volume so all exec steps still work unchanged.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
LexikJWTAuthenticationBundle is not a dependency of this project.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
pcov.enabled defaults to 0; pass -d pcov.enabled=1 so PHPUnit
actually collects coverage instead of generating an empty report.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
PHPUnit 11 testsuite names are case-sensitive; phpunit.xml.dist defines
"unit" not "Unit", so --testsuite=Unit matched nothing.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…ant wrapper

phpstan.neon.dist is PHPStan's standard auto-discovery name. The old
phpstan.neon just included phpstan.dist.neon and added no value while
being committed. phpstan.neon is now gitignored for local-only overrides.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
@thlaure thlaure merged commit 68cc5e3 into master May 16, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant