release: jco-transpile v0.1.2 #4429
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 | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.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@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3 | |
| 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: Build rust test components | |
| run: npm run build:test:components | |
| - name: Upload jco build | |
| uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 | |
| with: | |
| name: jco-build | |
| path: | | |
| packages/jco/obj | |
| - name: Upload jco test components | |
| uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 | |
| with: | |
| name: jco-test-components | |
| path: | | |
| packages/jco/test/output/rust-test-components | |
| - name: Build jco-transpile | |
| run: npm run build -w @bytecodealliance/jco-transpile | |
| - name: Upload jco-transpile vendor | |
| uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0 | |
| with: | |
| node-version: ${{ matrix.node }} | |
| - uses: taiki-e/cache-cargo-install-action@34ce5120836e5f9f1508d8713d7fdea0e8facd6f # v3.0.1 | |
| with: | |
| tool: wasm-tools@1.244.0 | |
| # 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@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3 | |
| 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@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3 | |
| 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@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0 | |
| with: | |
| name: jco-build | |
| path: | | |
| packages/jco/obj | |
| - name: Restore jco test components | |
| uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0 | |
| with: | |
| name: jco-test-components | |
| path: | | |
| packages/jco/test/output/rust-test-components | |
| - 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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| 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@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.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@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3 | |
| 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@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0 | |
| with: | |
| name: jco-build | |
| path: | | |
| packages/jco/obj | |
| - name: Restore jco test components | |
| uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0 | |
| with: | |
| name: jco-test-components | |
| path: | | |
| packages/jco/test/output/rust-test-components | |
| - 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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| 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@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0 | |
| with: | |
| node-version: ${{ matrix.node }} | |
| - name: Cache npm install | |
| uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3 | |
| with: | |
| key: node-modules-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('package-lock.json') }} | |
| path: | | |
| node_modules | |
| - name: Restore jco build | |
| uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0 | |
| with: | |
| name: jco-build | |
| path: | | |
| packages/jco/obj | |
| - name: Restore jco test components | |
| uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0 | |
| with: | |
| name: jco-test-components | |
| path: | | |
| packages/jco/test/output/rust-test-components | |
| - 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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - 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@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3 | |
| 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@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3 | |
| 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 }} | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Cache npm install | |
| uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3 | |
| 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 | |
| fmt: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Cache npm install | |
| uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3 | |
| with: | |
| key: node-modules-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('package-lock.json') }} | |
| path: | | |
| node_modules | |
| - name: Install NPM packages | |
| run: npm install | |
| - name: Format | |
| run: npm run fmt:check | |
| rustfmt: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - 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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - 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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - 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@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3 | |
| with: | |
| key: node-modules-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('package-lock.json') }} | |
| path: | | |
| node_modules | |
| - uses: taiki-e/cache-cargo-install-action@34ce5120836e5f9f1508d8713d7fdea0e8facd6f # v3.0.1 | |
| with: | |
| tool: wasmtime-cli@40.0.2 | |
| - 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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0 | |
| with: | |
| node-version: ${{ matrix.node.version }} | |
| - name: Restore jco build | |
| uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0 | |
| with: | |
| name: jco-build | |
| path: | | |
| packages/jco/obj | |
| - name: Restore jco test components | |
| uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0 | |
| with: | |
| name: jco-test-components | |
| path: | | |
| packages/jco/test/output/rust-test-components | |
| - name: Restore jco-transpile vendor | |
| uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.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@288875dd3d64326724fa6d9593062d9f8ba0b131 # 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@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3 | |
| 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 }} |