vibetunnel/.github/workflows/sea-build-test.yml
2025-06-26 23:10:05 +02:00

234 lines
No EOL
7.7 KiB
YAML

name: SEA Build Test
on:
push:
branches: [ main ]
paths:
- 'web/**'
- '.github/workflows/sea-build-test.yml'
pull_request:
branches: [ main ]
paths:
- 'web/**'
- '.github/workflows/sea-build-test.yml'
workflow_dispatch:
inputs:
node_version:
description: 'Node.js version to build'
required: false
default: '24.2.0'
type: string
env:
NODE_VERSION: ${{ github.event.inputs.node_version || '24.2.0' }}
CUSTOM_NODE_CACHE_KEY: custom-node-linux-x64
jobs:
build-custom-node:
name: Build Custom Node.js
# DISABLED: Custom Node.js compilation temporarily disabled
if: false
runs-on: blacksmith-32vcpu-ubuntu-2404-arm
outputs:
cache-hit: ${{ steps.cache-custom-node.outputs.cache-hit }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup build dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential \
python3 \
ninja-build \
ccache \
libpam0g-dev
- name: Cache custom Node.js build (Blacksmith)
id: cache-custom-node
uses: useblacksmith/cache@v1
with:
path: |
web/.node-builds/node-v${{ env.NODE_VERSION }}-minimal
key: ${{ env.CUSTOM_NODE_CACHE_KEY }}-v${{ env.NODE_VERSION }}-${{ hashFiles('web/build-custom-node.js') }}
restore-keys: |
${{ env.CUSTOM_NODE_CACHE_KEY }}-v${{ env.NODE_VERSION }}-
- name: Build custom Node.js
if: steps.cache-custom-node.outputs.cache-hit != 'true'
working-directory: web
run: |
node build-custom-node.js --version=${{ env.NODE_VERSION }}
test-sea-build:
name: Test SEA Build
# DISABLED: Removed dependency on build-custom-node since it's disabled
# needs: build-custom-node
runs-on: blacksmith-8vcpu-ubuntu-2404-arm
strategy:
matrix:
# DISABLED: Only testing with system Node.js, custom disabled
node-type: [system] # was: [system, custom]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.12.1
- name: Setup Node.js (system)
if: matrix.node-type == 'system'
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
cache-dependency-path: 'web/pnpm-lock.yaml'
- name: Restore custom Node.js from cache (Blacksmith)
if: matrix.node-type == 'custom'
id: restore-custom-node
uses: useblacksmith/cache@v1
with:
path: |
web/.node-builds/node-v${{ env.NODE_VERSION }}-minimal
key: ${{ env.CUSTOM_NODE_CACHE_KEY }}-v${{ env.NODE_VERSION }}-${{ hashFiles('web/build-custom-node.js') }}
restore-keys: |
${{ env.CUSTOM_NODE_CACHE_KEY }}-v${{ env.NODE_VERSION }}-
- name: Build custom Node.js if not cached
# DISABLED: Custom Node.js compilation temporarily disabled
if: false && matrix.node-type == 'custom' && steps.restore-custom-node.outputs.cache-hit != 'true'
working-directory: web
run: |
echo "Custom Node.js not found in cache, building..."
node build-custom-node.js --version=${{ env.NODE_VERSION }}
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libpam0g-dev
- name: Install dependencies
working-directory: web
run: |
pnpm install --frozen-lockfile
- name: Build SEA executable (system Node.js)
if: matrix.node-type == 'system'
working-directory: web
run: |
echo "Building SEA with system Node.js..."
node --version
node build-native.js
- name: Build SEA executable (custom Node.js)
# DISABLED: Custom Node.js test temporarily disabled
if: false && matrix.node-type == 'custom'
working-directory: web
run: |
# Use auto-discovery since we know the custom Node.js is in .node-builds
echo "Building SEA with custom Node.js (auto-discovery)..."
node build-native.js --custom-node
- name: Test SEA executable
working-directory: web
run: |
echo "Testing SEA executable..."
./native/vibetunnel --version || true
# Basic smoke test - check if it starts
timeout 5s ./native/vibetunnel --help || true
# Check binary size
ls -lh native/
size_mb=$(du -m native/vibetunnel | cut -f1)
echo "SEA executable size: ${size_mb} MB"
# Ensure native modules are present
test -f native/pty.node || (echo "ERROR: pty.node not found" && exit 1)
test -f native/authenticate_pam.node || (echo "ERROR: authenticate_pam.node not found" && exit 1)
# spawn-helper is only needed on macOS
if [[ "$RUNNER_OS" == "macOS" ]]; then
test -f native/spawn-helper || (echo "ERROR: spawn-helper not found" && exit 1)
fi
- name: Upload SEA artifacts
uses: actions/upload-artifact@v4
with:
name: sea-build-${{ matrix.node-type }}-linux
path: |
web/native/
retention-days: 7
# Test on standard GitHub runners for comparison
test-github-runners:
name: Test on GitHub Runners
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup build dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential \
python3 \
ninja-build \
ccache \
libpam0g-dev
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.12.1
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
cache-dependency-path: 'web/pnpm-lock.yaml'
- name: Cache custom Node.js build
uses: actions/cache@v4
with:
path: |
web/.node-builds/node-v${{ env.NODE_VERSION }}-minimal
key: blacksmith-${{ env.CUSTOM_NODE_CACHE_KEY }}-v${{ env.NODE_VERSION }}-${{ hashFiles('web/build-custom-node.js') }}
restore-keys: |
blacksmith-${{ env.CUSTOM_NODE_CACHE_KEY }}-v${{ env.NODE_VERSION }}-
- name: Build and test everything
working-directory: web
run: |
# Install dependencies
pnpm install --frozen-lockfile
# Build custom Node.js if not cached
# DISABLED: Custom Node.js compilation temporarily disabled
# if [ ! -f ".node-builds/node-v${NODE_VERSION}-minimal/out/Release/node" ]; then
# node build-custom-node.js --version=${NODE_VERSION}
# fi
# Test both builds
echo "=== Testing with system Node.js ==="
node build-native.js
./native/vibetunnel --version || true
# DISABLED: Custom Node.js test temporarily disabled
# echo "=== Testing with custom Node.js ==="
# CUSTOM_NODE=".node-builds/node-v${NODE_VERSION}-minimal/out/Release/node"
# node build-native.js --custom-node="${CUSTOM_NODE}"
# ./native/vibetunnel --version || true
- name: Compare sizes
working-directory: web
run: |
echo "Binary sizes comparison:"
ls -lh native/vibetunnel
echo "System Node.js based: $(du -h native/vibetunnel | cut -f1)"