From 11d3e4f5a8208dda14e7c1dd650f87cf02bf4176 Mon Sep 17 00:00:00 2001 From: Paul Isaris Date: Thu, 1 Oct 2026 09:47:50 +0300 Subject: [PATCH] Make the test database the first check for agents A fresh agent set pdo_mysql and a MySQL .env from the old workflow and reported no blockers. The old workflow started a MySQL service, which the shared workflow does not. - Guide: rule 5 'Check the test database first'; old-workflow values are evidence only when the shared workflow gives the same environment - laravel-ci.yml and its template say in the header that there is no database service --- .github/workflows/README.md | 13 ++++++++++--- .github/workflows/laravel-ci.yml | 4 ++++ AGENTS.md | 5 ++++- workflow-templates/laravel-ci.yml | 2 ++ 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/.github/workflows/README.md b/.github/workflows/README.md index 317f605..005da41 100644 --- a/.github/workflows/README.md +++ b/.github/workflows/README.md @@ -15,7 +15,7 @@ Each workflow file also starts with a comment block that shows a full example ca **Read this first** (people and AI coding agents). To add these workflows to a repository, follow [Adopt in an existing repository](#adopt-in-an-existing-repository). -These five rules prevent the common mistakes: +These six rules prevent the common mistakes: 1. **Start from a template** in [`workflow-templates/`](../../workflow-templates). It sets the triggers, `concurrency` and `permissions`. Do not write the @@ -28,8 +28,15 @@ These five rules prevent the common mistakes: repository that justify the value: the database in `phpunit.xml`, a script in `composer.json` or `package.json`, a step in the old workflow. With no evidence, leave the input commented out, so the default applies. Do not copy - a recipe from this guide without that evidence. -5. **Verify.** Run the repository's own checks, open a pull request, and read + a recipe from this guide without that evidence. A value from the old + workflow is evidence only if the shared workflow gives the same + environment: for example, `pdo_mysql` from an old workflow with a MySQL + service is not. +5. **Check the test database first.** The shared workflows start no MySQL or + PostgreSQL service. If the tests use one (read `phpunit.xml`, then + `.env.testing` or `.env.example`), this is a blocker: see + [Environment and database](#environment-and-database) before you continue. +6. **Verify.** Run the repository's own checks, open a pull request, and read the job logs. The required check becomes `ci / CI`. AI coding agents: [`AGENTS.md`](../../AGENTS.md) at the repository root has diff --git a/.github/workflows/laravel-ci.yml b/.github/workflows/laravel-ci.yml index 7629d18..a6b3916 100644 --- a/.github/workflows/laravel-ci.yml +++ b/.github/workflows/laravel-ci.yml @@ -4,6 +4,10 @@ # (never an exact release such as @v0.1.4). Procedure for people and AI agents: # https://github.com/scify/.github/blob/main/.github/workflows/README.md#adopt-in-an-existing-repository # +# No database service: the tests must run on SQLite (the Laravel default in +# phpunit.xml). If they need MySQL or PostgreSQL, read "Environment and database" +# in the guide before you adopt this workflow. +# # Minimal call (every value below is a default and can be left out): # # jobs: diff --git a/AGENTS.md b/AGENTS.md index 2121a36..a156ee4 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -47,7 +47,10 @@ Rules that cause failures when you break them: Dependabot auto-merge and other workflows. **Every input you set needs evidence**: a file and a line in the repository, for example a test suite in `phpunit.xml` or a script in `composer.json`. With no evidence, keep the - default. Do not copy a recipe from the guide without that evidence. + default. Do not copy a recipe from the guide without that evidence. A value + from the old workflow is evidence only if the shared workflow gives the same + environment (for example, `pdo_mysql` from an old workflow with a MySQL + service is not). **The workflow has no database service**: if the tests need MySQL or PostgreSQL, stop and ask the user (see the guide's "Environment and database"). diff --git a/workflow-templates/laravel-ci.yml b/workflow-templates/laravel-ci.yml index 51d9d56..68add7f 100644 --- a/workflow-templates/laravel-ci.yml +++ b/workflow-templates/laravel-ci.yml @@ -5,6 +5,8 @@ # Each commented-out input shows its default. Uncomment a line only to change it. # The "e.g." comment shows other accepted values. # In branch protection, require the check "ci / CI". +# No database service: the tests must run on SQLite. If they need MySQL or +# PostgreSQL, read "Environment and database" in the guide first. name: CI on: