[scramjet] fix ci and update rust deps #572
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.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/[email protected] | |
| with: | |
| version: "0.2.105" | |
| - name: Setup Binaryen | |
| if: steps.rewriter-cache.outputs.cache-hit != 'true' | |
| uses: Aandreba/[email protected] | |
| 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: | | |
| cd packages/scramjet/packages/core | |
| pnpm pack | |
| - name: Upload Artifact (pnpm pack) | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: packaged-scramjet | |
| path: packages/scramjet/packages/core/mercuryworkshop-scramjet-*.tgz | |
| - name: Upload Artifact (dist) | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: scramjet | |
| path: | | |
| packages/scramjet/packages/core/dist/* | |
| frontend: | |
| name: Build Frontend | |
| runs-on: ubuntu-latest | |
| needs: [build] | |
| 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: | | |
| cd external/dreamlandjs | |
| pnpm build | |
| # - 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 | |
| run: | | |
| pnpm i | |
| SKIP_CORE=1 pnpm build | |
| VITE_ISOLATION_ORIGIN="https://puter.zone" pnpm build:chrome | |
| tests: | |
| name: Run Scramjet Tests | |
| runs-on: ubuntu-latest | |
| needs: build | |
| 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 | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: scramjet | |
| path: packages/scramjet/packages/core/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 | |
| rewritertests: | |
| name: "Run Rewriter Tests" | |
| runs-on: ubuntu-latest | |
| needs: [build] | |
| 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.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 |