name: CI
on:
push:
tags:
- "v0.5.*"
branches:
- main
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
permissions:
checks: write
pull-requests: write
contents: write
env:
CARGO_TERM_COLOR: always
WASI_SDK_VERSION: "25"
WASI_SDK_PATH: /opt/wasi-sdk
WASM_RQUICKJS_TEST_WASMTIME_CACHE: "1"
WASM_RQUICKJS_TEST_PREPARED_COMPONENT_CACHE: "1"
WASM_RQUICKJS_TEST_PRECOMPILE_COMPONENT: "1"
CI_WASMTIME_FORK_FEATURES: --features use-golem-wasmtime
jobs:
quick-checks:
runs-on: blacksmith-16vcpu-ubuntu-2404
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: CI reporting contracts
run: node --test .github/scripts/test_prepare_test_reports.cjs
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Check formatting
run: cargo fmt -- --check
skeleton-clippy:
needs: [quick-checks]
runs-on: blacksmith-16vcpu-ubuntu-2404
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/actions/setup
with:
cache-key: skeleton
- name: Clippy embedded skeleton
run: tools/check-skeleton-clippy.sh
build:
needs: [quick-checks]
runs-on: blacksmith-16vcpu-ubuntu-2404
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/actions/setup
with:
cache-key: fork
wasmtime-fork: "true"
- name: Install component license audit tool
run: cargo binstall --force --locked --version 0.9.2 cargo-about
- name: Check generated component licenses
run: tools/check-component-licenses.sh --check
- name: Clippy
run: cargo clippy $CI_WASMTIME_FORK_FEATURES -- -Dwarnings
- name: Build
run: cargo build --all-targets $CI_WASMTIME_FORK_FEATURES
- name: Local test profile contracts
run: cargo test --test dev_test_profiles $CI_WASMTIME_FORK_FEATURES
- name: Node compatibility parser contracts
run: cargo test --test js_subtest_parser $CI_WASMTIME_FORK_FEATURES -- --report-time
- name: Module loader architecture contracts
run: cargo test -p wasm-rquickjs --lib $CI_WASMTIME_FORK_FEATURES -- module_loader_architecture
test-other:
needs: [quick-checks]
runs-on: blacksmith-16vcpu-ubuntu-2404
steps:
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- uses: ./.github/actions/setup
with:
cache-key: fork
wasmtime-fork: "true"
- name: Test performance-report currentness selection
run: tools/performance-report-currentness.sh self-test
- name: Select agentic TypeScript currentness inputs
id: agentic-ts-currentness
shell: bash
env:
PUSH_BEFORE: ${{ github.event.before }}
PR_HEAD: ${{ github.event.pull_request.head.sha }}
run: .github/scripts/select-agentic-ts-currentness.sh "$GITHUB_EVENT_NAME" "$PUSH_BEFORE" "$PR_HEAD" >> "$GITHUB_OUTPUT"
- name: Validate agentic TypeScript reports
shell: bash
env:
PERFORMANCE_REPORTS_TO_CHECK: ${{ steps.agentic-ts-currentness.outputs.reports-to-check }}
run: |
tools/performance-report-currentness.sh check agentic-ts -- \
cargo test --test agentic_ts $CI_WASMTIME_FORK_FEATURES
- name: Validate npm release reports
shell: bash
env:
PERFORMANCE_REPORTS_TO_CHECK: ${{ steps.agentic-ts-currentness.outputs.npm-reports-to-check }}
run: |
tools/performance-report-currentness.sh check npm-metadata -- \
cargo test --test npm_metadata $CI_WASMTIME_FORK_FEATURES
- name: Compilation, DTS and error tests
run: cargo test --test compilation --test dts --test errors $CI_WASMTIME_FORK_FEATURES -- --report-time --format ctrf --logfile target/ctrf.json
- name: Fork-only runtime tests (Golem fork)
run: cargo test --test runtime $CI_WASMTIME_FORK_FEATURES -- fetch_redirect_with_ --report-time
- name: Optimizer copy budget contracts (Golem fork)
env:
WASM_RQUICKJS_TEST_ARTIFACT_CACHE: "1"
run: cargo test --test optimize $CI_WASMTIME_FORK_FEATURES -- --test-threads 2
- name: Collect Test Report
uses: ./.github/actions/collect-test-report
if: always()
with:
name: test-other
test-p3:
needs: [quick-checks]
runs-on: blacksmith-16vcpu-ubuntu-2404
strategy:
fail-fast: false
matrix:
suite: [generation, async-values]
include:
- suite: generation
test_args: --test p3_generation --test p3_exported_resource --test optimize
- suite: async-values
test_args: --test p3_async_values -- --test-threads 4
env:
WASM_RQUICKJS_TEST_ARTIFACT_CACHE: "1"
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/actions/setup
with:
cache-key: stock
component-cache-key: stock-${{ matrix.suite }}-shared
- name: Install wasmtime CLI
if: matrix.suite == 'generation'
run: |
curl -sSf https://wasmtime.dev/install.sh | bash -s -- --version v50.0.1
echo "$HOME/.wasmtime/bin" >> "$GITHUB_PATH"
- name: WASI Preview 3 tests
run: /usr/bin/time -v cargo test ${{ matrix.test_args }}
test-runtime:
needs: [quick-checks]
runs-on: blacksmith-16vcpu-ubuntu-2404
strategy:
fail-fast: false
matrix:
group: [1, 2, 3, 4, 5, 6, 7, 8, 9]
include:
- group: 9
node_version: "22.14.0"
test_args: "--test-threads 4"
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/actions/setup
with:
cache-key: stock
component-cache-key: stock-runtime-${{ matrix.group }}
- uses: actions/setup-node@v4
if: matrix.node_version
with:
node-version: ${{ matrix.node_version }}
- name: Runtime tests (group ${{ matrix.group }}/9)
run: cargo test --test runtime -- ${{ matrix.test_args }} --report-time --format ctrf --logfile target/ctrf.json ':tag:group${{ matrix.group }}'
env:
NODE_MODULES_APP_STRICT_NODE_BASELINE: "1"
- name: Collect Test Report
uses: ./.github/actions/collect-test-report
if: always()
with:
name: test-runtime-group-${{ matrix.group }}
test-node-compat:
needs: [quick-checks]
runs-on: blacksmith-16vcpu-ubuntu-2404
strategy:
fail-fast: false
matrix:
shard: [0, 1, 2, 3, 4, 5, 6, 7]
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/actions/setup
with:
cache-key: stock
component-cache-key: stock-node-${{ matrix.shard }}
- name: Vendor Node.js test suite
run: bash tests/node_compat/vendor.sh
- name: Module inventory contracts
if: matrix.shard == 0
run: cargo test --test node_compat_report -- ':tag:report_contract' --report-time
- name: Node compat tests (shard ${{ matrix.shard }}/8)
run: cargo test --test node_compat -- --report-time --format ctrf --logfile target/ctrf.json ':tag:shard${{ matrix.shard }}'
- name: Collect Test Report
uses: ./.github/actions/collect-test-report
if: always()
with:
name: test-node-compat-shard-${{ matrix.shard }}
test-reports:
if: ${{ always() && !cancelled() }}
needs: [test-other, test-runtime, test-node-compat]
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
checks: write
pull-requests: write
steps:
- uses: actions/checkout@v4
- name: Select latest evidence per lane before downloading
id: reports
uses: actions/github-script@v7
with:
script: |
const { selectArtifacts } = require('./.github/scripts/prepare-test-reports.cjs');
await selectArtifacts({ github, context, core });
- uses: actions/download-artifact@v4
if: steps.reports.outputs.ids != ''
with:
artifact-ids: ${{ steps.reports.outputs.ids }}
github-token: ${{ github.token }}
path: test-reports
merge-multiple: false
- name: Preserve source name when downloading a single artifact
if: steps.reports.outputs.single-name != ''
env:
ARTIFACT_NAME: ${{ steps.reports.outputs.single-name }}
run: |
if compgen -G 'test-reports/ctrf-*.json' > /dev/null; then
mv test-reports single-test-report
mkdir test-reports
mv single-test-report "test-reports/${ARTIFACT_NAME}"
fi
- name: Preserve consolidated evidence
uses: actions/upload-artifact@v4
with:
name: ci-test-reports-attempt${{ github.run_attempt }}
path: test-reports
retention-days: 35
if-no-files-found: warn
- name: Prepare lane-qualified presentation
if: hashFiles('test-reports/**/ctrf-*.json') != ''
continue-on-error: true
uses: actions/github-script@v7
with:
script: |
const { prepareReports } = require('./.github/scripts/prepare-test-reports.cjs');
await prepareReports('test-reports', 'rendered-reports', message => core.warning(message));
- name: Publish Test Report
uses: ctrf-io/github-test-reporter@v1
continue-on-error: true
with:
report-path: 'rendered-reports/*/ctrf-*.json'
summary: true
summary-report: true
failed-report: true
slowest-report: false
github-report: true
flaky-report: true
collapse-large-reports: true
exit-on-no-files: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
release-binaries:
needs: [build, test-other, test-runtime, test-node-compat, test-p3]
if: "startsWith(github.ref, 'refs/tags/v')"
strategy:
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: blacksmith-16vcpu-ubuntu-2404
archive: tar.gz
- target: aarch64-unknown-linux-gnu
os: blacksmith-16vcpu-ubuntu-2404
archive: tar.gz
cross: true
- target: x86_64-apple-darwin
os: macos-latest
archive: tar.gz
- target: aarch64-apple-darwin
os: macos-latest
archive: tar.gz
- target: x86_64-pc-windows-msvc
os: windows-latest
archive: zip
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: dtolnay/rust-toolchain@stable
- uses: useblacksmith/rust-cache@v3
with:
prefix-key: v1-rust
shared-key: release-${{ matrix.target }}
cache-all-crates: true
- id: get_version
uses: battila7/get-version-action@v2
- name: Set version
shell: bash
run: |
VERSION="${{ steps.get_version.outputs.version-without-v }}"
if [[ "$RUNNER_OS" == "macOS" ]]; then
sed -i '' "s/0.0.0/$VERSION/g" Cargo.toml
else
sed -i "s/0.0.0/$VERSION/g" Cargo.toml
fi
- name: Install cross-compilation tools
if: matrix.cross
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
- name: Add Rust target
run: rustup target add ${{ matrix.target }}
- name: Build release binary
run: cargo build --release --target ${{ matrix.target }}
- name: Package (unix)
if: matrix.archive == 'tar.gz'
shell: bash
run: |
ARCHIVE="wasm-rquickjs-cli-v${{ steps.get_version.outputs.version-without-v }}-${{ matrix.target }}.tar.gz"
tar -czf "$ARCHIVE" -C target/${{ matrix.target }}/release wasm-rquickjs
echo "ARCHIVE=$ARCHIVE" >> $GITHUB_ENV
- name: Package (windows)
if: matrix.archive == 'zip'
shell: bash
run: |
ARCHIVE="wasm-rquickjs-cli-v${{ steps.get_version.outputs.version-without-v }}-${{ matrix.target }}.zip"
cd target/${{ matrix.target }}/release
7z a "../../../$ARCHIVE" wasm-rquickjs.exe
cd ../../..
echo "ARCHIVE=$ARCHIVE" >> $GITHUB_ENV
- name: Upload release asset
uses: softprops/action-gh-release@v2
with:
files: ${{ env.ARCHIVE }}
publish:
needs: [build, test-other, test-runtime, test-node-compat, test-p3]
if: "startsWith(github.ref, 'refs/tags/v')"
runs-on: blacksmith-16vcpu-ubuntu-2404
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/actions/setup
with:
cache-key: release
- id: get_version
uses: battila7/get-version-action@v2
- name: Publish crates
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: |
export VERSION="${{ steps.get_version.outputs.version-without-v }}"
sed -i "s/0.0.0/$VERSION/g" Cargo.toml
cargo publish -p wasm-rquickjs --features optimize --allow-dirty
cargo publish -p wasm-rquickjs-cli --allow-dirty