Skip to content

Refactor scramjet to compile to a single bundle, eliminating the need for globals containing state #69

Refactor scramjet to compile to a single bundle, eliminating the need for globals containing state

Refactor scramjet to compile to a single bundle, eliminating the need for globals containing state #69

Workflow file for this run

name: CI
on:
push:
paths-ignore:
- ".github/workflows/**"
pull_request:
paths-ignore:
- ".github/workflows/**"
workflow_dispatch:
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
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: latest
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
cache: "pnpm"
- name: Install pnpm dependencies
run: pnpm install
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
workspaces: "rewriter"
cache-all-crates: true
- name: Install wbg
uses: jetli/[email protected]
with:
version: "0.2.100"
- name: Setup Binaryen
uses: Aandreba/[email protected]
with:
token: ${{ github.token }}
- name: Setup wasm-snip
run: "cargo install --git https://github.com/r58playz/wasm-snip"
- name: Pack Scramjet
run: pnpm pack
- name: Upload Artifact (pnpm pack)
uses: actions/upload-artifact@v4
with:
name: packaged-scramjet
path: mercuryworkshop-scramjet-*.tgz
- name: Upload Artifact (dist)
uses: actions/upload-artifact@v4
with:
name: scramjet
path: |
dist/*.js
dist/*.js.map
dist/*.wasm
tests:
name: Run Scramjet Tests
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: latest
- 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: dist
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Run Playwright tests
run: pnpm test
# upload:
# name: Upload release
# runs-on: ubuntu-latest
# needs: [build, tests]
# permissions: write-all
# if: github.ref == 'refs/heads/main'
# steps:
# - name: Delete old release and tag
# uses: dev-drprasad/[email protected]
# with:
# delete_release: true
# tag_name: latest
# github_token: ${{ github.token }}
# - name: Get artifacts
# uses: actions/download-artifact@v4
# with:
# name: packaged-scramjet
# path: .
# - name: Release to GitHub
# uses: ncipollo/release-action@v1
# with:
# name: Continuous Build
# tag: latest
# commit: main
# body: "${{ github.event.head_commit.url }} ${{ github.event.head_commit.message }}"
# artifacts: "mercuryworkshop-scramjet-*.tgz"
# prerelease: true
# publish:
# name: Publish Scramjet to NPM
# runs-on: ubuntu-latest
# needs: [build, tests]
# if: false
# permissions: write-all
# steps:
# - name: Setup Node.js
# uses: actions/setup-node@v2
# with:
# node-version: "20"
# registry-url: "https://registry.npmjs.org"
# - name: Get artifacts
# uses: actions/download-artifact@v4
# with:
# name: packaged-scramjet
# path: .
# - name: Extract package
# run: tar xvf mercuryworkshop-scramjet-*.tgz package --strip-components=1
# - 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 version || 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
# - name: Publish
# if: steps.check.outputs.version_changed == 'true'
# run: npm publish --access public --no-git-checks
# env:
# NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# pages:
# name: Upload to Github Pages
# runs-on: ubuntu-latest
# needs: [build, tests]
# 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
# with:
# version: latest
# - 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: dist
# - name: build statics
# run: bash ./ci/buildstatic.sh
# - name: upload pages artifact
# uses: actions/upload-pages-artifact@v3
# with:
# path: "./staticbuild"
# - name: deploy to github
# id: deployment
# uses: actions/deploy-pages@v4