Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 38 additions & 5 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ env:

jobs:
client:
name: Build Client ${{ matrix.os.description }}
name:
Build Client ${{ matrix.os.description }} ${{ matrix.target.description }} ${{
matrix.target-feature.description }}

runs-on: ${{ matrix.os.os }}

Expand All @@ -27,6 +29,25 @@ jobs:
- { 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,
}

defaults:
run:
Expand All @@ -36,16 +57,28 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust
run: rustup target add wasm32-unknown-unknown
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'
if: runner.os == 'macOS' || runner.os == 'Windows'
run: npm install -g typescript
- name: Build Crates
run: cargo build --workspace --all-features
run: cargo build --workspace --target ${{ matrix.target.target }} ${{ matrix.target.args }}
- name: Build Examples
run: cargo build --examples --all-features
run:
cargo build --examples --target ${{ matrix.target.target }} ${{ matrix.target-feature.args
|| matrix.target.args }}
76 changes: 71 additions & 5 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ jobs:
run: cargo test --all-features --no-fail-fast

client:
name: Test Client ${{ matrix.os.description }}
name:
Test Client ${{ matrix.os.description }} ${{ matrix.target.description }} ${{
matrix.target-feature.description }}

runs-on: ${{ matrix.os.os }}

Expand All @@ -59,6 +61,25 @@ jobs:
- { 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,
}

defaults:
run:
Expand All @@ -68,19 +89,64 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust
run: rustup target add wasm32-unknown-unknown
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'
if: runner.os == 'macOS' || runner.os == 'Windows'
run: npm install -g typescript
- 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
- name: Run Tests - NodeJs
env:
JBG_TEST_RUNNER: node-js
run:
cargo test --workspace --all-features --no-fail-fast --target ${{ matrix.target.target }}
${{ matrix.target-feature.args || matrix.target.args }}
- name: Install Deno
if: runner.os == 'Linux' || runner.os == 'macOS'
uses: denoland/setup-deno@v2
- name: Run Tests - Deno
env:
JBG_TEST_RUNNER: deno
run:
cargo test --workspace --all-features --no-fail-fast --target ${{ matrix.target.target }}
${{ matrix.target-feature.args || matrix.target.args }}
- name: Run Tests - Chrome
env:
JBG_TEST_RUNNER: browser
JBG_TEST_CHROMEDRIVER: chromedriver
run:
cargo test --workspace --all-features --no-fail-fast --target ${{ matrix.target.target }}
${{ matrix.target-feature.args || matrix.target.args }}
- name: Run Tests - Firefox
env:
JBG_TEST_RUNNER: browser
JBG_TEST_GECKODRIVER: geckodriver
run:
cargo test --workspace --all-features --no-fail-fast --target ${{ matrix.target.target }}
${{ matrix.target-feature.args || matrix.target.args }}
- name: Run Tests - Safari
if: runner.os == 'macOS'
env:
JBG_TEST_RUNNER: browser
JBG_TEST_SAFARIDRIVER: safaridriver
run:
cargo test --workspace --all-features --no-fail-fast --target ${{ matrix.target.target }}
${{ matrix.target-feature.args || matrix.target.args }}
1 change: 1 addition & 0 deletions client/js-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ fn main() -> io::Result<()> {
search_folder(&env::current_dir()?)?;

let status = Command::new("cargo")
.env_remove("CARGO_ENCODED_RUSTFLAGS")
.current_dir("../../host")
.arg("+stable")
.arg("run")
Expand Down
1 change: 1 addition & 0 deletions client/web-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ fn main() -> io::Result<()> {
search_folder(&env::current_dir()?)?;

let status = Command::new("cargo")
.env_remove("CARGO_ENCODED_RUSTFLAGS")
.current_dir("../../host")
.arg("+stable")
.arg("run")
Expand Down
3 changes: 2 additions & 1 deletion common/linker.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
:: Never reached on UNIX because we execute `exit`.
@echo off
pushd "%~dp0..\host\ld\src\js"
tsc --build || exit /b %ERRORLEVEL%
tsc --build
if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%
popd
pushd "%~dp0..\host"
cargo +stable run -q -p js-bindgen-ld -- %*
Expand Down
9 changes: 6 additions & 3 deletions common/runner.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,14 @@
:: Never reached on UNIX because we execute `exit`.
@echo off
pushd "%~dp0..\host\ld\src\js"
tsc --build || exit /b %ERRORLEVEL%
tsc --build
if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%
popd
pushd "%~dp0..\host\runner\src\js"
npm install -s --prefer-offline --no-audit --no-fund || exit /b %ERRORLEVEL%
tsc --build || exit /b %ERRORLEVEL%
npm install -s --prefer-offline --no-audit --no-fund
if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%
tsc --build
if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%
popd
pushd "%~dp0..\host"
cargo +stable run -q -p js-bindgen-runner -- %*
Expand Down
Loading