Files
app/scripts/test-ci-locally.sh
Albert 9df7278d55 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>
2025-11-10 14:10:42 +00:00

63 lines
2.3 KiB
Bash
Executable File

#!/bin/bash
# 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
echo "========================================="
echo "Testing Gitea Actions Workflow Locally"
echo "========================================="
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# Check if .env exists
if [ ! -f .env ]; then
echo -e "${RED}Error: .env file not found!${NC}"
echo "Please create .env file with required variables"
exit 1
fi
# Load environment variables from .env for passing as secrets
echo -e "${YELLOW}Loading environment variables from .env${NC}"
export $(cat .env | grep -v '^#' | xargs)
# 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"
SECRET_FLAGS="$SECRET_FLAGS -s ATPROTO_REDIRECT_URI=$ATPROTO_REDIRECT_URI"
SECRET_FLAGS="$SECRET_FLAGS -s GOOGLE_API_KEY=$GOOGLE_API_KEY"
SECRET_FLAGS="$SECRET_FLAGS -s DEEPGRAM_API_KEY=$DEEPGRAM_API_KEY"
SECRET_FLAGS="$SECRET_FLAGS -s SURREAL_JWT_SECRET=$SURREAL_JWT_SECRET"
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 (nektos/act)${NC}"
echo -e "${YELLOW}This will execute .gitea/workflows/magnitude.yml${NC}"
# 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 \
nektos/act:latest \
-W .gitea/workflows/magnitude.yml \
$SECRET_FLAGS || {
echo -e "${RED}Workflow execution failed!${NC}"
exit 1
}
echo -e "${GREEN}=========================================${NC}"
echo -e "${GREEN}Workflow executed successfully!${NC}"
echo -e "${GREEN}=========================================${NC}"