# Set Up GitHub Actions CI for an AdonisJS App

Yes. An agent adds a workflow that lints, typechecks, migrates SQLite and runs Japa tests for your AdonisJS app, writes a first functional test, and opens a PR.

[Run this on Rush](https://cloud.getrush.ai/run/add-github-actions-ci/adonisjs/). Opens the console with this prompt ready to send, in a Project that has your repository.

## What the agent does

The agent reads the scripts before it writes a workflow, because an AdonisJS app already says how it wants to be checked. In an app made from the `api` kit in adonisjs/starter-kits, `package.json` has `lint` (`eslint .`), `typecheck` (`tsc --noEmit`), `test` (`node ace test`) and `build` (`node ace build`), with `@adonisjs/core` 7, `@adonisjs/lucid` on `better-sqlite3`, `@adonisjs/auth` with access tokens, `@japa/runner`, `@japa/api-client` and TypeScript 6. `adonisrc.ts` declares two Japa suites, `unit` under `tests/unit` and `functional` under `tests/functional` with a 30 second timeout, and `tests/bootstrap.ts` already loads the `apiClient`, `sessionApiClient`, `authApiClient` and `dbAssertions` plugins and starts the HTTP server for the functional suite. What the kit does not ship is a workflow, a lockfile or a single test file: the monorepo's own `.github/workflows/ci.yml` lints and typechecks the `hypermedia`, `inertia-react` and `inertia-vue` kits on Node 24 and never touches `api`.

Two files decide how the test job is wired. `config/database.ts` keeps SQLite at `app.tmpPath('db.sqlite3')`, and `.gitignore` ignores everything in `tmp/` except `.gitkeep`, so a fresh checkout has no database and the two migrations under `database/migrations/` (users, then access tokens) have to run before a functional test can sign anyone up. `.env.test` sets only `SESSION_DRIVER=memory`; the rest comes from `.env`, which is ignored too, so the workflow copies `.env.example` to `.env` before `node ace test`. The agent adds `testUtils.db().migrate()` to `runnerHooks.setup` in `tests/bootstrap.ts`, the place the kit leaves empty for exactly this, so the test run migrates its own SQLite file and tears it down.

With that in place the agent writes `.github/workflows/ci.yml`: `push` and `pull_request` on the default branch, a concurrency group per ref, `permissions: contents: read`, and `actions/setup-node` with Node 24 and the cache keyed to whichever lockfile the app has. The kit ships none, so the agent reads the one the reader's checkout committed (`package-lock.json`, `pnpm-lock.yaml` or `yarn.lock`, which `.yarnrc.yml`'s `nodeLinker: node-modules` and `pnpm-workspace.yaml`'s `onlyBuiltDependencies` both prepare for) and picks `npm ci`, `pnpm install --frozen-lockfile` or `yarn install --immutable` to match. `better-sqlite3` compiles a native module on install; `package.json` approves its script under `allowScripts` and `pnpm-workspace.yaml` under `allowBuilds`, so the install needs no extra flag. The jobs then run `lint`, `typecheck`, `test` and `build` in that order, the build last because it proves the production bundle compiles.

A workflow that runs zero tests proves little, so the agent writes `tests/functional/auth.spec.ts` against the routes in `start/routes.ts`: `POST /api/v1/auth/signup` creates an account, `POST /api/v1/auth/login` answers with the user and a token from `User.accessTokens.create`, and `GET /api/v1/account/profile` behind the `auth` middleware returns the profile when that token is sent as a bearer and `401` when it is not. The test uses the `client` from `@japa/api-client` and `assert` from `@japa/assert`, both already registered in `tests/bootstrap.ts`. The agent runs the four scripts in its sandbox on Node 24 the way the workflow will, and `actionlint` on the YAML, before opening the pull request.

## Start it with one API call

`POST https://api.phoenix.so/o/{org}/sessions`

```json
{
  "agent": "claude",
  "input": "Set up GitHub Actions CI for this AdonisJS app. Read package.json, the lockfile, adonisrc.ts, tests/bootstrap.ts, bin/test.ts, config/database.ts, config/auth.ts, start/routes.ts, start/kernel.ts, .env.example, .env.test, .gitignore, eslint.config.js and tsconfig.json first. Add a workflow that installs with the package manager the lockfile belongs to, on Node 24, and runs the lint, typecheck, test and build scripts. Make the test run self-contained: copy .env.example to .env in the job, and migrate the SQLite database in the Japa setup hook so functional tests start from the migrations. Add one functional test that signs up, logs in with the access token guard and reads the authenticated profile route, plus the 401 case. Run all four scripts in the sandbox and actionlint on the workflow, then open a pull request that shows their output.",
  "resources": [
    {
      "url": "https://github.com/your-org/your-app"
    }
  ]
}
```

1. **Get an API key.** In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
2. **Send the request.** POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
3. **Read what came back.** Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.

## What comes back

What comes back is a pull request with `.github/workflows/ci.yml`, a new `tests/functional/auth.spec.ts`, and a one-line change in `tests/bootstrap.ts` that migrates the test database in `runnerHooks.setup`. The description shows the `eslint`, `tsc --noEmit`, `node ace test` and `node ace build` output from the sandbox, names the lockfile it found and the install command it chose, and lists the three assertions in the new test.

The run's record keeps every command, including the first `node ace test` before the migrate hook existed, which fails on a missing `users` table, and the passing run after it, so a reviewer can see why the bootstrap change is there.

Before merging, a reviewer checks the branch names in the trigger, decides whether the app should run tests on a database other than SQLite in CI, and whether `APP_KEY` from `.env.example` is acceptable for a test job or should come from a repository secret. The agent keeps SQLite, because that is what `config/database.ts` configures, and says so.

## Run it on every repository with no workflow

A team with several AdonisJS services sends one `POST /o/{org}/sessions` per repository from the terminal or a script, with this prompt and the repository in `resources`, and a `request_id` that is a UUID v5 of the repository's full name so a retry returns the run already started. `GET /o/{org}/github` lists every repository the Rush GitHub App installation reaches, so the script can clone each and start a run only where `.github/workflows/` is empty.

Each run reads its own `package.json` and lockfile, so a service on pnpm gets `pnpm install --frozen-lockfile`, one on PostgreSQL with `pg` in `config/database.ts` gets a `services:` block with a health check instead of SQLite, and one that already has unit tests gets the functional test added beside them. Each opens its own pull request.

## Why run it on Rush?

A CI file copied from another project fails on the parts that are specific to this one: a native `better-sqlite3` build the install never ran, a `tmp/db.sqlite3` that does not exist on a clean runner, an `.env` that only a developer's machine has, or a cache keyed to the wrong lockfile. In a Rush sandbox the agent installs from the real lockfile, runs `node ace test` and reads the failure about the missing table before it decides where the migration belongs.

The commands and their output stay with the run, and the pull request cites them, so the reviewer sees the lint, typecheck, test and build results rather than a green badge that proves only that YAML parsed. Several services at once cost the same attention as one, because each run has its own sandbox, its own log and its own pull request.

## Frequently asked questions

### Why migrate in tests/bootstrap.ts rather than in the workflow?

Because then the tests set themselves up everywhere, not only on GitHub. `runnerHooks.setup` in `tests/bootstrap.ts` is the hook the kit leaves empty for this; `testUtils.db().migrate()` runs the migrations before the suites and rolls them back after. A developer running `node ace test` locally gets the same fresh database the runner gets.

### Does it work with pnpm or yarn?

Yes. The kit ships `.yarnrc.yml` and `pnpm-workspace.yaml` as well as npm's `allowScripts`, but no lockfile, so the agent reads the one your repository committed and writes the matching install step and cache key. If there is no lockfile at all it says so in the pull request and uses `npm install`, which is less reproducible.

### Will it change my existing tests or routes?

No. The new spec file lives beside whatever is in `tests/functional/`, the routes in `start/routes.ts` are read and not edited, and the only change to an existing file is the migrate call in the bootstrap's setup hook. If a functional test already signs up and logs in, the agent extends it instead of adding a duplicate.

### Why run the build in CI?

`node ace build` compiles the TypeScript into `build/`, which is what `npm start` runs in production. `tsc --noEmit` catches type errors, but only the build catches an import that resolves in development through `hot-hook` and not in the compiled output.

## More AdonisJS jobs

- [Add Google Login to an AdonisJS App](https://getrush.ai/run/add-google-login/adonisjs/)
- [Add Health Checks to an AdonisJS API](https://getrush.ai/run/add-health-checks/adonisjs/)
- [Add i18n to an AdonisJS App](https://getrush.ai/run/add-i18n/adonisjs/)

## The same job on other stacks

- [Add GitHub Actions CI to an Airflow Project](https://getrush.ai/run/add-github-actions-ci/airflow/)
- [Set Up GitHub Actions CI for an AWS CDK App](https://getrush.ai/run/add-github-actions-ci/aws-cdk/)
- [Set Up GitHub Actions CI for a Bazel Repository](https://getrush.ai/run/add-github-actions-ci/bazel/)

## Keep reading

- [How a Rush run works on your repository, from request to pull request](https://getrush.ai/cloud/)
- [Compare cloud agents, agent sandboxes and AI code review](https://getrush.ai/compare/)
- [Rush pricing: Free, Pro and Max](https://getrush.ai/pricing/)
