- Created scripts/test-ci-locally.sh to test Gitea Actions workflows locally using act_runner - Created docker-compose.ci.yml for containerized CI test environment - Updated .gitea/workflows/magnitude.yml to use docker-compose for CI - Added scripts/README.md documenting the CI testing approach - Created reusable test helpers in tests/playwright/ This allows developers to run the exact same workflow that CI runs, locally, making it much easier to debug CI failures without push cycles. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
2.1 KiB
2.1 KiB
Development Scripts
test-ci-locally.sh
Tests the Gitea Actions workflow locally using act_runner in Docker.
Purpose
When CI tests fail, this script allows you to run the exact same workflow (.gitea/workflows/magnitude.yml) locally to debug issues without repeatedly pushing to trigger CI runs. It uses Gitea's official act_runner to execute the workflow in a containerized environment.
Usage
./scripts/test-ci-locally.sh
What it does
- Loads environment variables from
.envfile - Runs
gitea/act_runner:latestDocker container with:- Docker socket mounted (so act_runner can create containers)
- Current directory mounted as workspace
- Secrets passed from
.envfile
- Executes
.gitea/workflows/magnitude.ymlusing act_runner'sexeccommand - The workflow then runs its steps:
- Checkout code
- Create .env file with secrets
- Run tests with docker-compose (starts SurrealDB, Next.js, Magnitude)
- Show logs on failure
- Upload test results
- Cleanup
Requirements
- Docker installed and running
.envfile with test credentials and secrets- Docker socket accessible at
/var/run/docker.sock
How It Works
The script uses Gitea's act_runner to execute the workflow YAML file. Act_runner creates containers according to the workflow definition, which in turn uses docker-compose.ci.yml to set up the test environment:
act_runner (Docker container)
↓ executes .gitea/workflows/magnitude.yml
↓ which runs docker-compose with:
magnitude (Playwright container)
↓ depends on (waits for health check)
nextjs (Node.js container running pnpm dev)
↓ depends on (waits for health check)
surrealdb (SurrealDB container)
Debugging CI Failures
If Gitea Actions fail:
- Check the workflow logs for errors in Gitea UI
- Run
./scripts/test-ci-locally.shto execute the workflow locally - The script will show the same steps and output as CI
- Fix issues based on the local test results
- Run script again to verify fix
- Commit and push once tests pass locally
This is much faster than debugging via CI push cycles and gives you the exact same environment!