Skip to content

CI Pipeline

.github/workflows/ci.yml runs for pull requests into master, explicit manual dispatches, and reusable calls from Delivery. Delivery passes the selected immutable source commit and requires the full suite before Release Please or container publication. This covers direct pushes, administrator merges, manual release requests, and tag recovery without relying on branch protection alone.

CI is intentionally secret-free and fork-safe. Actions are commit-SHA pinned, checkout credentials are not persisted, permissions are scoped per job, event values are passed to shells through environment variables, and every job has a timeout.

Job Contract
Classify pull request Detect and validate exact same-repository Release Please metadata-only updates
Frontend build and dependency audits PHP 8.5.12, Node 26.12.1, runtime version verification, Composer install/audit, production npm audit, JS unit tests, Vite build, and docs link checks
Static checks PHP 8.5.12, Composer install, parallel Pint formatting, stable/edge installer fixtures, and Compose/Swarm/shell validation
Extension lifecycle Installed extension contract validation and composer test:extensions against the built frontend assets
Pest suite (1..4/4) Sharded parallel Pest runs on PHP 8.5.12 with OPcache CLI enabled and built frontend assets restored
Workflow security Test the required-check policy and check every workflow with checksum-pinned actionlint and zizmor
Documentation production build Install the separate docs lockfile on Node 22.23.4, check generated docs/links, and build Astro before merge
Conventional PR title Validate the current GitHub title after the separate metadata automation normalizes it; skipped outside pull requests
required Stable CI / required branch-protection aggregator

Application boot uses SQLite, array cache/session/mail, sync queues, null broadcasting, and disabled optional observability. Pest then uses its isolated SQLite file and test-specific overrides from phpunit.xml and tests/Pest.php. Composer downloads and both npm lockfiles have separate caches. The application Node runtime matches both production Dockerfiles; documentation retains its own patched Node 22 toolchain.

Delivery owns the multi-architecture container build and registry credentials. CI builds the frontend/SSR bundle for tests; Delivery builds production images only after validation. The frontend build precedes both Pest and extension lifecycle tests because HTTP tests render Vite-backed views. The path-filtered Pages workflow rebuilds the same documentation source, checks generated docs/links, and publishes only from master.

Standalone module registry validation runs in the separate KoAkademy module registry repository. Its CI checks registry.json and packages.json consistency on pull requests, while pushes to master additionally verify the Ed25519 signature. The Pages workflow repeats both checks before publishing. Registry contributors never need access to the private signing key.

Release Please pull requests use a fast path because they do not change application code. The classifier accepts only the same-repository Release Please branch with exactly three modified, non-renamed files: .release-please-manifest.json, CHANGELOG.md, and version.json. It checks matching stable versions, the generated PR title, and the changelog entry. Additional files, renames, or deletions restore the full suite. Delivery and manual dispatches never use this fast path.

The required job evaluates .github/ci-required.jq. It accepts skipped validation jobs only for the validated release-metadata PR path, and a skipped title job only outside pull requests. Missing, failed, cancelled, or unexpectedly skipped jobs fail closed. bash tests/ci-required.sh tests this policy without application dependencies. Recovery audits workflows and the gate policy from the current workflow revision while application/docs checks use the selected historical source.

Terminal window
composer install
npm ci
composer audit --locked --abandoned=report
bash scripts/audit-production-deps.sh
vendor/bin/pint --test
npm run test:email-canvas
npm run test:enrollment-workflow
npm run test:grade-status-labels
bash tests/ci-required.sh
bash tests/installer-release.sh stable
bash tests/installer-release.sh edge
npm run build
php artisan test --parallel --compact
npm run docs:check
npm --prefix docs ci
npm --prefix docs run build
KOAKADEMY_ENV_FILE=.env.production.example \
docker compose --env-file .env.production.example -f compose.production.yaml config --quiet
for script in docker/start-container docker/healthcheck docker/pulse-process \
docker/nightwatch-process docker/run-scripts.sh docker/docker-scripts/*.sh; do
sh -n "$script"
done
for script in scripts/install.sh scripts/koakademy scripts/check-release-assets.sh \
scripts/generate-version-metadata.sh scripts/audit-production-deps.sh \
tests/installer-release.sh tests/ci-required.sh; do
bash -n "$script"
done
shellcheck scripts/install.sh scripts/koakademy scripts/koakademy-app-entrypoint.sh \
scripts/check-release-assets.sh scripts/generate-version-metadata.sh \
scripts/audit-production-deps.sh tests/installer-release.sh tests/ci-required.sh \
tests/Fixtures/installer/docker tests/Fixtures/installer/curl tests/Fixtures/installer/ss
docker compose --env-file tests/Fixtures/installer/swarm-stack.env \
-f scripts/swarm-stack.yml config --quiet
docker compose --env-file tests/Fixtures/installer/swarm-stack.env \
-f scripts/swarm-stack-direct.yml config --quiet
set -a
source tests/Fixtures/installer/swarm-stack.env
set +a
docker stack config --compose-file scripts/swarm-stack.yml >/dev/null
docker stack config --compose-file scripts/swarm-stack-direct.yml >/dev/null

Run a focused test while iterating:

Terminal window
bash tests/ci-required.sh
php artisan test --compact --filter="shows the setup screen"
  • Branch protection: require only CI / required; individual job names can evolve without changing repository settings.
  • No secrets: do not add registry credentials or deployment side effects to CI. Privileged publication stays in Delivery.
  • Forks: pull-request validation remains secret-free and never publishes artifacts. Reusable CI receives no inherited secrets from Delivery.
  • PR titles: the metadata-only pull_request_target workflow may read the title, description, labels, and changed-file names to infer a Conventional Commit type and scope. It never checks out or executes contributor code. Maintainers should review the inferred title because it controls release notes and SemVer.
  • Release ordering: Delivery reruns the full suite on the exact source commit before maintaining Release Please or publishing edge/stable images. Builds, replication, and promotion all depend on this gate.
  • Production approval: stable finalization uses the production environment; edge finalization uses container-publishing. Configure required reviewers and protected-branch restrictions on production in GitHub. Delivery verifies those rules before stable publication and fails closed if they are absent or unreadable.
  • Repository setup: require CI / required for master, require PR reviews, and review administrator bypass policy in GitHub. These settings are not controlled by workflow YAML.
  • Existing quality debt: repository-wide ESLint/Prettier, PHPStan, and strict Composer validation are not introduced as new blocking checks here. Production npm audit is blocking at high/critical severity; resolve unrelated lint/static-analysis debt before adding those gates.
  • Docker runtime audit: scripts/audit-production-deps.sh audits the same --omit=dev --omit=optional dependency tree shipped by the production Dockerfiles. It retries registry failures and fails closed for high or critical findings. This does not cover build-time or optional dependencies, or installations that retain them. picomatch remains vulnerable to CVE-2026-112366 during builds; no patched version is available. Do not pass untrusted glob patterns to build tooling, and upgrade once a fix is released.