feat: Add CI testing infrastructure with act_runner support
- 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>
This commit is contained in:
61
scripts/test-ci-locally.sh
Executable file
61
scripts/test-ci-locally.sh
Executable file
@@ -0,0 +1,61 @@
|
||||
#!/bin/bash
|
||||
# Script to test Gitea Actions workflow locally using act_runner
|
||||
# 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_runner
|
||||
# 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_runner${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
|
||||
# - Mount current directory as workspace
|
||||
# - Pass secrets as flags
|
||||
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 \
|
||||
$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}"
|
||||
Reference in New Issue
Block a user