Shared GitHub Actions workflows for the IQ2i, loicsapone and Mezcalito repositories.
Before this repository existed, the same job — checkout → setup-php → composer install → one command —
was copy-pasted roughly forty times across twelve repositories. The copies had drifted: actions/checkout@v4,
@v6 and @v7 all in use, three ways of installing dependencies, and a ${{ matrix.php_version }} typo that
silently reduced two 5-version test matrices to a single version. Everything below exists to have one copy.
This repository is public, so these workflows can be called from any repository, including private ones.
name: CI
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
security:
uses: IQ2i/.github/.github/workflows/php-security.yml@main
cs:
uses: IQ2i/.github/.github/workflows/php-cs.yml@main
sa:
uses: IQ2i/.github/.github/workflows/php-stan.yml@main
tests:
uses: IQ2i/.github/.github/workflows/php-tests.yml@main
with:
php-versions: '["8.3", "8.4", "8.5"]'The permissions and concurrency blocks belong in the caller, not here — a reusable workflow cannot grant
itself less than it is given, and concurrency is scoped to the calling workflow. Set both on every CI.
All of them accept php-extensions, dependency-versions (highest | lowest | locked),
composer-options, working-directory and runs-on. The QA workflows (php-cs, php-stan, php-security,
php-tests) and symfony-app also accept ref, the Git ref to check out: it defaults to the ref that triggered
the workflow, and lets a caller test another branch. Only what is specific to each is listed below.
| Input | Default | |
|---|---|---|
php-version |
8.4 |
|
args |
fix --dry-run --diff --no-ansi |
Passed to php-cs-fixer |
ignore-env |
false |
Sets PHP_CS_FIXER_IGNORE_ENV, for a PHP version the config does not support yet |
| Input | Default | |
|---|---|---|
php-version |
8.4 |
|
args |
analyse --no-progress |
Passed to phpstan |
memory-limit |
-1 |
| Input | Default | |
|---|---|---|
php-version |
8.4 |
|
composer-validate |
true |
Runs composer validate --strict |
no-check-lock |
false |
For packages that do not commit a lock file |
audit-args |
— | Passed to composer audit |
| Input | Default | |
|---|---|---|
php-versions |
["8.4"] |
JSON array; one job per version |
args |
— | Passed to phpunit |
coverage |
none |
none, pcov or xdebug |
coverage-floor |
0 |
Minimum line coverage percentage; 0 disables. Requires a coverage driver |
before-script |
— | Shell script run after the install and before PHPUnit, e.g. bin/console tailwind:build |
mariadb-version |
— | Starts a MariaDB service (e.g. 11.4) and exports DATABASE_URL (user root, database app) before the before-script. The test database is up to the caller, e.g. doctrine:database:create --env=test in before-script |
fail-fast |
false |
tests:
uses: IQ2i/.github/.github/workflows/php-tests.yml@main
with:
php-versions: '["8.3", "8.4", "8.5"]'
coverage: pcov
coverage-floor: 95There is no "fail below X%" option in PHPUnit, so the floor is enforced by reading the clover totals. Raise it only to a number the suite already reaches.
For applications rather than libraries: it checks what a dependency update can break without failing a unit test. Each step is skipped when the tool or the file it needs is missing.
| Input | Default | |
|---|---|---|
php-version |
8.4 |
|
dependency-versions |
locked |
An application tests what it deploys, not the highest versions |
before-script |
— | Shell script run after the install, e.g. bin/console tailwind:build |
It runs lint:container, lint:twig, lint:yaml, twig-cs-fixer, tailwind-cs-fixer (the job fails when
it would rewrite a template) and, when there is an importmap.php, asset-map:compile and importmap:audit.
app:
uses: IQ2i/.github/.github/workflows/symfony-app.yml@main
with:
php-version: '8.5'
before-script: bin/console tailwind:buildFor bundles and libraries that must prove they work across several Symfony versions. Handles the
symfony/flex setup that pins extra.symfony.require.
| Input | Default | |
|---|---|---|
matrix |
[{"php": "8.4"}] |
JSON array of combinations |
args |
— | Passed to phpunit |
fail-fast |
false |
Each matrix entry accepts php (required), symfony, stability, dependency-versions, pin-packages
and name (the label shown in the checks list; defaults to PHP x, Symfony y).
tests:
uses: IQ2i/.github/.github/workflows/bundle-ci.yml@main
with:
matrix: |
[
{"php": "8.4", "symfony": "8.0"},
{"php": "8.4", "symfony": "7.4"},
{"php": "8.3", "symfony": "6.4", "dependency-versions": "lowest"},
{"php": "8.5", "symfony": "8.0.x-dev", "stability": "dev", "name": "PHP 8.5, Symfony dev"}
]For repositories that publish a composite action. Validates the action metadata, runs actionlint, and
shellchecks every run: block of every composite action and the scripts shipped next to them.
| Input | Default | |
|---|---|---|
actionlint-version |
1.7.7 |
|
action-paths |
action.yml action.yaml actions/*/action.yml .github/actions/*/action.yml |
Space-separated globs |
script-paths |
actions/*/scripts/*.sh .github/actions/*/scripts/*.sh |
Space-separated globs |
shellcheck |
true |
Audits the lock files and opens a pull request that updates only the packages with a security advisory. Unlike the workflows above, it does not run on a pull request: the caller schedules it, and Dependabot is not involved, since it only reacts to the advisories GitHub has reviewed, days or weeks after Packagist publishes them.
For each Composer directory it runs composer audit, then composer update on the vulnerable packages, and commits
composer.json with composer.lock: with bump-after-update, the update rewrites the constraints, and the lock
file's content-hash follows them. npm directories get npm audit fix --package-lock-only, never --force. A
directory whose advisories are not fixed keeps its files untouched. The pull request lists the advisories that
disappeared, and starts the CI with a workflow_dispatch (a pull request opened with the GITHUB_TOKEN does not
start it by itself). The job fails when a Composer advisory is still open.
| Input | Default | |
|---|---|---|
php-version |
8.5 |
|
php-extensions |
— | Composer checks them when it updates a lock file |
composer-directories |
. |
Space-separated |
npm-directories |
— | Space-separated, npm is skipped when empty |
node-version |
26 |
|
assignee |
— | GitHub login assigned to the pull request |
ci-workflow |
ci.yml |
Run on the pull request branch, it must accept workflow_dispatch |
name: Security updates
on:
schedule:
# Off the top of the hour: GitHub delays scheduled runs at peak times.
- cron: '17 * * * *'
workflow_dispatch:
permissions:
contents: write
pull-requests: write
actions: write
concurrency:
group: security-updates
jobs:
update:
uses: IQ2i/.github/.github/workflows/security-updates.yml@main
with:
php-extensions: intl
npm-directories: .
assignee: octocatSets PHP up, restores the Composer cache and installs dependencies. The reusable workflows above all go through it; call it directly when you need a job they do not cover.
- uses: IQ2i/.github/actions/setup-php@main
with:
php-version: '8.4'
dependency-versions: lowestInputs: php-version, extensions, ini-values, coverage, tools, dependency-versions,
composer-options, working-directory, cache-suffix, install-php.
dependency-versions replaces ramsey/composer-install: highest runs composer update, lowest adds
--prefer-lowest --prefer-stable, and locked runs composer install (falling back to update when there
is no lock file, which is the normal case for a bundle).
Set install-php: 'false' when the job already set PHP up and needs to edit composer.json before
installing — that is what bundle-ci.yml does for symfony/flex.
GitHub calls these default community health files. An IQ2i repository that has no file of a given type falls back to the one here, whatever its visibility — nothing to copy, nothing to keep in sync:
| File | Inherited |
|---|---|
CODE_OF_CONDUCT.md |
yes |
CONTRIBUTING.md |
yes |
SECURITY.md |
yes |
.github/ISSUE_TEMPLATE/ (templates and config.yml) |
yes |
.github/PULL_REQUEST_TEMPLATE.md |
yes |
.github/dependabot.yml |
no — copy it into each repository |
.github/workflows/ |
no — this is what uses: is for |
LICENSE |
no — must live in the repository so it survives a clone or a package download |
.github/README.md |
no — it is this repository's own readme |
Two limits worth knowing:
- Inheritance is per owner.
loicsapone/*andMezcalito/*get nothing from here; they can call the reusable workflows, but their health files have to live in their own.githubrepository. - This repository must stay public for any of it to work, including for private IQ2i repositories.
The org profile page is driven by profile/README.md, not by this readme.
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: monthly
commit-message:
prefix: ciCallers currently track @main. Once the workflows have settled across a few repositories, a moving v1
tag will be introduced and @main will stop being the recommended target.
See CONTRIBUTING.md.