[scramjet/runway] port over old site integration tests to runway #747
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| paths-ignore: &ci_ignore_paths # Editor configs | |
| - ".zed/**" | |
| - ".vscode/**" | |
| # Docs | |
| - "documentation/**" | |
| - "**/*.md" | |
| # The README is included in the Typedoc | |
| - "!README.md" | |
| # Formatters | |
| - "eslint.config.json" | |
| - "prettier.config.json" | |
| - ".editorconfig" | |
| pull_request: | |
| paths-ignore: *ci_ignore_paths | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| version-check: | |
| name: Check Version | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version_changed: ${{ steps.check.outputs.exit_code }} | |
| new_version: ${{ steps.check.outputs.exit_code }} | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v4 | |
| - name: Check the version | |
| id: check | |
| run: | | |
| CURRENT_VERSION=$(jq -r .version package.json) | |
| echo "Current version: $CURRENT_VERSION" | |
| LATEST_VERSION=$(npm view @mercuryworkshop/scramjet versions --json | jq -r '.[-1]' || echo "0.0.0") | |
| echo "Latest NPM version: $LATEST_VERSION" | |
| if [ "$LATEST_VERSION" != "$CURRENT_VERSION" ]; | |
| then | |
| echo "Version changed" | |
| echo "version_changed=true" >> "$GITHUB_OUTPUT" | |
| echo "new_version=$CURRENT_VERSION" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "Version not changed" | |
| echo "version_changed=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| 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: "22" | |
| cache: "pnpm" | |
| - name: Install pnpm dependencies | |
| run: pnpm install | |
| - name: Cache rewriter build artifacts | |
| uses: actions/cache@v4 | |
| id: rewriter-cache | |
| with: | |
| path: | | |
| packages/scramjet/packages/core/rewriter/wasm/out | |
| packages/scramjet/packages/core/dist/scramjet.wasm | |
| key: rewriter-release-${{ hashFiles('packages/scramjet/packages/core/rewriter/**/Cargo.toml', 'packages/scramjet/packages/core/rewriter/**/*.rs', 'packages/scramjet/packages/core/rewriter/**/src/**/*.toml', 'packages/scramjet/packages/core/rewriter/**/src/**/*.json', 'packages/scramjet/packages/core/rewriter/**/src/**/*.md', 'packages/scramjet/packages/core/rewriter/**/*.sh') }} | |
| restore-keys: | | |
| rewriter-release- | |
| - name: Cache Rust dependencies | |
| if: steps.rewriter-cache.outputs.cache-hit != 'true' | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| workspaces: "rewriter" | |
| cache-all-crates: true | |
| - name: Install wbg | |
| if: steps.rewriter-cache.outputs.cache-hit != 'true' | |
| uses: jetli/wasm-bindgen-action@v0.2.0 | |
| with: | |
| version: "0.2.105" | |
| - name: Setup Binaryen | |
| if: steps.rewriter-cache.outputs.cache-hit != 'true' | |
| uses: Aandreba/setup-binaryen@v1.0.0 | |
| with: | |
| token: ${{ github.token }} | |
| - name: Setup wasm-snip | |
| if: steps.rewriter-cache.outputs.cache-hit != 'true' | |
| run: "cargo install --git https://github.com/r58playz/wasm-snip" | |
| - name: Pack Scramjet | |
| run: pnpm pack | |
| working-directory: packages/scramjet/packages/core | |
| - name: Upload Artifact (scramjet/core) | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: scramjet | |
| path: | | |
| packages/scramjet/packages/core/dist/* | |
| - name: Upload Artifact (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/* | |
| 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: "22" | |
| 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: pnpm test:package | |
| working-directory: packages/scramjet/packages/core | |
| tests: | |
| name: Run Scramjet Tests | |
| runs-on: ubuntu-latest | |
| needs: [build, package-validation] | |
| env: | |
| PLAYWRIGHT_BROWSERS_PATH: .playwright-browsers | |
| 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: "22" | |
| 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 cached rewriter build | |
| uses: actions/cache/restore@v4 | |
| id: rewriter-cache | |
| with: | |
| path: | | |
| packages/scramjet/packages/core/rewriter/wasm/out | |
| packages/scramjet/packages/core/dist/scramjet.wasm | |
| key: rewriter-release-${{ hashFiles('packages/scramjet/packages/core/rewriter/**/Cargo.toml', 'packages/scramjet/packages/core/rewriter/**/*.rs', 'packages/scramjet/packages/core/rewriter/**/src/**/*.toml', 'packages/scramjet/packages/core/rewriter/**/src/**/*.json', 'packages/scramjet/packages/core/rewriter/**/src/**/*.md', 'packages/scramjet/packages/core/rewriter/**/*.sh') }} | |
| - name: Get artifacts (scramjet/controller) | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: scramjet-controller | |
| path: packages/scramjet/packages/controller/dist | |
| - name: Cache Playwright browsers | |
| id: pw-browsers-cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: .playwright-browsers | |
| key: playwright-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }} | |
| restore-keys: | | |
| playwright-${{ runner.os }}- | |
| - name: Install Playwright Chromium | |
| if: steps.pw-browsers-cache.outputs.cache-hit != 'true' | |
| run: npx playwright install --with-deps chromium | |
| working-directory: packages/scramjet/packages/core | |
| - name: Run Playwright tests | |
| run: pnpm test:integration | |
| working-directory: packages/scramjet/packages/core | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: playwright-test-results | |
| path: packages/scramjet/packages/core/blob-report/* | |
| if-no-files-found: error | |
| 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 rewriter build artifacts | |
| uses: actions/cache@v4 | |
| id: rewriter-cache | |
| with: | |
| path: | | |
| packages/scramjet/packages/core/rewriter/wasm/out | |
| packages/scramjet/packages/core/dist/scramjet.wasm | |
| key: rewriter-release-${{ hashFiles('packages/scramjet/packages/core/rewriter/**/Cargo.toml', 'packages/scramjet/packages/core/rewriter/**/*.rs', 'packages/scramjet/packages/core/rewriter/**/src/**/*.toml', 'packages/scramjet/packages/core/rewriter/**/src/**/*.json', 'packages/scramjet/packages/core/rewriter/**/src/**/*.md', 'packages/scramjet/packages/core/rewriter/**/*.sh') }} | |
| restore-keys: | | |
| rewriter-release- | |
| - name: Cache Rust dependencies | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| workspaces: "rewriter" | |
| cache-all-crates: true | |
| - 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: "22" | |
| 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: Build Dreamland | |
| run: pnpm build:dreamland | |
| # - 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/setup-depot-tools@v1.0.1 | |
| # - 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 | |
| run: | | |
| SKIP_CORE=1 pnpm build | |
| VITE_PUTER_BRANDING=1 VITE_ISOLATION_ORIGIN="https://puter.zone" pnpm build:chrome | |
| - name: Upload Artifact (dist) | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: frontend | |
| path: | | |
| ./packages/chrome/dist | |
| pages: | |
| name: Upload to Github Pages | |
| runs-on: ubuntu-latest | |
| needs: [frontend, tests, rewritertests] | |
| permissions: write-all | |
| if: github.ref == 'refs/heads/main' | |
| 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: "22" | |
| cache: "pnpm" | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Get artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: frontend | |
| path: "./packages/chrome/dist" | |
| - name: Upload pages artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: "./packages/chrome/dist" | |
| - name: Deploy to github | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |