Skip to content

monorepoize everything #453

monorepoize everything

monorepoize everything #453

Workflow file for this run

name: CI

Check failure on line 1 in .github/workflows/main.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/main.yml

Invalid workflow file

(Line: 137, Col: 20): Job 'frontend' depends on unknown job 'package-validation'., (Line: 264, Col: 20): Job 'rewritertests' depends on unknown job 'package-validation'.
on:
push:
paths-ignore: &ci_ignore_paths
- ".github/workflows/**"
- "assets/**"
- "scripts/**"
# 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
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 rewriter build artifacts
uses: actions/cache@v4
id: rewriter-cache
with:
path: |
rewriter/wasm/out
dist/scramjet.wasm.wasm
key: rewriter-release-${{ hashFiles('rewriter/**/Cargo.toml', 'rewriter/**/src/**/*.rs', 'rewriter/**/src/**/*.toml', 'rewriter/**/src/**/*.json', 'rewriter/**/src/**/*.md', '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.100"
- 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: 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
frontend:
name: Build Frontend
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
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 Dreamland
run: |
cd 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 Chobitsu
run: |
cd chobitsu
pnpm webpack build --mode development
- name: Build page_inject
run: |
cd page_inject
npx rollup -c
- name: Build Frontend
run: |
cd frontend
pnpm vite build
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
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: 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
- name: Run Playwright tests
run: pnpm test:integration
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: |
rewriter/wasm/out
dist/scramjet.wasm.wasm
key: rewriter-release-${{ hashFiles('rewriter/**/Cargo.toml', 'rewriter/**/src/**/*.rs', 'rewriter/**/src/**/*.toml', 'rewriter/**/src/**/*.json', 'rewriter/**/src/**/*.md', '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: cd rewriter/native && cargo 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