Files
next.orly.dev/scripts/test-workflow-act.sh
mleku 2614b51068
Some checks failed
Go / build (push) Has been cancelled
Go / release (push) Has been cancelled
Refactor crypto package to use p256k1 signer
- Replaced the p256k package with p256k1.mleku.dev/signer across the codebase, updating all instances where the previous signer was utilized.
- Removed the deprecated p256k package, including all related files and tests, to streamline the codebase and improve maintainability.
- Updated various components, including event handling, database interactions, and protocol implementations, to ensure compatibility with the new signer interface.
- Enhanced tests to validate the new signing functionality and ensure robustness across the application.
- Bumped version to v0.23.3 to reflect these changes.
2025-11-03 10:21:31 +00:00

90 lines
3.1 KiB
Bash
Executable File

#!/usr/bin/env bash
# Run GitHub Actions workflow locally using act
# Usage: ./scripts/test-workflow-local.sh [job-name]
# job-name: optional, defaults to 'build'. Can be 'build' or 'release'
set -e
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
WORKFLOW_FILE="${SCRIPT_DIR}/../.github/workflows/go.yml"
JOB_NAME="${1:-build}"
# Check if act is installed
if ! command -v act >/dev/null 2>&1; then
echo "Error: 'act' is not installed"
echo "Install it with:"
echo " curl https://raw.githubusercontent.com/nektos/act/master/install.sh | sudo bash"
echo " # or on macOS: brew install act"
exit 1
fi
echo "=== Running GitHub Actions workflow locally ==="
echo "Workflow: .github/workflows/go.yml"
echo "Job: $JOB_NAME"
echo ""
case "$JOB_NAME" in
build)
echo "Running build job..."
act push --workflows "$WORKFLOW_FILE" --job build
;;
release)
echo "Running release job (simulating tag push)..."
# Simulate a tag push event with a valid tag format
# The workflow requires build to run first and succeed
echo "Step 1: Running build job (required dependency)..."
if ! act push --workflows "$WORKFLOW_FILE" --job build; then
echo "Error: Build job failed. Release job cannot proceed."
exit 1
fi
echo ""
echo "Step 2: Running release job..."
echo "Note: GitHub release creation may fail locally (no valid token), but binary building will be tested"
# Use a tag that matches the workflow pattern: v[0-9]+.[0-9]+.[0-9]+
# Provide a dummy GITHUB_TOKEN to prevent immediate failure
# The release won't actually be created, but the workflow will test binary building
# Temporarily disable exit on error to allow release step to fail gracefully
set +e
GITHUB_REF=refs/tags/v1.0.0 \
GITHUB_TOKEN=dummy_token_for_local_testing \
act push \
--workflows "$WORKFLOW_FILE" \
--job release \
--secret GITHUB_TOKEN=dummy_token_for_local_testing \
--eventpath /dev/stdin <<EOF
{
"ref": "refs/tags/v1.0.0",
"pusher": {"name": "test"},
"repository": {
"name": "next.orly.dev",
"full_name": "test/next.orly.dev"
},
"head_commit": {
"id": "test123"
}
}
EOF
RELEASE_EXIT_CODE=$?
set -e
# Check if binary building succeeded (exit code 0) or if only release creation failed
if [ $RELEASE_EXIT_CODE -eq 0 ]; then
echo "✓ Release job completed successfully (including binary building)"
else
echo "⚠ Release job completed with errors (likely GitHub release creation failed)"
echo " This is expected in local testing. Binary building should have succeeded."
echo " Check the output above to verify 'Build Release Binaries' step succeeded."
fi
;;
*)
echo "Error: Unknown job '$JOB_NAME'"
echo "Valid jobs: build, release"
exit 1
;;
esac
echo ""
echo "=== Workflow completed ==="