fix: Use nektos/act instead of gitea/act_runner for local testing

gitea/act_runner is a runner daemon that needs to connect to a Gitea instance,
not a local testing tool. nektos/act is the correct tool for running workflows
locally, and it's compatible with both GitHub Actions and Gitea Actions.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-10 14:10:42 +00:00
parent a8da8753f1
commit 9df7278d55
2 changed files with 22 additions and 15 deletions

View File

@@ -2,11 +2,11 @@
## test-ci-locally.sh
Tests the Gitea Actions workflow locally using `act_runner` in Docker.
Tests the Gitea Actions workflow locally using `act` (nektos/act) 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.
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 `nektos/act` to execute the workflow in a containerized environment, just like GitHub Actions or Gitea Actions would.
### Usage
@@ -17,11 +17,11 @@ When CI tests fail, this script allows you to run the **exact same workflow** (`
### What it does
1. Loads environment variables from `.env` file
2. Runs `gitea/act_runner:latest` Docker container with:
- Docker socket mounted (so act_runner can create containers)
2. Runs `nektos/act:latest` Docker container with:
- Docker socket mounted (so act can create containers)
- Current directory mounted as workspace
- Secrets passed from `.env` file
3. Executes `.gitea/workflows/magnitude.yml` using act_runner's `exec` command
3. Executes `.gitea/workflows/magnitude.yml` using act
4. The workflow then runs its steps:
- Checkout code
- Create .env file with secrets
@@ -38,10 +38,10 @@ When CI tests fail, this script allows you to run the **exact same workflow** (`
### 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:
The script uses `nektos/act` to execute the workflow YAML file. Act is compatible with both GitHub Actions and Gitea Actions workflows. It 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)
act (nektos/act Docker container)
↓ executes .gitea/workflows/magnitude.yml
↓ which runs docker-compose with:
magnitude (Playwright container)
@@ -51,6 +51,12 @@ nextjs (Node.js container running pnpm dev)
surrealdb (SurrealDB container)
```
### Note on nektos/act vs gitea/act_runner
- `nektos/act` is designed for local workflow testing and is compatible with both GitHub Actions and Gitea Actions
- `gitea/act_runner` is a runner daemon that needs to connect to a Gitea instance and is not designed for offline local testing
- This script uses `nektos/act` which provides the local testing experience similar to running workflows in CI
### Debugging CI Failures
If Gitea Actions fail:

View File

@@ -1,5 +1,5 @@
#!/bin/bash
# Script to test Gitea Actions workflow locally using act_runner
# Script to test Gitea Actions workflow locally using act (nektos/act)
# This runs the actual .gitea/workflows/magnitude.yml file in a containerized environment
set -e # Exit on error
@@ -25,7 +25,7 @@ fi
echo -e "${YELLOW}Loading environment variables from .env${NC}"
export $(cat .env | grep -v '^#' | xargs)
# Build secret flags for act_runner
# Build secret flags for act
# These will be available in the workflow as secrets.*
SECRET_FLAGS=""
SECRET_FLAGS="$SECRET_FLAGS -s ATPROTO_CLIENT_ID=$ATPROTO_CLIENT_ID"
@@ -37,20 +37,21 @@ SECRET_FLAGS="$SECRET_FLAGS -s TEST_BLUESKY_HANDLE=$TEST_BLUESKY_HANDLE"
SECRET_FLAGS="$SECRET_FLAGS -s TEST_BLUESKY_PASSWORD=$TEST_BLUESKY_PASSWORD"
SECRET_FLAGS="$SECRET_FLAGS -s ANTHROPIC_API_KEY=$ANTHROPIC_API_KEY"
echo -e "${YELLOW}Running Gitea Actions workflow with act_runner${NC}"
echo -e "${YELLOW}Running Gitea Actions workflow with act (nektos/act)${NC}"
echo -e "${YELLOW}This will execute .gitea/workflows/magnitude.yml${NC}"
# Run act_runner in Docker to execute the workflow
# - Mount Docker socket so act_runner can create containers
# Run act in Docker to execute the workflow
# - Mount Docker socket so act can create containers
# - Mount current directory as workspace
# - Pass secrets as flags
# - Use -W flag to specify workflow file
# - Use --rm to clean up container after run
docker run --rm \
-v /var/run/docker.sock:/var/run/docker.sock \
-v "$(pwd):/workspace" \
-w /workspace \
-e ACTIONS_CACHE_URL="" \
gitea/act_runner:latest \
exec -W .gitea/workflows/magnitude.yml \
nektos/act:latest \
-W .gitea/workflows/magnitude.yml \
$SECRET_FLAGS || {
echo -e "${RED}Workflow execution failed!${NC}"
exit 1