-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup-test-runner.sh
More file actions
executable file
·120 lines (106 loc) · 2.99 KB
/
Copy pathsetup-test-runner.sh
File metadata and controls
executable file
·120 lines (106 loc) · 2.99 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#!/bin/bash
# Setup script for self-hosted GitHub Actions runner for saidata testing
set -e
echo "🔧 Setting up self-hosted GitHub Actions runner for saidata testing"
echo ""
# Check if running as root
if [ "$EUID" -eq 0 ]; then
echo "⚠️ Please don't run this script as root"
exit 1
fi
# Detect OS
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
ARCH=$(uname -m)
echo "Detected OS: $OS"
echo "Detected Architecture: $ARCH"
echo ""
# Install dependencies based on OS
echo "📦 Installing dependencies..."
case "$OS" in
linux)
if command -v apt-get &> /dev/null; then
sudo apt-get update
sudo apt-get install -y python3 python3-pip curl jq
elif command -v dnf &> /dev/null; then
sudo dnf install -y python3 python3-pip curl jq
elif command -v yum &> /dev/null; then
sudo yum install -y python3 python3-pip curl jq
else
echo "❌ Unsupported package manager"
exit 1
fi
;;
darwin)
if ! command -v brew &> /dev/null; then
echo "❌ Homebrew not found. Please install it first: https://brew.sh"
exit 1
fi
brew install python3 curl jq
;;
*)
echo "❌ Unsupported OS: $OS"
exit 1
;;
esac
# Install saigen
echo ""
echo "📦 Installing saigen..."
pip3 install --user saigen
# Verify installation
if ! command -v saigen &> /dev/null; then
echo "⚠️ saigen not found in PATH. You may need to add ~/.local/bin to your PATH"
echo "Add this to your ~/.bashrc or ~/.zshrc:"
echo " export PATH=\"\$HOME/.local/bin:\$PATH\""
fi
# Download GitHub Actions runner
echo ""
echo "📥 Downloading GitHub Actions runner..."
RUNNER_VERSION="2.311.0"
RUNNER_DIR="$HOME/actions-runner"
mkdir -p "$RUNNER_DIR"
cd "$RUNNER_DIR"
case "$OS-$ARCH" in
linux-x86_64)
RUNNER_FILE="actions-runner-linux-x64-${RUNNER_VERSION}.tar.gz"
;;
linux-aarch64)
RUNNER_FILE="actions-runner-linux-arm64-${RUNNER_VERSION}.tar.gz"
;;
darwin-x86_64)
RUNNER_FILE="actions-runner-osx-x64-${RUNNER_VERSION}.tar.gz"
;;
darwin-arm64)
RUNNER_FILE="actions-runner-osx-arm64-${RUNNER_VERSION}.tar.gz"
;;
*)
echo "❌ Unsupported platform: $OS-$ARCH"
exit 1
;;
esac
if [ ! -f "$RUNNER_FILE" ]; then
curl -o "$RUNNER_FILE" -L "https://github.com/actions/runner/releases/download/v${RUNNER_VERSION}/${RUNNER_FILE}"
tar xzf "$RUNNER_FILE"
fi
echo ""
echo "✅ Setup complete!"
echo ""
echo "Next steps:"
echo "1. Go to your saidata repository on GitHub"
echo "2. Navigate to Settings > Actions > Runners"
echo "3. Click 'New self-hosted runner'"
echo "4. Follow the instructions to configure the runner"
echo "5. Use these labels: self-hosted, $OS, bare-metal"
echo ""
echo "To configure the runner, run:"
echo " cd $RUNNER_DIR"
echo " ./config.sh --url https://github.com/example42/saidata --token YOUR_TOKEN"
echo ""
echo "To start the runner:"
echo " cd $RUNNER_DIR"
echo " ./run.sh"
echo ""
echo "To install as a service (Linux):"
echo " cd $RUNNER_DIR"
echo " sudo ./svc.sh install"
echo " sudo ./svc.sh start"
echo ""