Expand CI #202
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: | |
| push: | |
| branches: ["main"] | |
| pull_request: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref_name }} | |
| cancel-in-progress: true | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| host: | |
| name: Test Host ${{ matrix.os.description }} | |
| runs-on: ${{ matrix.os.os }} | |
| timeout-minutes: 20 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: | |
| - { os: ubuntu-latest, description: Linux } | |
| - { os: macos-latest, description: MacOS } | |
| - { os: windows-latest, description: Windows } | |
| defaults: | |
| run: | |
| working-directory: host | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install Rust | |
| run: rustup target add wasm32-unknown-unknown | |
| - name: Install LLVM | |
| uses: ZhongRuoyu/setup-llvm@ec41d6e5f3c15c96fa642a49c6e7effac6261778 | |
| with: | |
| # Rustc v1.93 | |
| llvm-version: 21 | |
| - name: Run Tests | |
| run: cargo test --all-features --no-fail-fast | |
| client: | |
| name: | |
| Test Client ${{ matrix.os.description }} ${{ matrix.target.description }} ${{ | |
| matrix.target-feature.description }} | |
| runs-on: ${{ matrix.os.os }} | |
| timeout-minutes: 20 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: | |
| - { os: ubuntu-latest, description: Linux } | |
| - { os: macos-latest, description: MacOS } | |
| - { os: windows-latest, description: Windows } | |
| target: | |
| - { target: wasm32-unknown-unknown, install: true, rust: stable, description: Wasm32 } | |
| - { | |
| target: wasm64-unknown-unknown, | |
| install: false, | |
| rust: nightly, | |
| components: -c rust-src, | |
| args: '-Zbuild-std="panic_abort,std"', | |
| description: Wasm64, | |
| } | |
| target-feature: | |
| - {} | |
| - { | |
| rust: nightly, | |
| components: -c rust-src, | |
| rustflags: -Ctarget-feature=+atomics -Clink-arg=--shared-memory, | |
| args: '-Zbuild-std="panic_abort,std"', | |
| description: Atomics, | |
| } | |
| runner: | |
| - { runner: node-js, description: NodeJs } | |
| - { runner: deno, description: Deno } | |
| - { runner: browser, browser: chromedriver, description: Chrome } | |
| - { runner: browser, browser: geckodriver, description: Firefox } | |
| - { runner: browser, browser: safaridriver, description: Safari } | |
| exclude: | |
| - os: { os: ubuntu-latest, description: Linux } | |
| runner: { runner: browser, browser: safaridriver } | |
| - os: { os: windows-latest, description: Windows } | |
| runner: { runner: browser, browser: safaridriver, description: Safari } | |
| defaults: | |
| run: | |
| working-directory: client | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install Rust | |
| run: | | |
| rustup install --profile minimal ${{ matrix.target-feature.components || matrix.target.components }} ${{ matrix.target-feature.rust || matrix.target.rust }} | |
| rustup default ${{ matrix.target-feature.rust || matrix.target.rust }} | |
| - name: Install Target | |
| if: matrix.target.install | |
| run: rustup target add ${{ matrix.target.target }} | |
| - name: Set Target `RUSTFLAG` | |
| shell: bash | |
| run: | | |
| TARGET=$(echo "${{ matrix.target.target }}" | tr '[:lower:]-' '[:upper:]_') | |
| echo "CARGO_TARGET_${TARGET}_RUSTFLAGS=${{ matrix.target-feature.rustflags }}" >> $GITHUB_ENV | |
| - name: Install LLVM | |
| uses: ZhongRuoyu/setup-llvm@ec41d6e5f3c15c96fa642a49c6e7effac6261778 | |
| with: | |
| # Rustc v1.93 | |
| llvm-version: 21 | |
| - name: Install TSC | |
| if: runner.os == 'macOS' || runner.os == 'Windows' | |
| run: npm install -g typescript | |
| - name: Set Test Runner | |
| run: echo "JBG_TEST_RUNNER=${{ matrix.runner.runner }}" >> $GITHUB_ENV | |
| - name: Set Test WebDriver | |
| if: matrix.runner.browser | |
| shell: bash | |
| run: | | |
| DRIVER=$(echo "${{ matrix.runner.browser }}" | tr '[:lower:]' '[:upper:]') | |
| echo "BG_TEST_${DRIVER}=${{ matrix.runner.browser }}" >> $GITHUB_ENV | |
| - name: Update Node.js | |
| if: runner.os == 'Linux' || runner.os == 'macOS' | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: latest | |
| - name: Run Tests | |
| run: | |
| cargo test --workspace --all-features --no-fail-fast --target ${{ matrix.target.target }} | |
| ${{ matrix.target-feature.args || matrix.target.args }} |