diff --git a/.github/workflows/main-windows.yml b/.github/workflows/main-windows.yml new file mode 100644 index 000000000..01bc468ba --- /dev/null +++ b/.github/workflows/main-windows.yml @@ -0,0 +1,291 @@ +# +# This file contains tests that only run on windows, and is otherwise identical +# to main.yml. +# +# Windows tests have been relegated to this file because they are incredibly slow +# in GH actions, and inconsistently hang. +# +# Until those problems are fixed, this workflow should be run against release PRs +# +name: main-windows + +on: + pull_request: + branches: + - main + +defaults: + run: + shell: bash + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +permissions: {} + +jobs: + build: + if: ${{ startsWith(github.event.pull_request.title, 'release:') }} + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + + - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 + with: + node-version: "latest" + + - uses: pnpm/action-setup@0e279bb959325dab635dd2c09392533439d90093 # v6.0.8 + 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@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 + with: + key: node-modules-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('package-lock.json') }} + 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 output + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: build + path: packages/jco/obj + + - name: Upload artifacts for js tests + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: js-generated-tests + path: packages/jco/test/output + + - 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 + + test-jco: + if: ${{ startsWith(github.event.pull_request.title, 'release:') }} + runs-on: ${{ matrix.os }} + permissions: + contents: read + needs: + - build + strategy: + matrix: + os: + - windows-2025 + node: + - 20.x + - 22.x + - 24.x + - latest # 26.x + include: + - os: windows-2025 + 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: windows-2025 + node: latest + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + + - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 + with: + node-version: ${{ matrix.node }} + + - uses: pnpm/action-setup@0e279bb959325dab635dd2c09392533439d90093 # v6.0.8 + 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: | + 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@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 + 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, 'windows') }} + 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-windows.zip + unzip weval-${WEVAL_VERSION}-x86_64-windows.zip + mv weval-${WEVAL_VERSION}-x86_64-windows .weval-bin + + - name: Install NPM packages + run: pnpm install + + - name: Cache puppeteer install + if: ${{ startsWith(matrix.os, 'windows') }} + uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 + with: + key: puppeteer-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('packages/jco/package.json') }} + path: | + /c/users/runneradmin/.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 build output + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: build + path: packages/jco/obj + + - name: Restore artifacts for JS tests + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: js-generated-tests + path: packages/jco/test/output + + - name: Test LTS Node.js + if: matrix.node != 'latest' + working-directory: packages/jco + run: | + pnpm --filter '@bytecodealliance/jco' 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: | + pnpm --filter '@bytecodealliance/jco' run test -- --maxWorkers 4 --minWorkers 2 --maxConcurrency 2 + + test-wasi-node: + if: ${{ startsWith(github.event.pull_request.title, 'release:') }} + needs: + - build + runs-on: ${{ matrix.os }} + permissions: + contents: read + strategy: + fail-fast: false + matrix: + os: + - windows-2025 + node: + - 20.x + - 22.x + - 24.x + - latest + exclude: + # TODO: windows conformance tests hang periodically + - os: windows-2025 + node: 20.x + - os: windows-2025 + node: 22.x + - os: windows-2025 + node: 24.x + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + submodules: recursive + persist-credentials: false + + - 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@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 + with: + node-version: ${{ matrix.node }} + + - uses: pnpm/action-setup@0e279bb959325dab635dd2c09392533439d90093 # v6.0.8 + with: + version: 11 + + - name: Cache node modules + uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 + with: + key: node-modules-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('package-lock.json') }} + path: | + node_modules + + - name: Restore jco build output + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: build + path: packages/jco/obj + + - name: Restore artifacts for JS tests + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: js-generated-tests + path: packages/jco/test/output + + - 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_ diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ace09ae16..484e07658 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -18,6 +18,8 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true +permissions: {} + jobs: build: runs-on: ubuntu-latest @@ -91,7 +93,6 @@ jobs: matrix: os: - ubuntu-22.04 # https://github.com/puppeteer/puppeteer/issues/12818#issuecomment-2593659514 - - windows-2025 - macos-latest node: - 20.x @@ -99,8 +100,6 @@ jobs: - 24.x - latest # 26.x include: - - os: windows-2025 - weval-bin-path: .weval-bin/weval.exe - os: ubuntu-22.04 weval-bin-path: .weval-bin/weval - os: macos-latest @@ -108,8 +107,6 @@ jobs: exclude: - os: macos-latest node: 20.x - - os: windows-2025 - node: latest steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 @@ -147,11 +144,6 @@ jobs: 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' && startsWith(matrix.os, 'windows') }} - 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' && startsWith(matrix.os, 'macos') }} 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 @@ -178,14 +170,6 @@ jobs: path: | /Users/runner/.cache/puppeteer - - name: Cache puppeteer install - if: ${{ startsWith(matrix.os, 'windows') }} - uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 - with: - key: puppeteer-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('packages/jco/package.json') }} - path: | - /c/users/runneradmin/.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) @@ -286,21 +270,12 @@ jobs: matrix: os: - ubuntu-latest - - windows-2025 - macos-latest node: - 20.x - 22.x - 24.x - latest - exclude: - # TODO: windows conformance tests hang periodically - - os: windows-2025 - node: 20.x - - os: windows-2025 - node: 22.x - - os: windows-2025 - node: 24.x fail-fast: false runs-on: ${{ matrix.os }} needs: