ci: add test workflow #275

Open
ci-bot wants to merge 12 commits from ci/add-test-workflow into main
Member

Adds the missing Forgejo workflow files to run the test suite in CI, plus a small fix so pnpm test actually exists (the README already references it).

What's in it

  • .forgejo/workflows/test.yaml — runs on every PR to main:
    • unit job on srv-generic (same ci-pnpm container as the other checks): pnpm test:unit
    • integration job on srv-home with a services: Forgejo instance (pinned 16.0.3-rootless, same image as the devcontainer): pnpm test:integration
  • package.json — adds the test script (pnpm test:unit) that the README's Testing section already documents.

How the integration job works

  • The Forgejo service container is started via the services: keyword (act_runner supports it like GitHub Actions); the job container reaches it at http://forgejo:3000 on the shared job network — the same URL the tests hardcode in src/test/integration/shared.ts.
  • The service entrypoint mirrors .devcontainer/docker-compose.yaml exactly: docker-setup.sh → forgejo migrate → create the test-bot user (the credentials from src/test/integration/forgejo.env) → forgejo web.
  • src/test/integration/setup.ts already waits for /api/healthz and seeds the repo deterministically, so no extra provisioning step is needed.
  • No published ports: the job container uses the internal service network, so concurrent PRs on the same runner can't collide on port 3000.

Checks

pnpm check / lint:check / format:check ✅, pnpm test:unit 34/34 ✅. The integration job itself can't run from this environment (no Forgejo instance here) — it needs the runner, which is exactly what this workflow provides.

⚠️ One thing to verify on the runner: the options: entrypoint override for the service (--entrypoint sh -c "..."). It's the same entrypoint the devcontainer uses, but if act_runner mangles the quoted string, the fallback is a root docker-compose.test.yaml + docker compose up step on the runner. Happy to switch if it misbehaves.

