-
Notifications
You must be signed in to change notification settings - Fork 43
165 lines (139 loc) · 5.12 KB
/
e2e-tests.yml
File metadata and controls
165 lines (139 loc) · 5.12 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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
name: E2E Tests
on:
push:
branches: [main]
paths:
- 'src/**'
- 'packages/**'
- 'relay-pty/**'
- 'scripts/e2e-test.sh'
- 'package.json'
- '.github/workflows/e2e-tests.yml'
pull_request:
branches: [main]
paths:
- 'src/**'
- 'packages/**'
- 'relay-pty/**'
- 'scripts/e2e-test.sh'
- 'package.json'
- '.github/workflows/e2e-tests.yml'
# Allow manual trigger for on-demand testing
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
e2e-test:
name: E2E Integration Test
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
node-version: [20]
fail-fast: false
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache Cargo dependencies
uses: Swatinem/rust-cache@v2
with:
workspaces: relay-pty
- name: Install dependencies
run: npm ci
- name: Ensure rollup optional dependencies are installed
run: npm install --no-save rollup || true
- name: Build project
run: npm run build
- name: Link CLI for local testing
run: npm link
- name: Verify CLI is available
run: agent-relay --version
- name: Cache Claude CLI
id: cache-claude
uses: actions/cache@v4
with:
path: ~/.npm-global
key: claude-cli-${{ runner.os }}-${{ hashFiles('.github/workflows/e2e-tests.yml') }}
- name: Install Claude CLI
if: steps.cache-claude.outputs.cache-hit != 'true'
run: |
mkdir -p ~/.npm-global
npm config set prefix '~/.npm-global'
npm install -g @anthropic-ai/claude-code
- name: Add Claude CLI to PATH
run: |
echo "$HOME/.npm-global/bin" >> $GITHUB_PATH
export PATH="$HOME/.npm-global/bin:$PATH"
claude --version || echo "Claude CLI ready"
- name: Download dashboard binary
run: |
# Determine platform and architecture
if [ "${{ runner.os }}" = "Linux" ]; then
BINARY_NAME="relay-dashboard-server-linux-x64"
elif [ "${{ runner.os }}" = "macOS" ]; then
# Check architecture
if [ "$(uname -m)" = "arm64" ]; then
BINARY_NAME="relay-dashboard-server-darwin-arm64"
else
BINARY_NAME="relay-dashboard-server-darwin-x64"
fi
else
echo "Unsupported OS: ${{ runner.os }}"
exit 1
fi
echo "Downloading dashboard binary: $BINARY_NAME"
# Get latest release from relay-dashboard repo
RELEASE_URL="https://github.com/AgentWorkforce/relay-dashboard/releases/latest/download/${BINARY_NAME}.gz"
echo "URL: $RELEASE_URL"
# Install to user local bin (no sudo required)
mkdir -p ~/.local/bin
curl -fsSL "$RELEASE_URL" | gunzip > ~/.local/bin/relay-dashboard-server
chmod +x ~/.local/bin/relay-dashboard-server
# Add to PATH for this workflow
echo "$HOME/.local/bin" >> $GITHUB_PATH
# Verify
echo "Installed dashboard binary:"
~/.local/bin/relay-dashboard-server --version || echo "Binary installed (version check may not be supported)"
- name: Check for API key
id: check-key
run: |
if [ -n "$ANTHROPIC_API_KEY" ]; then
echo "has_key=true" >> $GITHUB_OUTPUT
else
echo "has_key=false" >> $GITHUB_OUTPUT
echo "::warning::ANTHROPIC_API_KEY not set - Claude spawn test will be skipped"
fi
- name: Run E2E test
id: e2e-test
if: steps.check-key.outputs.has_key == 'true'
timeout-minutes: 5
run: ./scripts/e2e-test.sh --port 3888
- name: Run daemon-only test (no API key)
if: steps.check-key.outputs.has_key == 'false'
timeout-minutes: 2
run: ./scripts/e2e-test.sh --daemon-only --port 3888
- name: Test Summary
if: always()
run: |
echo "## E2E Test Results" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "- **OS:** ${{ matrix.os }}" >> $GITHUB_STEP_SUMMARY
echo "- **Node:** ${{ matrix.node-version }}" >> $GITHUB_STEP_SUMMARY
echo "- **API Key Present:** ${{ steps.check-key.outputs.has_key }}" >> $GITHUB_STEP_SUMMARY
if [ "${{ steps.e2e-test.outcome }}" == "success" ]; then
echo "- **Status:** Passed" >> $GITHUB_STEP_SUMMARY
elif [ "${{ steps.e2e-test.outcome }}" == "skipped" ]; then
echo "- **Status:** Skipped (no API key)" >> $GITHUB_STEP_SUMMARY
else
echo "- **Status:** Failed" >> $GITHUB_STEP_SUMMARY
fi