test #6771
Workflow file for this run
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: 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 | |
| permissions: {} | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 | |
| with: | |
| node-version: "latest" | |
| - uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9 | |
| with: | |
| version: 11 | |
| - name: Install Rust | |
| run: rustup update stable --no-self-update | |
| - uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1 | |
| with: | |
| shared-key: jco-${{ hashFiles('Cargo.lock') }} | |
| - name: Enable sccache | |
| uses: mozilla-actions/sccache-action@9e7fa8a12102821edf02ca5dbea1acd0f89a2696 # v0.0.10 | |
| - name: Setup sccache | |
| run: | | |
| echo "SCCACHE_GHA_ENABLED=true" >> "$GITHUB_ENV" | |
| echo "RUSTC_WRAPPER=sccache" >> "$GITHUB_ENV" | |
| - name: Cache node modules | |
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| with: | |
| key: node-modules-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('pnpm-lock.yaml') }} | |
| path: | | |
| node_modules | |
| - name: Install node modules | |
| run: pnpm install | |
| - name: Build jco for test | |
| working-directory: packages/jco | |
| run: | | |
| pnpm --filter '@bytecodealliance/jco' run build | |
| pnpm --filter '@bytecodealliance/jco' run build:test:components | |
| - name: Upload jco build transpiled output | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: jco-build-transpiled | |
| path: packages/jco/obj | |
| - name: Upload jco build TS output | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: jco-build-ts | |
| path: packages/jco/dist | |
| - name: Upload artifacts for js tests | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: js-generated-tests | |
| path: packages/jco-transpile/test/fixtures/generated | |
| - name: Build jco-transpile | |
| run: pnpm --filter '@bytecodealliance/jco-transpile' run build | |
| - name: Upload jco-transpile vendor | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: jco-transpile-vendor | |
| path: | | |
| packages/jco-transpile/vendor | |
| - name: Build preview2-shim | |
| run: pnpm --filter '@bytecodealliance/preview2-shim' run build | |
| - name: Upload preview2-shim build output | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: build-preview2-shim | |
| path: packages/preview2-shim/dist | |
| test-jco: | |
| runs-on: ${{ matrix.os }} | |
| needs: | |
| - build | |
| strategy: | |
| matrix: | |
| os: | |
| - ubuntu-latest | |
| - macos-latest | |
| node: | |
| - 22.x | |
| - 24.x | |
| - latest # 26.x | |
| include: | |
| - os: ubuntu-latest | |
| weval-bin-path: .weval-bin/weval | |
| - os: macos-latest | |
| weval-bin-path: .weval-bin/weval | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 | |
| with: | |
| node-version: ${{ matrix.node }} | |
| - uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9 | |
| with: | |
| version: 11 | |
| - uses: taiki-e/cache-cargo-install-action@417450f3c33ee20393705369577571770643d4c7 # v3.0.7 | |
| with: | |
| tool: wasm-tools@1.244.0 | |
| # Determine weval version | |
| - name: Determine weval version | |
| id: weval-meta | |
| run: | | |
| WEVAL_LATEST_URL="$(curl -Ls -o /dev/null -w '%{url_effective}' https://github.com/bytecodealliance/weval/releases/latest)"; | |
| export WEVAL_LATEST_URL; | |
| 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@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| 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' && startsWith(matrix.os, 'ubuntu') }} | |
| env: | |
| WEVAL_VERSION: ${{ steps.weval-meta.outputs.version }} | |
| run: | | |
| curl -LO "https://github.com/bytecodealliance/weval/releases/download/$WEVAL_VERSION/weval-$WEVAL_VERSION-x86_64-linux.tar.xz" | |
| tar -xvJf "weval-$WEVAL_VERSION-x86_64-linux.tar.xz" | |
| mv "weval-$WEVAL_VERSION-x86_64-linux/weval" .weval-bin | |
| - if: ${{ steps.cache-weval-bin.outputs.cache-hit != 'true' && startsWith(matrix.os, 'macos') }} | |
| env: | |
| WEVAL_VERSION: ${{ steps.weval-meta.outputs.version }} | |
| run: | | |
| curl -LO "https://github.com/bytecodealliance/weval/releases/download/$WEVAL_VERSION/weval-$WEVAL_VERSION-aarch64-macos.tar.xz" | |
| tar -xvJf "weval-$WEVAL_VERSION-aarch64-macos.tar.xz" | |
| mkdir .weval-bin | |
| mv "weval-$WEVAL_VERSION-aarch64-macos/weval" .weval-bin/ | |
| - name: Install NPM packages | |
| run: pnpm install | |
| - name: Restore jco build transpilation output | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| name: jco-build-transpiled | |
| path: packages/jco/obj | |
| - name: Restore jco TS build output | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| name: jco-build-ts | |
| path: packages/jco/dist | |
| - name: Restore preview2-shim build output | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| name: build-preview2-shim | |
| path: packages/preview2-shim/dist | |
| - name: Test jco (node@lts) | |
| if: matrix.node != 'latest' | |
| working-directory: packages/jco | |
| run: | | |
| pnpm --filter '@bytecodealliance/jco' run test:lts -- --maxWorkers 4 --minWorkers 2 --maxConcurrency 2 | |
| - name: Test jco (node@latest) | |
| if: matrix.node == 'latest' | |
| working-directory: packages/jco | |
| env: | |
| WEVAL_BIN_PATH: ${{ matrix.weval-bin-path }} | |
| run: | | |
| pnpm --filter '@bytecodealliance/jco' run test -- --maxWorkers 4 --minWorkers 2 --maxConcurrency 2 | |
| test-jco-transpile: | |
| runs-on: ${{ matrix.os }} | |
| needs: | |
| - build | |
| strategy: | |
| matrix: | |
| os: | |
| - ubuntu-22.04 # https://github.com/puppeteer/puppeteer/issues/12818#issuecomment-2593659514 | |
| - macos-latest | |
| node: | |
| - 22.x | |
| - 24.x | |
| - latest # 26.x | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 | |
| with: | |
| node-version: ${{ matrix.node }} | |
| - uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9 | |
| with: | |
| version: 11 | |
| - uses: taiki-e/cache-cargo-install-action@417450f3c33ee20393705369577571770643d4c7 # v3.0.7 | |
| with: | |
| tool: wasm-tools@1.244.0 | |
| - name: Install NPM packages | |
| run: pnpm install | |
| - name: Cache puppeteer install | |
| if: ${{ startsWith(matrix.os, 'ubuntu') }} | |
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| with: | |
| key: puppeteer-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('pnpm-lock.yaml') }} | |
| path: | | |
| /home/runner/.cache/puppeteer | |
| - name: Cache puppeteer install | |
| if: ${{ startsWith(matrix.os, 'macos') }} | |
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| with: | |
| key: puppeteer-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('pnpm-lock.yaml') }} | |
| path: | | |
| /Users/runner/.cache/puppeteer | |
| # NOTE: We can stop pinning the version of puppeteer when the version that the mac atttempts to use | |
| # syncs up (right now newest is 148.0.7778.178, but puppeteer will attempt to use 148.0.7778.97) | |
| - name: Install puppeteer (pinned) | |
| if: ${{ matrix.node == 'latest' }} | |
| run: | | |
| export PUPPETEER_VERSION=148.0.7778.97 | |
| pnpm run test:setup:puppeteer | |
| - name: Install puppeteer | |
| if: ${{ matrix.node != 'latest' }} | |
| run: | | |
| pnpm run test:setup:puppeteer | |
| - name: Restore jco-transpile build output | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| name: jco-transpile-vendor | |
| path: packages/jco-transpile/vendor | |
| - name: Restore artifacts for JS tests | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| name: js-generated-tests | |
| path: packages/jco-transpile/test/fixtures/generated | |
| - name: Restore preview2-shim build output | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| name: build-preview2-shim | |
| path: packages/preview2-shim/dist | |
| - name: Test jco-transpile (node@lts) | |
| if: matrix.node != 'latest' | |
| working-directory: packages/jco-transpile | |
| run: | | |
| pnpm --filter '@bytecodealliance/jco-transpile' run test:lts -- --maxWorkers 4 --minWorkers 2 --maxConcurrency 2 | |
| - name: Test jco-transpile (node@latest) | |
| if: matrix.node == 'latest' | |
| working-directory: packages/jco-transpile | |
| run: | | |
| pnpm --filter '@bytecodealliance/jco-transpile' run test -- --maxWorkers 4 --minWorkers 2 --maxConcurrency 2 | |
| test-wasi-deno: | |
| runs-on: "ubuntu-latest" | |
| needs: | |
| - build | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| 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@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 | |
| with: | |
| node-version: "latest" | |
| - uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9 | |
| with: | |
| version: 11 | |
| - uses: denoland/setup-deno@22d081ff2d3a40755e97629de92e3bcbfa7cf2ed # v2.0.5 | |
| with: | |
| deno-version: v1.x | |
| - name: Cache node modules | |
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| with: | |
| key: node-modules-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('pnpm-lock.yaml') }} | |
| path: | | |
| node_modules | |
| - name: Install node modules | |
| run: pnpm install | |
| - name: Restore jco build transpilation output | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| name: jco-build-transpiled | |
| path: packages/jco/obj | |
| - name: Restore jco TS build output | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| name: jco-build-ts | |
| path: packages/jco/dist | |
| - name: Restore artifacts for JS tests | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| name: js-generated-tests | |
| path: packages/jco-transpile/test/fixtures/generated | |
| - name: Restore preview2-shim build output | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| name: build-preview2-shim | |
| path: packages/preview2-shim/dist | |
| - 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 | |
| - macos-latest | |
| node: | |
| - 22.x | |
| - 24.x | |
| - latest | |
| fail-fast: false | |
| runs-on: ${{ matrix.os }} | |
| needs: | |
| - build | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| 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@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 | |
| with: | |
| node-version: ${{ matrix.node }} | |
| - uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9 | |
| with: | |
| version: 11 | |
| - name: Cache node modules | |
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| with: | |
| key: node-modules-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('pnpm-lock.yaml') }} | |
| path: | | |
| node_modules | |
| - name: Restore jco build transpilation output | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| name: jco-build-transpiled | |
| path: packages/jco/obj | |
| - name: Restore jco TS build output | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| name: jco-build-ts | |
| path: packages/jco/dist | |
| - name: Restore artifacts for JS tests | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| name: js-generated-tests | |
| path: packages/jco-transpile/test/fixtures/generated | |
| - name: Restore preview2-shim build output | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| name: build-preview2-shim | |
| path: packages/preview2-shim/dist | |
| - name: Install node modules | |
| run: pnpm 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@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: Install Rust | |
| run: rustup update stable --no-self-update | |
| - uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1 | |
| with: | |
| shared-key: jco-${{ hashFiles('Cargo.lock') }} | |
| - uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9 | |
| with: | |
| version: 11 | |
| - name: Cache node modules | |
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| with: | |
| key: node-modules-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('pnpm-lock.yaml') }} | |
| path: | | |
| node_modules | |
| - name: Install node modules | |
| run: pnpm install | |
| - name: Cache puppeteer install | |
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| with: | |
| key: puppeteer-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('pnpm-lock.yaml') }} | |
| path: | | |
| /home/runner/.cache/puppeteer | |
| - name: Install puppeteer | |
| run: | | |
| pnpm run test:setup:puppeteer | |
| - name: Build jco | |
| run: pnpm run build | |
| - name: Test Workspaces | |
| env: | |
| TEST_PUPPETEER_LAUNCH_ARGS: | | |
| --no-sandbox | |
| run: pnpm --filter 'packages/${{ matrix.workspace }}' run test | |
| # Release gate: prove @bytecodealliance/jco's browser entry can be resolved | |
| # and bundled by a browser-targeted bundler against the actual packed tarballs. | |
| # Catches regressions like a `files` omission or an import path that only breaks | |
| # when the package is consumed via npm (not the local workspace). | |
| browser-bundle-smoke: | |
| runs-on: ubuntu-latest | |
| needs: | |
| - build | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 | |
| with: | |
| node-version: "latest" | |
| - uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9 | |
| with: | |
| version: 11 | |
| - name: Cache node modules | |
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| with: | |
| key: node-modules-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('pnpm-lock.yaml') }} | |
| path: | | |
| node_modules | |
| - name: Install node modules | |
| run: pnpm install | |
| - name: Restore jco build transpilation output | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| name: jco-build-transpiled | |
| path: packages/jco/obj | |
| - name: Restore jco TS build output | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| name: jco-build-ts | |
| path: packages/jco/dist | |
| - name: Restore jco-transpile vendor | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| name: jco-transpile-vendor | |
| path: packages/jco-transpile/vendor | |
| - name: Bundle browser entry against packed tarballs | |
| run: node scripts/build-browser-bundle.mjs | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9 | |
| with: | |
| version: 11 | |
| - name: Cache node modules | |
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| with: | |
| key: node-modules-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('pnpm-lock.yaml') }} | |
| path: | | |
| node_modules | |
| - name: Install node modules | |
| run: pnpm install | |
| - name: Lint | |
| run: pnpm run lint | |
| fmt: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9 | |
| with: | |
| version: 11 | |
| - name: Cache node modules | |
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| with: | |
| key: node-modules-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('pnpm-lock.yaml') }} | |
| path: | | |
| node_modules | |
| - name: Install node modules | |
| run: pnpm install | |
| - name: Format | |
| run: pnpm run fmt:check | |
| rustfmt: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - 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@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1 | |
| - name: Format source code | |
| run: cargo fmt -- --check | |
| clippy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - 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@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1 | |
| - name: Run clippy | |
| run: cargo clippy --workspace --all-features --all-targets --keep-going -- -D warnings | |
| test-js-workspace-packages: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| workspace: | |
| - jco-std | |
| - rolldown-plugin-jco | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: Install Rust | |
| run: rustup update stable --no-self-update | |
| - uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1 | |
| with: | |
| shared-key: jco-${{ hashFiles('Cargo.lock') }} | |
| - uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9 | |
| with: | |
| version: 11 | |
| - name: Cache node modules | |
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| with: | |
| key: node-modules-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('pnpm-lock.yaml') }} | |
| path: | | |
| node_modules | |
| - uses: taiki-e/cache-cargo-install-action@417450f3c33ee20393705369577571770643d4c7 # v3.0.7 | |
| with: | |
| tool: wasmtime-cli@40.0.2 | |
| - name: Install node modules | |
| working-directory: packages/${{ matrix.workspace }} | |
| run: | | |
| pnpm install | |
| - name: Build workspace dependencies and package | |
| run: | | |
| if [ "${{ matrix.workspace }}" = "jco-std" ]; then | |
| pnpm --filter "packages/jco-transpile" run build | |
| pnpm --filter "packages/${{ matrix.workspace }}" run build | |
| else | |
| pnpm --filter "packages/${{ matrix.workspace }}" run build | |
| fi | |
| - name: run test on workspace | |
| run: | | |
| pnpm --filter "packages/${{ matrix.workspace }}" run test | |
| 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 | |
| uses-webidl2wit: true | |
| - 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-transpile: true | |
| setup-std: true | |
| - 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 | |
| - name: node-compat | |
| workspace: examples/components/node-compat | |
| - name: fs-write-file | |
| workspace: examples/components/fs-write-file | |
| - name: p3-stream-chat | |
| workspace: examples/transpile/p3-stream-chat | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 | |
| with: | |
| node-version: ${{ matrix.node.version }} | |
| - uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9 | |
| with: | |
| version: 11 | |
| - name: Restore jco build transpilation output | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| name: jco-build-transpiled | |
| path: packages/jco/obj | |
| - name: Restore jco TS build output | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| name: jco-build-ts | |
| path: packages/jco/dist | |
| - name: Restore artifacts for JS tests | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| name: js-generated-tests | |
| path: packages/jco-transpile/test/fixtures/generated | |
| - name: Restore jco-transpile vendor | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| name: jco-transpile-vendor | |
| path: | | |
| packages/jco-transpile/vendor | |
| - name: Install Rust | |
| if: ${{ matrix.project.uses-webidl2wit }} | |
| run: rustup update stable --no-self-update && rustup default stable | |
| - name: install webidl2wit-cli | |
| if: ${{ matrix.project.uses-webidl2wit }} | |
| uses: taiki-e/cache-cargo-install-action@417450f3c33ee20393705369577571770643d4c7 # v3.0.7 | |
| with: | |
| tool: webidl2wit-cli | |
| - name: Install wac | |
| if: ${{ matrix.project.is-composed }} | |
| uses: jaxxstorm/action-install-gh-release@25e24d2d23ae098373794ef1d6faecb48ee52da8 # v3.0.0 | |
| with: | |
| repo: bytecodealliance/wac | |
| tag: v${{ matrix.wac.version }} | |
| extension-matching: disable | |
| rename-to: wac | |
| chmod: 0755 | |
| - uses: bytecodealliance/actions/wasmtime/setup@9152e710e9f7182e4c29ad218e4f335a7b203613 # v1.1.3 | |
| - name: Cache node modules | |
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| with: | |
| key: node-modules-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('pnpm-lock.yaml') }} | |
| path: | | |
| node_modules | |
| - run: pnpm install | |
| - name: Build required deps | |
| env: | |
| SETUP_TRANSPILE: ${{ matrix.project.setup-transpile }} | |
| SETUP_STD: ${{ matrix.project.setup-std }} | |
| run: | | |
| if [ "true" == "$SETUP_TRANSPILE" ]; then | |
| pnpm run --filter '@bytecodealliance/jco-transpile' build | |
| fi | |
| if [ "true" == "$SETUP_STD" ]; then | |
| pnpm run --filter '@bytecodealliance/jco-std' build | |
| fi | |
| - name: Run all script for (${{ matrix.project.name }}) | |
| run: | | |
| pnpm --filter '${{ matrix.project.workspace }}' run all | |
| test-extended: | |
| runs-on: ${{ matrix.os }} | |
| needs: | |
| - build | |
| permissions: | |
| contents: read | |
| strategy: | |
| matrix: | |
| os: | |
| - ubuntu-latest | |
| node: | |
| - latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 | |
| with: | |
| node-version: ${{ matrix.node }} | |
| - uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9 | |
| with: | |
| version: 11 | |
| - uses: taiki-e/cache-cargo-install-action@417450f3c33ee20393705369577571770643d4c7 # v3.0.7 | |
| with: | |
| tool: wasm-tools | |
| - uses: taiki-e/cache-cargo-install-action@417450f3c33ee20393705369577571770643d4c7 # v3.0.7 | |
| with: | |
| tool: wit-bindgen-cli | |
| - uses: taiki-e/cache-cargo-install-action@417450f3c33ee20393705369577571770643d4c7 # v3.0.7 | |
| with: | |
| tool: wac-cli | |
| - uses: taiki-e/cache-cargo-install-action@417450f3c33ee20393705369577571770643d4c7 # v3.0.7 | |
| with: | |
| tool: just | |
| - uses: taiki-e/cache-cargo-install-action@417450f3c33ee20393705369577571770643d4c7 # v3.0.7 | |
| with: | |
| tool: wkg | |
| - id: wasi-sdk | |
| uses: bytecodealliance/setup-wasi-sdk-action@b2de090b44eb70013ee96b393727d473b35e1728 | |
| - uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0 | |
| - run: pnpm install | |
| - name: Restore jco build transpilation output | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| name: jco-build-transpiled | |
| path: packages/jco/obj | |
| - name: Restore jco TS build output | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| name: jco-build-ts | |
| path: packages/jco/dist | |
| - name: Build extended component tree | |
| working-directory: test/components | |
| env: | |
| WASI_SDK: ${{ steps.wasi-sdk.outputs.wasi-sdk-path }} | |
| run: just build | |
| - name: Run extended component tests | |
| run: | | |
| pnpm --filter '@bytecodealliance/jco' run test:extended |