Adds the missing Forgejo workflow files to run the test suite in CI, plus a small fix so `pnpm test` actually exists (the README already references it). ## What's in it - **`.forgejo/workflows/test.yaml`** — runs on every PR to `main`: - **unit** job on `srv-generic` (same `ci-pnpm` container as the other checks): `pnpm test:unit` - **integration** job on `srv-home` with a `services:` Forgejo instance (pinned `16.0.3-rootless`, same image as the devcontainer): `pnpm test:integration` - **`package.json`** — adds the `test` script (`pnpm test:unit`) that the README's Testing section already documents. ## How the integration job works - The Forgejo service container is started via the `services:` keyword (act_runner supports it like GitHub Actions); the job container reaches it at `http://forgejo:3000` on the shared job network — the same URL the tests hardcode in `src/test/integration/shared.ts`. - The service entrypoint mirrors `.devcontainer/docker-compose.yaml` exactly: `docker-setup.sh` → `forgejo migrate` → create the `test-bot` user (the credentials from `src/test/integration/forgejo.env`) → `forgejo web`. - `src/test/integration/setup.ts` already waits for `/api/healthz` and seeds the repo deterministically, so no extra provisioning step is needed. - No published ports: the job container uses the internal service network, so concurrent PRs on the same runner can't collide on port 3000. ## Checks `pnpm check` / `lint:check` / `format:check` ✅, `pnpm test:unit` 34/34 ✅. The integration job itself can't run from this environment (no Forgejo instance here) — it needs the runner, which is exactly what this workflow provides. ⚠️ One thing to verify on the runner: the `options:` entrypoint override for the service (`--entrypoint sh -c "..."`). It's the same entrypoint the devcontainer uses, but if act_runner mangles the quoted string, the fallback is a root `docker-compose.test.yaml` + `docker compose up` step on the runner. Happy to switch if it misbehaves.
ci: add test workflow
Some checks failed
check-commitizen.yaml / Check the PR title (pull_request) Successful in 1s
check-formatter.yaml / Checks with formatters (pull_request) Successful in 4s
check-prettier.yaml / Check files formatting (pull_request) Successful in 3s
check-linter.yaml / Checks with linters (pull_request) Successful in 8s
check-yamllint.yaml / Lint yaml files (pull_request) Successful in 1s
test.yaml / Run unit tests (pull_request) Successful in 6s
check-syntax.yaml / Checks with static tools (pull_request) Successful in 11s
forgejo-agent / LLM Bot response generation (pull_request) Successful in 2s
test.yaml / Run integration tests (pull_request) Failing after 0s
e242860cff
chore: separate files
Some checks failed
check-formatter.yaml / Checks with formatters (pull_request) Successful in 7s
check-linter.yaml / Checks with linters (pull_request) Successful in 9s
check-prettier.yaml / Check files formatting (pull_request) Successful in 3s
check-syntax.yaml / Checks with static tools (pull_request) Successful in 7s
check-test-unit.yaml / Run unit tests (pull_request) Successful in 7s
check-yamllint.yaml / Lint yaml files (pull_request) Failing after 1s
check-test-integration.yaml / Run integration tests (pull_request) Failing after 19s
07ea1b67ab
chore: fix job
Some checks failed
check-formatter.yaml / Checks with formatters (pull_request) Successful in 7s
check-linter.yaml / Checks with linters (pull_request) Successful in 8s
check-prettier.yaml / Check files formatting (pull_request) Successful in 3s
check-syntax.yaml / Checks with static tools (pull_request) Successful in 7s
check-test-integration.yaml / Run integration tests (pull_request) Failing after 11s
check-test-unit.yaml / Run unit tests (pull_request) Successful in 7s
check-yamllint.yaml / Lint yaml files (pull_request) Successful in 3s
7a241fd9ec
chore: fix job
Some checks failed
check-formatter.yaml / Checks with formatters (pull_request) Successful in 4s
check-prettier.yaml / Check files formatting (pull_request) Successful in 1s
check-linter.yaml / Checks with linters (pull_request) Successful in 11s
check-syntax.yaml / Checks with static tools (pull_request) Successful in 7s
check-test-unit.yaml / Run unit tests (pull_request) Successful in 7s
check-yamllint.yaml / Lint yaml files (pull_request) Successful in 1s
check-test-integration.yaml / Run integration tests (pull_request) Failing after 12s
d079dfb55a
chore: fix job
Some checks failed
check-test-integration.yaml / chore: fix job (push) Failing after 0s
check-test-integration.yaml / chore: fix job (pull_request) Failing after 0s
check-formatter.yaml / Checks with formatters (pull_request) Successful in 7s
check-linter.yaml / Checks with linters (pull_request) Successful in 8s
check-prettier.yaml / Check files formatting (pull_request) Failing after 3s
check-syntax.yaml / Checks with static tools (pull_request) Successful in 7s
check-yamllint.yaml / Lint yaml files (pull_request) Successful in 1s
check-test-unit.yaml / Run unit tests (pull_request) Successful in 10s
2c5d444f76
chore: fix job
Some checks failed
check-formatter.yaml / Checks with formatters (pull_request) Successful in 7s
check-linter.yaml / Checks with linters (pull_request) Successful in 8s
check-prettier.yaml / Check files formatting (pull_request) Successful in 3s
check-syntax.yaml / Checks with static tools (pull_request) Successful in 7s
check-test-unit.yaml / Run unit tests (pull_request) Successful in 7s
check-yamllint.yaml / Lint yaml files (pull_request) Successful in 1s
check-test-integration.yaml / Run integration tests (pull_request) Has been cancelled
6d04d02815
chore: fix job
Some checks failed
check-formatter.yaml / Checks with formatters (pull_request) Successful in 5s
check-prettier.yaml / Check files formatting (pull_request) Failing after 1s
check-linter.yaml / Checks with linters (pull_request) Successful in 10s
check-syntax.yaml / Checks with static tools (pull_request) Successful in 7s
check-test-unit.yaml / Run unit tests (pull_request) Successful in 7s
check-yamllint.yaml / Lint yaml files (pull_request) Successful in 1s
check-test-integration.yaml / Run integration tests (pull_request) Has been cancelled
769c2b1bd2
chore: fix job
Some checks failed
check-formatter.yaml / Checks with formatters (pull_request) Successful in 4s
check-prettier.yaml / Check files formatting (pull_request) Failing after 1s
check-linter.yaml / Checks with linters (pull_request) Successful in 11s
check-syntax.yaml / Checks with static tools (pull_request) Successful in 7s
check-test-unit.yaml / Run unit tests (pull_request) Successful in 7s
check-yamllint.yaml / Lint yaml files (pull_request) Failing after 1s
check-test-integration.yaml / Run integration tests (pull_request) Has been cancelled
a351a6bb24
chore: fix job
Some checks failed
check-formatter.yaml / Checks with formatters (pull_request) Successful in 4s
check-prettier.yaml / Check files formatting (pull_request) Successful in 1s
check-linter.yaml / Checks with linters (pull_request) Successful in 12s
check-syntax.yaml / Checks with static tools (pull_request) Successful in 7s
check-test-unit.yaml / Run unit tests (pull_request) Successful in 11s
check-yamllint.yaml / Lint yaml files (pull_request) Failing after 3s
check-test-integration.yaml / Run integration tests (pull_request) Has been cancelled
7c97598eae
chore: fix job
Some checks failed
check-formatter.yaml / Checks with formatters (pull_request) Successful in 7s
check-prettier.yaml / Check files formatting (pull_request) Successful in 3s
check-linter.yaml / Checks with linters (pull_request) Successful in 9s
check-syntax.yaml / Checks with static tools (pull_request) Successful in 10s
check-test-unit.yaml / Run unit tests (pull_request) Successful in 10s
check-yamllint.yaml / Lint yaml files (pull_request) Successful in 2s
check-test-integration.yaml / Run integration tests (pull_request) Has been cancelled
584dc0e944
chore: try custom image
All checks were successful
check-formatter.yaml / Checks with formatters (pull_request) Successful in 4s
check-prettier.yaml / Check files formatting (pull_request) Successful in 2s
check-linter.yaml / Checks with linters (pull_request) Successful in 13s
check-syntax.yaml / Checks with static tools (pull_request) Successful in 7s
check-test-unit.yaml / Run unit tests (pull_request) Successful in 7s
check-yamllint.yaml / Lint yaml files (pull_request) Successful in 1s
check-test-integration.yaml / Run integration tests (pull_request) Successful in 39s
1ac93a2946
Owner

