Skip to content

release: jco v1.15.4 #3967

release: jco v1.15.4

release: jco v1.15.4 #3967

Workflow file for this run

name: test
on:
merge_group:
push:
branches:
- main
pull_request:
branches:
- main
defaults:
run:
shell: bash
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
with:
node-version: "latest"
- name: Install Rust
run: rustup update stable --no-self-update
- uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 # v2.7.8
with:
shared-key: jco-${{ hashFiles('Cargo.lock') }}
- name: Cache npm install
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
with:
key: node-modules-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('package-lock.json') }}
path: |
node_modules
- name: Install NPM packages
run: npm install
- name: Build jco
run: npm run build
- name: Upload jco build
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
with:
name: jco-build
path: |
packages/jco/obj
- name: Build jco-transpile
run: npm run build -w @bytecodealliance/jco-transpile
- name: Upload jco-transpile vendor
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
with:
name: jco-transpile-vendor
path: |
packages/jco-transpile/vendor
test-jco:
runs-on: ${{ matrix.os }}
needs:
- build
strategy:
matrix:
os:
- ubuntu-22.04 # https://github.com/puppeteer/puppeteer/issues/12818#issuecomment-2593659514
- windows-2022
- macos-latest
node:
- 18.x
- 20.x
- 22.x
- latest
include:
- os: windows-2022
weval-bin-path: .weval-bin/weval.exe
- os: ubuntu-22.04
weval-bin-path: .weval-bin/weval
- os: macos-latest
weval-bin-path: .weval-bin/weval
exclude:
- os: macos-latest
node: 20.x
- os: macos-latest
node: 18.x
- os: windows-2022
node: latest
- os: windows-2022
node: 18.x
steps:
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
with:
node-version: ${{ matrix.node }}
- uses: taiki-e/cache-cargo-install-action@7447f04c51f2ba27ca35e7f1e28fab848c5b3ba7 # v2.3.1
with:
tool: [email protected]
# Determine weval version
- name: Determine weval version
id: weval-meta
shell: bash
run: |
export WEVAL_LATEST_URL=`curl -Ls -o /dev/null -w %{url_effective} https://github.com/bytecodealliance/weval/releases/latest`
export WEVAL_VERSION=${WEVAL_LATEST_URL#https://github.com/bytecodealliance/weval/releases/tag/}
echo -e "version=$WEVAL_VERSION" >> $GITHUB_OUTPUT
# Use cached weval bin if present
- name: Cache weval bin
id: cache-weval-bin
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
with:
path: .weval-bin
key: weval-bin-${{ steps.weval-meta.outputs.version }}-${{ matrix.os }}
# (no cached weval bin) download weval release
- if: ${{ steps.cache-weval-bin.outputs.cache-hit != 'true' && matrix.os == 'ubuntu-latest' }}
run: |
curl -LO https://github.com/bytecodealliance/weval/releases/download/${{ steps.weval-meta.outputs.version }}/weval-${{ steps.weval-meta.outputs.version }}-x86_64-linux.tar.xz
tar -xvJf weval-${{ steps.weval-meta.outputs.version }}-x86_64-linux.tar.xz
mv weval-${{ steps.weval-meta.outputs.version }}-x86_64-linux/weval .weval-bin
- if: ${{ steps.cache-weval-bin.outputs.cache-hit != 'true' && matrix.os == 'windows-2022' }}
run: |
curl -LO https://github.com/bytecodealliance/weval/releases/download/${{ steps.weval-meta.outputs.version }}/weval-${{ steps.weval-meta.outputs.version }}-x86_64-windows.zip
unzip weval-${{ steps.weval-meta.outputs.version }}-x86_64-windows.zip
mv weval-${{ steps.weval-meta.outputs.version }}-x86_64-windows .weval-bin
- if: ${{ steps.cache-weval-bin.outputs.cache-hit != 'true' && matrix.os == 'macos-latest' }}
run: |
curl -LO https://github.com/bytecodealliance/weval/releases/download/${{ steps.weval-meta.outputs.version }}/weval-${{ steps.weval-meta.outputs.version }}-aarch64-macos.tar.xz
tar -xvJf weval-${{ steps.weval-meta.outputs.version }}-aarch64-macos.tar.xz
mkdir .weval-bin
mv weval-${{ steps.weval-meta.outputs.version }}-aarch64-macos/weval .weval-bin/
# see: https://github.com/npm/cli/issues/4828
- name: Remove package-lock
run: |
mv package-lock.json hidden.json
- run: |
npm install -g patch-package
- name: Install oxc-parser
if: ${{ matrix.node == '18.x' && matrix.os == 'ubuntu-22.04' }}
run: |
npm install oxc-parser --ignore-engines
npm install @oxc-parser/binding-linux-x64-gnu --ignore-engines
- name: Restore package-lock
run: |
mv hidden.json package-lock.json
- name: Install NPM packages
run: |
npm install
- name: Cache puppeteer install
id: cache-puppeteer
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
with:
key: puppeteer-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('packages/jco/package.json') }}
path: |
/home/runner/.cache/puppeteer
- name: Install puppeteer
run: |
npx puppeteer browsers install chrome
- name: Restore jco build
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
with:
name: jco-build
path: |
packages/jco/obj
- name: Test LTS Node.js
if: matrix.node == '18.x' || matrix.node == '20.x' || matrix.ndoe == '22.x'
working-directory: packages/jco
run: |
npm run test:lts -- --maxWorkers 4 --minWorkers 2 --maxConcurrency 2
- name: Test Latest Node.js
if: matrix.node == 'latest'
working-directory: packages/jco
env:
WEVAL_BIN_PATH: ${{ matrix.weval-bin-path }}
run: |
npm run test -- --maxWorkers 4 --minWorkers 2 --maxConcurrency 2
test-wasi-deno:
runs-on: "ubuntu-latest"
needs:
- build
steps:
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
with:
submodules: recursive
- name: Install Rust deps
run: |
rustup update stable --no-self-update && rustup default stable
rustup target add wasm32-unknown-unknown
rustup target add wasm32-wasip1
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
with:
node-version: "latest"
- uses: denoland/setup-deno@e95548e56dfa95d4e1a28d6f422fafe75c4c26fb # v2.0.3
with:
deno-version: v1.x
- name: Cache npm install
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
with:
key: node-modules-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('package-lock.json') }}
path: |
node_modules
- name: Install NPM packages
run: npm install
- name: Restore jco build
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
with:
name: jco-build
path: |
packages/jco/obj
- name: Generate tests
run: |
cargo xtask generate tests preview2
- name: WASI Preview 2 Conformance
run: cargo test deno_
test-wasi-node:
strategy:
matrix:
os:
- ubuntu-latest
- windows-2022
- macos-latest
node:
- 18.x
- 20.x
- latest
exclude:
- os: macos-latest
node: 20.x
- os: macos-latest
node: 18.x
- os: windows-2022
node: 20.x
- os: windows-2022
node: 18.x
fail-fast: false
runs-on: ${{ matrix.os }}
needs:
- build
steps:
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
with:
submodules: recursive
- name: Install Rust deps
run: |
rustup update stable --no-self-update && rustup default stable
rustup target add wasm32-unknown-unknown
rustup target add wasm32-wasip1
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
with:
node-version: ${{ matrix.node }}
- name: Cache npm install
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
with:
key: node-modules-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('package-lock.json') }}
path: |
node_modules
- name: Restore jco build
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
with:
name: jco-build
path: |
packages/jco/obj
- name: Install NPM packages
run: npm install
- name: Generate tests
run: |
cargo xtask generate tests preview2
- name: WASI Preview 2 Conformance
run: |
cargo test node_
test-shims:
runs-on: ubuntu-latest
strategy:
matrix:
workspace:
- preview2-shim
- preview3-shim
steps:
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
- name: Install Rust
run: rustup update stable --no-self-update
- uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 # v2.7.8
with:
shared-key: jco-${{ hashFiles('Cargo.lock') }}
- name: Cache npm install
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
with:
key: node-modules-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('package-lock.json') }}
path: |
node_modules
- name: Install NPM packages
run: npm install
- name: Cache puppeteer install
id: cache-puppeteer
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
with:
key: puppeteer-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('packages/jco/package.json') }}
path: |
/home/runner/.cache/puppeteer
- name: Install puppeteer
run: |
npx puppeteer browsers install chrome
- name: Build jco
run: npm run build
- name: Test Workspaces
env:
TEST_PUPPETEER_LAUNCH_ARGS: |
--no-sandbox
run: npm run test --workspace packages/${{ matrix.workspace }}
eslint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
- name: Cache npm install
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
with:
key: node-modules-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('package-lock.json') }}
path: |
node_modules
- name: Install NPM packages
run: npm install
- name: Lint
run: npm run lint
rustfmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
- name: Install Rust
run: rustup update stable && rustup default stable && rustup component add rustfmt
- name: Remove tests mod
run: rm -r crates/jco/tests/mod.rs
- uses: Swatinem/rust-cache@v2
- name: Format source code
run: cargo fmt -- --check
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
- name: Install Rust
run: rustup update stable && rustup default stable
- name: Remove tests mod
run: rm -r crates/jco/tests/mod.rs
- uses: Swatinem/rust-cache@v2
- name: Run clippy
run: cargo clippy --workspace --all-features --all-targets --keep-going -- -D warnings
test-jco-std:
runs-on: ubuntu-latest
strategy:
matrix:
workspace:
- jco-std
steps:
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
- name: Install Rust
run: rustup update stable --no-self-update
- uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 # v2.7.8
with:
shared-key: jco-${{ hashFiles('Cargo.lock') }}
- name: Cache npm install
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
with:
key: node-modules-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('package-lock.json') }}
path: |
node_modules
- name: Cache wasmtime binary
id: custom-wasmtime-bin
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
with:
key: wasmtime-custom-bin-${{ runner.os }}-${{ runner.arch }}-29f2a1ca66c849a2d2e533a2df87c221daa8e2de
path: |
/home/runner/.cargo/bin/wasmtime
# TODO: update when wasmtime w/ this commit is released
- name: Install wasmtime CLI
if: ${{ steps.custom-wasmtime-bin.outputs.cache-hit != 'true' }}
run: |
cargo install \
--git https://github.com/bytecodealliance/wasmtime \
--rev 29f2a1ca66c849a2d2e533a2df87c221daa8e2de \
wasmtime-cli
- name: Install NPM packages
working-directory: packages/${{ matrix.workspace }}
run: |
npm install
- name: Build jco-transpile, jco-std
run: |
npm run build -w packages/jco-transpile
npm --workspace packages/${{ matrix.workspace }} run build
- name: Test jco-std workspace
run: |
npm run test --workspace packages/${{ matrix.workspace }}
examples:
needs:
- build
runs-on: ubuntu-latest
strategy:
matrix:
wac:
- version: 0.6.0
node:
- version: 24.x
project:
- name: add
workspace: examples/components/add
- name: adder
workspace: examples/components/adder
- name: string-reverse
workspace: examples/components/string-reverse
- name: string-reverse-upper
workspace: examples/components/string-reverse-upper
is-composed: true
- name: webidl-book-library
workspace: examples/components/webidl-book-library
requires-crates:
- webidl2wit-cli
- name: node-fetch
workspace: examples/components/node-fetch
- name: http-hello-world
workspace: examples/components/http-hello-world
- name: http-server-fetch-handler
workspace: examples/components/http-server-fetch-handler
- name: http-server-hono
workspace: examples/components/http-server-hono
setup: |
npm run build -w @bytecodealliance/jco-transpile
npm run build -w @bytecodealliance/jco-std
- name: host-logging
workspace: examples/components/host-logging
- name: ts-resource-import
workspace: examples/components/ts-resource-import
- name: ts-resource-export
workspace: examples/components/ts-resource-export
- name: typegen-async-export
workspace: examples/components/typegen-async-export
steps:
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
with:
node-version: ${{ matrix.node.version }}
- name: Restore jco build
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
with:
name: jco-build
path: |
packages/jco/obj
- name: Restore jco-transpile vendor
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
with:
name: jco-transpile-vendor
path: |
packages/jco-transpile/vendor
- name: Install Rust
if: ${{ matrix.project.requires-crates != '[]' }}
run: rustup update stable --no-self-update && rustup default stable
- name: Install required rust crates
if: ${{ matrix.project.requires-crates != '[]' }}
uses: taiki-e/install-action@b4b80945859e8ef89a9732a0f46499a443b196fe # v2
with:
tool: ${{ join(matrix.project.requires-crates, ',') }}
- name: Install wac
if: ${{ matrix.project.is-composed }}
uses: jaxxstorm/action-install-gh-release@6096f2a2bbfee498ced520b6922ac2c06e990ed2 # v2.1.0
with:
repo: bytecodealliance/wac
tag: v${{ matrix.wac.version }}
extension-matching: disable
rename-to: wac
chmod: 0755
- uses: bytecodealliance/actions/wasmtime/setup@6aecabac1eb1dcf7ed94ba9471974415ee2ebef2 # v1.1.2
- name: Cache npm install
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
with:
key: node-modules-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('package-lock.json') }}
path: |
node_modules
- run: npm install
- name: npm install (project)
working-directory: ${{ matrix.project.dir }}
run: npm install
- run: |
${{ matrix.project.setup }}
- name: Run all script for (${{ matrix.project.name }})
working-directory: ${{ matrix.project.dir }}
run: npm run all --workspace ${{ matrix.project.workspace }}