-
Notifications
You must be signed in to change notification settings - Fork 43
154 lines (132 loc) · 4.4 KB
/
package-validation.yml
File metadata and controls
154 lines (132 loc) · 4.4 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
name: Package Validation
on:
push:
branches: [main]
pull_request:
branches: [main]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
validate:
name: Build & Validate
runs-on: ubuntu-latest
env:
NPM_CONFIG_FUND: false
TURBO_TELEMETRY_DISABLED: 1
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
# Cache node_modules - skip npm ci entirely if unchanged
- name: Cache node_modules
id: cache-modules
uses: actions/cache@v4
with:
path: node_modules
key: modules-${{ hashFiles('package-lock.json') }}
- name: Install dependencies
if: steps.cache-modules.outputs.cache-hit != 'true'
run: npm ci
# Cache turbo build outputs for incremental builds
- name: Cache turbo
uses: actions/cache@v4
with:
path: .turbo
key: turbo-${{ github.sha }}
restore-keys: turbo-
# Cache package dist directories
- name: Cache package builds
uses: actions/cache@v4
with:
path: |
packages/*/dist
dist
key: dist-${{ hashFiles('packages/*/src/**', 'src/**', 'tsconfig.json') }}
- name: Build packages
run: npm run build
- name: Audit bundled dependencies
run: |
echo "=== Auditing bundled package dependencies ==="
node scripts/audit-bundled-deps.mjs
- name: Validate all
run: |
echo "=== Validating packages ==="
ERRORS=0
# Check dist files exist
for pkg_dir in packages/*/; do
pkg_name=$(basename "$pkg_dir")
if [ ! -f "$pkg_dir/dist/index.js" ] || [ ! -f "$pkg_dir/dist/index.d.ts" ]; then
echo "✗ $pkg_name - missing dist files"
ERRORS=$((ERRORS + 1))
else
echo "✓ $pkg_name"
fi
done
[ $ERRORS -gt 0 ] && exit 1
echo ""
echo "=== Testing key imports ==="
node --eval "
const packages = [
'@agent-relay/protocol',
'@agent-relay/config',
'@agent-relay/daemon',
'@agent-relay/wrapper',
'@agent-relay/bridge',
'@agent-relay/sdk',
];
(async () => {
let errors = 0;
for (const pkg of packages) {
try {
await import(pkg);
console.log('✓', pkg);
} catch (e) {
console.error('✗', pkg, '-', e.message);
errors++;
}
}
if (errors) process.exit(1);
})();
"
echo ""
echo "=== Testing main package ==="
node --eval "
import('./dist/src/index.js').then(m => {
const required = ['Daemon', 'Connection', 'BaseWrapper', 'PROTOCOL_VERSION'];
const missing = required.filter(r => !(r in m));
if (missing.length) {
console.error('Missing exports:', missing);
process.exit(1);
}
console.log('✓ Main package exports OK');
});
"
echo ""
echo "SUCCESS: All validations passed"
- name: Test CLI startup
run: |
echo "=== Testing CLI daemon ==="
# Start daemon in background (no dashboard, just socket server)
timeout 30 node dist/src/cli/index.js up &
DAEMON_PID=$!
# Wait for socket to be created
SOCKET_PATH=".agent-relay/relay.sock"
for i in {1..15}; do
[ -S "$SOCKET_PATH" ] && break
sleep 1
done
# Verify socket exists and daemon is running
if [ -S "$SOCKET_PATH" ]; then
echo "✓ Daemon socket created"
# Use CLI status to verify daemon is responsive
AGENT_RELAY_SKIP_TMUX=1 node dist/src/cli/index.js status | grep -q "RUNNING" && echo "✓ Daemon responding" || echo "⚠ Daemon not responding (may be expected)"
else
echo "✗ Daemon socket not found"
exit 1
fi
# Cleanup
kill $DAEMON_PID 2>/dev/null || true