Waiting on https://code.forgejo.org/forgejo/runner/issues/1738 to make the forgejo entrypoint work in the action service.

Waiting on https://code.forgejo.org/forgejo/runner/issues/1738 to make the forgejo entrypoint work in the action service.
Merge remote-tracking branch 'origin/main' into ci/add-test-workflow
Some checks failed
check-formatter.yaml / Checks with formatters (pull_request) Successful in 8s
check-prettier.yaml / Check files formatting (pull_request) Successful in 2s
check-linter.yaml / Checks with linters (pull_request) Successful in 17s
check-syntax.yaml / Checks with static tools (pull_request) Successful in 11s
check-test-unit.yaml / Run unit tests (pull_request) Successful in 9s
check-yamllint.yaml / Lint yaml files (pull_request) Successful in 2s
check-test-integration.yaml / Run integration tests (pull_request) Failing after 16s
713c86d423
Some checks failed
check-formatter.yaml / Checks with formatters (pull_request) Successful in 8s
Required
Details
check-prettier.yaml / Check files formatting (pull_request) Successful in 2s
Required
Details
check-linter.yaml / Checks with linters (pull_request) Successful in 17s
Required
Details
check-syntax.yaml / Checks with static tools (pull_request) Successful in 11s
Required
Details
check-test-unit.yaml / Run unit tests (pull_request) Successful in 9s
check-yamllint.yaml / Lint yaml files (pull_request) Successful in 2s
Required
Details
check-test-integration.yaml / Run integration tests (pull_request) Failing after 16s
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin "ci/add-test-workflow:ci/add-test-workflow"
git switch "ci/add-test-workflow"
Sign in to join this conversation.
No reviewers
No milestone
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
projects/forgejo-agent!275
No description provided.