Skip to content

fix(stagewise): enhance shell session management by refining data han… #3219

fix(stagewise): enhance shell session management by refining data han…

fix(stagewise): enhance shell session management by refining data han… #3219

Workflow file for this run

name: CI
on:
push:
branches:
- '**'
paths:
- 'apps/browser/**'
- 'packages/**'
- 'agent/**'
- 'pnpm-lock.yaml'
- '.github/workflows/**'
- 'turbo.json'
- 'biome.json'
pull_request:
branches:
- main
- release-tests
paths:
- 'apps/browser/**'
- 'packages/**'
- 'agent/**'
- 'pnpm-lock.yaml'
- '.github/workflows/**'
- 'turbo.json'
- 'biome.json'
# Cancel in-progress runs for the same branch
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
# Lint - runs in parallel with build
lint:
name: Lint (Biome)
runs-on: ubuntu-latest
env:
NUCLEO_LICENSE_KEY: ${{ secrets.NUCLEO_LICENSE_KEY }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.30.3
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: 'pnpm'
- name: Install Dependencies
run: pnpm install --frozen-lockfile
- name: Run Biome Check
run: pnpm check
# Build - runs in parallel with lint
build:
name: Build Packages
runs-on: ubuntu-latest
env:
NUCLEO_LICENSE_KEY: ${{ secrets.NUCLEO_LICENSE_KEY }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.30.3
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: 'pnpm'
- name: Install Dependencies
run: pnpm install --frozen-lockfile
- name: Build All Packages
run: pnpm build
- name: Cache Build Artifacts
uses: actions/cache/save@v4
with:
path: |
packages/*/dist
agent/*/dist
apps/browser/dist
key: build-${{ github.sha }}
# Test - runs after build to use cached artifacts
test:
name: Unit Tests
needs: build
runs-on: ubuntu-latest
env:
NUCLEO_LICENSE_KEY: ${{ secrets.NUCLEO_LICENSE_KEY }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.30.3
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: 'pnpm'
- name: Install Dependencies
run: pnpm install --frozen-lockfile
- name: Restore Build Artifacts
uses: actions/cache/restore@v4
with:
path: |
packages/*/dist
agent/*/dist
apps/browser/dist
key: build-${{ github.sha }}
fail-on-cache-miss: true
- name: Run Tests
run: pnpm test
# Cross-platform unit tests - catches platform-specific bugs (e.g. path handling on Windows)
test-windows:
name: Unit Tests (Windows)
if: github.event_name == 'pull_request'
runs-on: windows-latest
env:
NUCLEO_LICENSE_KEY: ${{ secrets.NUCLEO_LICENSE_KEY }}
steps:
- name: Disable Windows Defender real-time monitoring
run: Set-MpPreference -DisableRealtimeMonitoring $true
shell: powershell
- name: Checkout
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.30.3
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: 'pnpm'
- name: Install Dependencies
run: pnpm install --frozen-lockfile
- name: Build All Packages
run: pnpm build
- name: Run Tests
run: pnpm test
# Cross-platform stagewise builds - only on PRs to main/release-tests
# Required for merge
build-stagewise:
name: Build Browser (${{ matrix.platform }})
if: github.event_name == 'pull_request'
needs: [lint, test]
environment: Dev
strategy:
fail-fast: false
matrix:
include:
- os: macos-26
platform: darwin-arm64
arch: arm64
- os: ubuntu-latest
platform: linux-x64
arch: x64
- os: windows-latest
platform: win32-x64
arch: x64
runs-on: ${{ matrix.os }}
env:
NODE_OPTIONS: "--max-old-space-size=8192"
NUCLEO_LICENSE_KEY: ${{ secrets.NUCLEO_LICENSE_KEY }}
POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }}
VITE_POSTHOG_API_KEY: ${{ secrets.VITE_POSTHOG_API_KEY }}
SUPABASE_URL: ${{ vars.SUPABASE_URL }}
SUPABASE_PUBLISHABLE_KEY: ${{ vars.SUPABASE_PUBLISHABLE_KEY }}
API_URL: ${{ vars.API_URL }}
VITE_API_URL: ${{ vars.VITE_API_URL }}
STAGEWISE_CONSOLE_URL: ${{ vars.STAGEWISE_CONSOLE_URL }}
VITE_STAGEWISE_CONSOLE_URL: ${{ vars.VITE_STAGEWISE_CONSOLE_URL }}
LLM_PROXY_URL: ${{ vars.LLM_PROXY_URL }}
VITE_DISABLE_TELEMETRY: ${{ vars.VITE_DISABLE_TELEMETRY }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.30.3
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: 'pnpm'
- name: Install Dependencies
run: pnpm install --frozen-lockfile
- name: Build All Packages
run: pnpm build
env:
NODE_OPTIONS: "--max-old-space-size=8192"
- name: Build stagewise App
working-directory: apps/browser
run: pnpm make --arch=${{ matrix.arch }}
env:
NODE_OPTIONS: "--max-old-space-size=8192"
BUILD_MODE: production
RELEASE_CHANNEL: dev
- name: Smoke Test (Linux - install xvfb)
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y xvfb
- name: Smoke Test
shell: bash
timeout-minutes: 2
run: |
set -euo pipefail
if [ "${{ runner.os }}" == "macOS" ]; then
BINARY="apps/browser/out/dev/stagewise-dev-darwin-arm64/stagewise-dev.app/Contents/MacOS/stagewise-dev"
elif [ "${{ runner.os }}" == "Linux" ]; then
BINARY="apps/browser/out/dev/stagewise-dev-linux-x64/stagewise-dev"
elif [ "${{ runner.os }}" == "Windows" ]; then
BINARY="apps/browser/out/dev/stagewise-dev-win32-x64/stagewise-dev.exe"
fi
echo "Launching smoke test: $BINARY --smoke-test"
if [ "${{ runner.os }}" == "Linux" ]; then
xvfb-run --auto-servernum "$BINARY" --no-sandbox --smoke-test
else
"$BINARY" --smoke-test
fi
echo "Smoke test passed — app launched and exited cleanly."
- name: Upload Build Artifacts
uses: actions/upload-artifact@v4
with:
name: stagewise-ci-${{ matrix.platform }}
path: |
apps/browser/out/*/make/**/*.dmg
apps/browser/out/*/make/**/*.zip
apps/browser/out/*/make/**/*.exe
apps/browser/out/*/make/**/*.nupkg
apps/browser/out/*/make/**/*.deb
apps/browser/out/*/make/**/*.rpm
retention-days: 7
if-no-files-found: warn
# Summary job for branch protection rules
ci-basic:
name: Basic CI
if: always()
needs: [lint, test, build]
runs-on: ubuntu-latest
steps:
- name: Check Basic CI Status
run: |
if [ "${{ needs.lint.result }}" != "success" ] || \
[ "${{ needs.test.result }}" != "success" ] || \
[ "${{ needs.build.result }}" != "success" ]; then
echo "Basic CI failed"
exit 1
fi
echo "Basic CI passed"
# Summary job for PR merge requirements
ci-full:
name: Full CI (PR)
if: github.event_name == 'pull_request' && always()
needs: [lint, test, build, test-windows, build-stagewise]
runs-on: ubuntu-latest
steps:
- name: Check Full CI Status
run: |
if [ "${{ needs.lint.result }}" != "success" ] || \
[ "${{ needs.test.result }}" != "success" ] || \
[ "${{ needs.build.result }}" != "success" ] || \
[ "${{ needs.test-windows.result }}" != "success" ] || \
[ "${{ needs.build-stagewise.result }}" != "success" ]; then
echo "## CI Failed" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| Job | Status |" >> $GITHUB_STEP_SUMMARY
echo "|-----|--------|" >> $GITHUB_STEP_SUMMARY
echo "| Lint | ${{ needs.lint.result }} |" >> $GITHUB_STEP_SUMMARY
echo "| Test | ${{ needs.test.result }} |" >> $GITHUB_STEP_SUMMARY
echo "| Test (Windows) | ${{ needs.test-windows.result }} |" >> $GITHUB_STEP_SUMMARY
echo "| Build | ${{ needs.build.result }} |" >> $GITHUB_STEP_SUMMARY
echo "| Build Browser | ${{ needs.build-stagewise.result }} |" >> $GITHUB_STEP_SUMMARY
exit 1
fi
echo "## CI Passed" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "All checks passed. This PR is ready for merge." >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Build Artifacts" >> $GITHUB_STEP_SUMMARY
echo "Browser builds for all platforms completed successfully." >> $GITHUB_STEP_SUMMARY