Add real wasm32 smoke tests and CI job #485
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 Suite | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - kyoto | |
| pull_request: | |
| branches: | |
| - main | |
| - kyoto | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/main' && github.run_id || github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| PANDOC_VERSION: "3.8.3" | |
| jobs: | |
| test-suite: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest] | |
| runs-on: ${{ matrix.os }} | |
| name: Run test suite | |
| if: github.repository == 'quarto-dev/q2' | |
| steps: | |
| - name: Checkout Repo | |
| uses: actions/checkout@v6 | |
| # Fix mtimes IMMEDIATELY after checkout, before anything else | |
| - name: Restore file modification times | |
| shell: bash | |
| run: | | |
| git ls-files | while read file; do | |
| time=$(git log -1 --format='@%ct' -- "$file" 2>/dev/null || echo '@0') | |
| [ "$time" != "@0" ] && touch -d "$time" "$file" 2>/dev/null || true | |
| done | |
| - name: Set up Homebrew | |
| if: runner.os == 'macOS' | |
| id: set-up-homebrew | |
| uses: Homebrew/actions/setup-homebrew@main | |
| # Install toolchain from rust-toolchain.toml (nightly + components + targets) | |
| - name: Set up Rust | |
| run: rustup show active-toolchain | |
| # Cache Rust AFTER toolchain is set up | |
| - name: Cache Rust dependencies | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| cache-on-failure: true | |
| shared-key: "rust-test-suite" | |
| # Cache cargo-nextest and insta separately to avoid reinstalling | |
| - name: Install nextest | |
| uses: taiki-e/install-action@nextest | |
| - name: Install cargo-insta | |
| uses: taiki-e/install-action@v2 | |
| with: | |
| tool: cargo-insta | |
| # Pandoc setup (pinned to match Quarto 1.9) | |
| - name: Set up Pandoc (Linux) | |
| if: runner.os == 'Linux' | |
| run: | | |
| curl -LO "https://github.com/jgm/pandoc/releases/download/${PANDOC_VERSION}/pandoc-${PANDOC_VERSION}-1-amd64.deb" | |
| sudo dpkg -i "pandoc-${PANDOC_VERSION}-1-amd64.deb" | |
| shell: bash | |
| - name: Set up Pandoc (macOS) | |
| if: runner.os == 'macOS' | |
| run: | | |
| curl -LO "https://github.com/jgm/pandoc/releases/download/${PANDOC_VERSION}/pandoc-${PANDOC_VERSION}-arm64-macOS.pkg" | |
| sudo installer -pkg "pandoc-${PANDOC_VERSION}-arm64-macOS.pkg" -target / | |
| shell: bash | |
| # tree-sitter setup | |
| - name: Set up tree-sitter CLI (Linux) | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libc6-dev gcc-multilib | |
| curl -LO https://github.com/tree-sitter/tree-sitter/releases/download/v0.25.8/tree-sitter-linux-x86.gz | |
| gunzip tree-sitter-linux-x86.gz | |
| chmod +x tree-sitter-linux-x86 | |
| sudo mv tree-sitter-linux-x86 /usr/local/bin/tree-sitter | |
| - name: Set up tree-sitter CLI (macOS) | |
| if: runner.os == 'macOS' | |
| run: brew install tree-sitter-cli | |
| # Free disk space on Linux runners (14 GB SSD is tight for Rust monorepo) | |
| - name: Free disk space | |
| if: runner.os == 'Linux' | |
| uses: endersonmenezes/free-disk-space@7901478139cff6e9d44df5972fd8ab8fcade4db1 # v3 | |
| with: | |
| remove_android: true | |
| remove_dotnet: true | |
| remove_haskell: true | |
| # Custom lint checks (before build to fail fast) | |
| - name: Run custom lints | |
| shell: bash | |
| run: cargo xtask lint | |
| # Build and test | |
| # Deny warnings in CI so they don't accumulate silently | |
| - name: Build | |
| shell: bash | |
| run: cargo build | |
| env: | |
| RUSTFLAGS: "-D warnings" | |
| - name: Test block tree-sitter grammar | |
| shell: bash | |
| run: | | |
| cd crates/tree-sitter-qmd/tree-sitter-markdown | |
| tree-sitter test | |
| - name: Test Rust code | |
| shell: bash | |
| run: cargo nextest run | |
| env: | |
| RUSTFLAGS: "-D warnings" | |
| wasm-tests: | |
| name: WASM Tests | |
| runs-on: ubuntu-latest | |
| # Override rust-toolchain.toml so the rustup proxy doesn't auto-install the | |
| # prebuilt wasm32-unknown-unknown target. We need -Zbuild-std to rebuild | |
| # core from source, and the prebuilt sysroot causes E0152 (duplicate lang | |
| # item). The production WASM build avoids this because wasm-quarto-hub-client | |
| # is excluded from the workspace and gets an isolated target/ directory. | |
| env: | |
| RUSTUP_TOOLCHAIN: nightly | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 | |
| - name: Install Rust nightly with rust-src | |
| run: rustup toolchain install nightly --component rust-src --profile minimal | |
| - name: Set up Clang | |
| uses: egor-tensin/setup-clang@v1 | |
| with: | |
| version: latest | |
| platform: x64 | |
| - name: Rust cache | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| shared-key: rust-wasm-tests | |
| - name: Install wasm-bindgen-cli | |
| run: cargo xtask dev-setup | |
| - name: Run WASM tests | |
| run: | | |
| CC_wasm32_unknown_unknown=clang \ | |
| CFLAGS_wasm32_unknown_unknown="-isystem ${{ github.workspace }}/crates/wasm-quarto-hub-client/wasm-sysroot -fno-builtin" \ | |
| cargo test -p pampa --test wasm_lua --target wasm32-unknown-unknown \ | |
| --no-default-features --features lua-filter -Zbuild-std=std,panic_unwind,panic_abort |