Skip to content

Integration tests and clean up of zed and parsing #516

Integration tests and clean up of zed and parsing

Integration tests and clean up of zed and parsing #516

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