Optimized GitHub Actions workflow templates for Laravel apps, tuned to use fewer CI minutes and keep the Actions bill down.
- Cancel superseded runs with a
concurrencyblock, so new commits to a PR stop the old run instead of running both. - Cache Composer and npm so each run doesn't reinstall everything from scratch.
- Run tests with
coverage: none(Xdebug is much slower and the coverage report wasn't used). - Trigger on
pull_requestonly, and reuse the green result on merge viapost-merge.yml, instead of building the same commit on both push and PR. - Use
npm ciinstead ofnpm i.
Also set a spending limit under Settings > Billing > Actions as a safety net.
In templates/.github/workflows/:
tests.ymlruns Pest/PHPUnit and the asset build. Check name:ci (8.5).lint.ymlruns Pint and the frontend lint/format checks.post-merge.ymlreuses the PR's passing checks on the merge commit.
Both use Node 24 and PHP 8.5. Pin these to whatever your repo actually runs.
CI runs on PRs into develop. To promote to production without re-running it:
git checkout main && git fetch origin develop
git merge --ff-only origin/develop && git push origin main
git checkout develop
The fast-forward makes main point at the exact commit that already passed CI, so the green checks carry over and no build runs on the push. This needs main to allow direct pushes (no "require pull request" protection); adding that rule forces a develop -> main PR, which costs one extra build per release.
- Copy the templates into
.github/workflows/. - Set
php-versionintests.ymlto your version, and match it inpost-merge.yml'srequiredChecks(ci (<php-version>)andquality). - Make sure
composer.lockandpackage-lock.jsonare committed. - Open a PR and confirm both jobs pass and the cache hits on the second run.