-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-locally.sh
More file actions
executable file
·44 lines (38 loc) · 1.19 KB
/
test-locally.sh
File metadata and controls
executable file
·44 lines (38 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env bash
# Test GitHub Actions workflows locally using act
# Usage: ./test-locally.sh [workflow] [job]
# Example: ./test-locally.sh pr-checks android-quick-smoke
set -euo pipefail
# Check if act is available
if ! command -v act &> /dev/null; then
echo "Error: act is not installed"
echo "Install via devbox: devbox shell"
echo "Or install directly: https://github.com/nektos/act"
exit 1
fi
# Default values
WORKFLOW="${1:-pr-checks}"
JOB="${2:-}"
# Validate workflow file exists
WORKFLOW_FILE=".github/workflows/${WORKFLOW}.yml"
if [ ! -f "$WORKFLOW_FILE" ]; then
echo "Error: Workflow file not found: $WORKFLOW_FILE"
echo "Available workflows:"
ls .github/workflows/*.yml | xargs -n1 basename | sed 's/\.yml$//'
exit 1
fi
echo "Testing workflow: $WORKFLOW_FILE"
echo "================================"
echo ""
# If job specified, run specific job
if [ -n "$JOB" ]; then
echo "Running job: $JOB"
echo ""
act -W "$WORKFLOW_FILE" -j "$JOB" --container-architecture linux/amd64
else
# List available jobs
echo "Available jobs in $WORKFLOW:"
act -W "$WORKFLOW_FILE" -l
echo ""
echo "To run a specific job, use: $0 $WORKFLOW <job-name>"
fi