♻️ Expand test for list subcommand #11374
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: Build Webassembly | |
| permissions: | |
| contents: read | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| push: | |
| jobs: | |
| test: | |
| name: Test WebAssembly | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| rust: | |
| - stable | |
| - beta | |
| - nightly-2025-12-09 | |
| target: | |
| - wasm32-unknown-emscripten | |
| - wasm32-unknown-unknown | |
| - wasm32-wasip1 | |
| - wasm32-wasip2 | |
| include: | |
| - target: wasm32-unknown-emscripten | |
| container: emscripten/emsdk:latest | |
| runner: ubuntu-latest | |
| - target: wasm32-unknown-unknown | |
| container: ghcr.io/portable-network-archive/wasi-sdk-gh-actions:wasi-sdk-27 | |
| runner: ubuntu-24.04-arm | |
| - target: wasm32-wasip1 | |
| container: ghcr.io/portable-network-archive/wasi-sdk-gh-actions:wasi-sdk-27 | |
| runner: ubuntu-24.04-arm | |
| - target: wasm32-wasip2 | |
| container: ghcr.io/portable-network-archive/wasi-sdk-gh-actions:wasi-sdk-27 | |
| runner: ubuntu-24.04-arm | |
| runs-on: ${{ matrix.runner }} | |
| container: ${{ matrix.container }} | |
| timeout-minutes: 60 | |
| steps: | |
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| submodules: true | |
| - uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # v1.15.2 | |
| with: | |
| target: ${{ matrix.target }} | |
| toolchain: ${{ matrix.rust }} | |
| rustflags: '' | |
| - if: ${{ startsWith(matrix.target, 'wasm32-wasi') }} | |
| name: Setup wasmtime | |
| uses: bytecodealliance/actions/wasmtime/setup@6aecabac1eb1dcf7ed94ba9471974415ee2ebef2 # v1.1.2 | |
| with: | |
| github_token: ${{ github.token }} | |
| - if: ${{ startsWith(matrix.target, 'wasm32-wasi') }} | |
| name: Run test | |
| run: | | |
| cargo test -p libpna --locked --target ${{ matrix.target }} -- --nocapture | |
| - if: ${{ startsWith(matrix.target, 'wasm32-wasip1') && matrix.rust == 'nightly'}} | |
| name: Run test | |
| run: | | |
| cargo test --locked --target ${{ matrix.target }} -- --nocapture | |
| - if: ${{ startsWith(matrix.target, 'wasm32-unknown-emscripten') && matrix.rust != 'nightly' }} | |
| name: Run test | |
| run: | | |
| cargo test -p libpna --locked --target ${{ matrix.target }} -- --skip test_readme_deps --skip test_html_root_url | |
| env: | |
| RUSTFLAGS: "-C link-arg=-sINITIAL_MEMORY=512MB -C link-arg=-sTOTAL_STACK=16MB" | |
| - name: Run on Node.js | |
| if: ${{ startsWith(matrix.target, 'wasm32-unknown-emscripten') && matrix.rust == 'nightly' }} | |
| run: | | |
| cargo run -p portable-network-archive --locked --target ${{ matrix.target }} --release -- --help | |
| env: | |
| RUSTFLAGS: "-C link-arg=-sINITIAL_MEMORY=512MB -C link-arg=-sTOTAL_STACK=16MB" | |
| - if: ${{ endsWith(matrix.target, 'unknown') }} | |
| name: get wasm-bindgen version | |
| id: get_version | |
| run: | | |
| VERSION=$(cargo metadata --locked --format-version 1 | jq -r '.packages[] | select(.name == "wasm-bindgen") | .version') | |
| echo "version=${VERSION}" >> "$GITHUB_OUTPUT" | |
| - if: ${{ endsWith(matrix.target, 'unknown') }} | |
| name: Install cargo-binstall | |
| uses: cargo-bins/cargo-binstall@a66119fbb1c952daba62640c2609111fe0803621 # v1.15.7 | |
| - if: ${{ endsWith(matrix.target, 'unknown') }} | |
| name: Install wasm-bindgen-cli from crates.io | |
| run: | | |
| cargo binstall --no-confirm --force wasm-bindgen-cli --version ${{ steps.get_version.outputs.version }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # For ease GitHub API rate limits | |
| - if: ${{ endsWith(matrix.target, 'unknown') }} | |
| name: Run test | |
| run: | | |
| cargo test -p libpna --locked --target ${{ matrix.target }} --release |