Files
2026-09-25 08:51:43 -04:00

243 lines
6.6 KiB
YAML

name: CI
on: [push, workflow_dispatch]
env:
WASM_BINDGEN_VERSION: "0.2.105"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: Build Scramjet
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "24"
cache: "pnpm"
- name: Install pnpm dependencies
run: pnpm install
- name: Setup Rewriter Toolchain
uses: ./packages/scramjet/.github/actions/setup-rewriter-toolchain
with:
wasm-bindgen-version: ${{ env.WASM_BINDGEN_VERSION }}
rewriter-path: packages/scramjet/packages/core/rewriter
github-token: ${{ github.token }}
- name: Build and pack Scramjet (release rewriter, core, controller, utils, bootstrap, create-proxy-app)
run: ./cv npm --yes
- name: Upload Artifact (scramjet/core)
uses: actions/upload-artifact@v4
with:
name: scramjet
path: packages/scramjet/packages/core/dist/*
- name: Upload Artifact (scramjet/core) (packaged)
uses: actions/upload-artifact@v4
with:
name: scramjet-package
path: packages/scramjet/packages/core/mercuryworkshop-scramjet-*.tgz
- name: Upload Artifact (scramjet/controller)
uses: actions/upload-artifact@v4
with:
name: scramjet-controller
path: packages/scramjet/packages/controller/dist/*
- name: Upload Artifact (scramjet/controller) (packaged)
uses: actions/upload-artifact@v4
with:
name: scramjet-controller-package
path: packages/scramjet/packages/controller/mercuryworkshop-scramjet-controller-*.tgz
package-validation:
name: Validate Package Structure
runs-on: ubuntu-latest
needs: [build]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "24"
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Get artifacts
uses: actions/download-artifact@v4
with:
name: scramjet-package
path: packages/scramjet/packages/core
- name: Extract package
run: tar xvf mercuryworkshop-scramjet-*.tgz package --strip-components=1
working-directory: packages/scramjet/packages/core
- name: Run package validation tests
run: ./cv validate
tests:
name: Run Scramjet Tests
runs-on: ubuntu-latest
needs: [build, package-validation]
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "24"
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Get artifacts (scramjet/core)
uses: actions/download-artifact@v4
with:
name: scramjet
path: packages/scramjet/packages/core/dist
- name: Get artifacts (scramjet/controller)
uses: actions/download-artifact@v4
with:
name: scramjet-controller
path: packages/scramjet/packages/controller/dist
- name: Install Playwright Chromium
run: npx playwright install --with-deps chromium
working-directory: packages/scramjet/packages/runway
- name: Run Runway tests
run: OMIT_WPT=1 CV_PREBUILT=core,controller ./cv test --parallel 4
rewritertests:
name: Run Rewriter Tests
runs-on: ubuntu-latest
needs: [build, package-validation]
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Cache Rust compilation
uses: Swatinem/rust-cache@v2
with:
workspaces: "packages/scramjet/packages/core/rewriter -> target"
cache-all-crates: true
shared-key: "rewriter"
- name: Run Tests
run: cargo test
working-directory: packages/scramjet/packages/core/rewriter/native
frontend:
name: Build Frontend
runs-on: ubuntu-latest
permissions: write-all
needs: [build, package-validation]
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "24"
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Get artifacts
uses: actions/download-artifact@v4
with:
name: scramjet
path: packages/scramjet/packages/core/dist
# - name: Get Chii submodule commit hash
# id: chii-hash
# run: echo "hash=$(git submodule status chii | awk '{print $1}')" >> $GITHUB_OUTPUT
# - name: Cache Chii build output
# id: chii-cache
# uses: actions/cache@v4
# with:
# path: |
# chii/public
# chii/front_end/dist
# key: chii-${{ runner.os }}-${{ steps.chii-hash.outputs.hash }}
# - name: Install Depot Tools
# if: steps.chii-cache.outputs.cache-hit != 'true'
# uses: newkdev/[email protected]
# - name: Initialize Chii front_end
# if: steps.chii-cache.outputs.cache-hit != 'true'
# run: |
# cd chii
# pnpm init:front_end
# - name: Build Chii
# if: steps.chii-cache.outputs.cache-hit != 'true'
# run: |
# cd chii
# pnpm build
- name: Build Frontend
# core's dist comes from the build job above, so the rust toolchain is not needed here
env:
CV_PREBUILT: core
VITE_SENTRY_URL: "https://js.sentry-cdn.com/89b0486bec1f3d54d07953d81a046161.min.js"
VITE_PUTER_BRANDING: "1"
VITE_PUTER_WISP_PROMOTION: "1"
VITE_PLAUSIBLE_URL: "https://plausible.io/js/pa-NRxWcAzajMavHo05JTRcw.js"
VITE_ISOLATION_ORIGIN: "https://puter.zone"
run: ./cv build chrome
- name: Upload Artifact (frontend)
uses: actions/upload-artifact@v4
with:
name: frontend
path: |
./packages/chrome/dist