Skip to content

Commit 9ecf878

Browse files
committed
Expand CI
1 parent 2cb3410 commit 9ecf878

File tree

6 files changed

+104
-13
lines changed

6 files changed

+104
-13
lines changed

.github/workflows/build.yaml

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ env:
1414

1515
jobs:
1616
client:
17-
name: Build Client ${{ matrix.os.description }}
17+
name:
18+
Build Client ${{ matrix.os.description }} ${{ matrix.target.description }} ${{
19+
matrix.target-feature.description }}
1820

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

@@ -27,6 +29,25 @@ jobs:
2729
- { os: ubuntu-latest, description: Linux }
2830
- { os: macos-latest, description: MacOS }
2931
- { os: windows-latest, description: Windows }
32+
target:
33+
- { target: wasm32-unknown-unknown, install: true, rust: stable, description: Wasm32 }
34+
- {
35+
target: wasm64-unknown-unknown,
36+
install: false,
37+
rust: nightly,
38+
components: -c rust-src,
39+
args: '-Zbuild-std="panic_abort,std"',
40+
description: Wasm64,
41+
}
42+
target-feature:
43+
- {}
44+
- {
45+
rust: nightly,
46+
components: -c rust-src,
47+
rustflags: -Ctarget-feature=+atomics -Clink-arg=--shared-memory,
48+
args: '-Zbuild-std="panic_abort,std"',
49+
description: Atomics,
50+
}
3051

3152
defaults:
3253
run:
@@ -36,16 +57,28 @@ jobs:
3657
- name: Checkout
3758
uses: actions/checkout@v4
3859
- name: Install Rust
39-
run: rustup target add wasm32-unknown-unknown
60+
run: |
61+
rustup install --profile minimal ${{ matrix.target-feature.components || matrix.target.components }} ${{ matrix.target-feature.rust || matrix.target.rust }}
62+
rustup default ${{ matrix.target-feature.rust || matrix.target.rust }}
63+
- name: Install Target
64+
if: matrix.target.install
65+
run: rustup target add ${{ matrix.target.target }}
66+
- name: Set Target `RUSTFLAG`
67+
shell: bash
68+
run: |
69+
TARGET=$(echo "${{ matrix.target.target }}" | tr '[:lower:]-' '[:upper:]_')
70+
echo "CARGO_TARGET_${TARGET}_RUSTFLAGS=${{ matrix.target-feature.rustflags }}" >> $GITHUB_ENV
4071
- name: Install LLVM
4172
uses: ZhongRuoyu/setup-llvm@ec41d6e5f3c15c96fa642a49c6e7effac6261778
4273
with:
4374
# Rustc v1.93
4475
llvm-version: 21
4576
- name: Install TSC
46-
if: runner.os == 'macOS'
77+
if: runner.os == 'macOS' || runner.os == 'Windows'
4778
run: npm install -g typescript
4879
- name: Build Crates
49-
run: cargo build --workspace --all-features
80+
run: cargo build --workspace --target ${{ matrix.target.target }} ${{ matrix.target.args }}
5081
- name: Build Examples
51-
run: cargo build --examples --all-features
82+
run:
83+
cargo build --examples --target ${{ matrix.target.target }} ${{ matrix.target-feature.args
84+
|| matrix.target.args }}

.github/workflows/test.yaml

Lines changed: 56 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ jobs:
4646
run: cargo test --all-features --no-fail-fast
4747

4848
client:
49-
name: Test Client ${{ matrix.os.description }}
49+
name:
50+
Test Client ${{ matrix.os.description }} ${{ matrix.target.description }} ${{
51+
matrix.target-feature.description }} ${{ matrix.runner.description }}
5052

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

@@ -59,6 +61,36 @@ jobs:
5961
- { os: ubuntu-latest, description: Linux }
6062
- { os: macos-latest, description: MacOS }
6163
- { os: windows-latest, description: Windows }
64+
target:
65+
- { target: wasm32-unknown-unknown, install: true, rust: stable, description: Wasm32 }
66+
- {
67+
target: wasm64-unknown-unknown,
68+
install: false,
69+
rust: nightly,
70+
components: -c rust-src,
71+
args: '-Zbuild-std="panic_abort,std"',
72+
description: Wasm64,
73+
}
74+
target-feature:
75+
- {}
76+
- {
77+
rust: nightly,
78+
components: -c rust-src,
79+
rustflags: -Ctarget-feature=+atomics -Clink-arg=--shared-memory,
80+
args: '-Zbuild-std="panic_abort,std"',
81+
description: Atomics,
82+
}
83+
runner:
84+
- { runner: node-js, description: NodeJs }
85+
- { runner: deno, description: Deno }
86+
- { runner: browser, browser: chromedriver, description: Chrome }
87+
- { runner: browser, browser: geckodriver, description: Firefox }
88+
- { runner: browser, browser: safaridriver, description: Safari }
89+
exclude:
90+
- os: { os: ubuntu-latest, description: Linux }
91+
runner: { runner: browser, browser: safaridriver }
92+
- os: { os: windows-latest, description: Windows }
93+
runner: { runner: browser, browser: safaridriver, description: Safari }
6294

6395
defaults:
6496
run:
@@ -68,19 +100,39 @@ jobs:
68100
- name: Checkout
69101
uses: actions/checkout@v4
70102
- name: Install Rust
71-
run: rustup target add wasm32-unknown-unknown
103+
run: |
104+
rustup install --profile minimal ${{ matrix.target-feature.components || matrix.target.components }} ${{ matrix.target-feature.rust || matrix.target.rust }}
105+
rustup default ${{ matrix.target-feature.rust || matrix.target.rust }}
106+
- name: Install Target
107+
if: matrix.target.install
108+
run: rustup target add ${{ matrix.target.target }}
109+
- name: Set Target `RUSTFLAG`
110+
shell: bash
111+
run: |
112+
TARGET=$(echo "${{ matrix.target.target }}" | tr '[:lower:]-' '[:upper:]_')
113+
echo "CARGO_TARGET_${TARGET}_RUSTFLAGS=${{ matrix.target-feature.rustflags }}" >> $GITHUB_ENV
72114
- name: Install LLVM
73115
uses: ZhongRuoyu/setup-llvm@ec41d6e5f3c15c96fa642a49c6e7effac6261778
74116
with:
75117
# Rustc v1.93
76118
llvm-version: 21
77119
- name: Install TSC
78-
if: runner.os == 'macOS'
120+
if: runner.os == 'macOS' || runner.os == 'Windows'
79121
run: npm install -g typescript
122+
- name: Set Test Runner
123+
run: echo "JBG_TEST_RUNNER=${{ matrix.runner.runner }}" >> $GITHUB_ENV
124+
- name: Set Test WebDriver
125+
if: matrix.runner.browser
126+
shell: bash
127+
run: |
128+
DRIVER=$(echo "${{ matrix.runner.browser }}" | tr '[:lower:]' '[:upper:]')
129+
echo "BG_TEST_${DRIVER}=${{ matrix.runner.browser }}" >> $GITHUB_ENV
80130
- name: Update Node.js
81131
if: runner.os == 'Linux' || runner.os == 'macOS'
82132
uses: actions/setup-node@v6
83133
with:
84134
node-version: latest
85135
- name: Run Tests
86-
run: cargo test --workspace --all-features --no-fail-fast
136+
run:
137+
cargo test --workspace --all-features --no-fail-fast --target ${{ matrix.target.target }}
138+
${{ matrix.target-feature.args || matrix.target.args }}

client/js-sys/build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ fn main() -> io::Result<()> {
1010
search_folder(&env::current_dir()?)?;
1111

1212
let status = Command::new("cargo")
13+
.env_remove("CARGO_ENCODED_RUSTFLAGS")
1314
.current_dir("../../host")
1415
.arg("+stable")
1516
.arg("run")

client/web-sys/build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ fn main() -> io::Result<()> {
1010
search_folder(&env::current_dir()?)?;
1111

1212
let status = Command::new("cargo")
13+
.env_remove("CARGO_ENCODED_RUSTFLAGS")
1314
.current_dir("../../host")
1415
.arg("+stable")
1516
.arg("run")

common/linker.cmd

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
:: Never reached on UNIX because we execute `exit`.
2121
@echo off
2222
pushd "%~dp0..\host\ld\src\js"
23-
tsc --build || exit /b %ERRORLEVEL%
23+
tsc --build
24+
if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%
2425
popd
2526
pushd "%~dp0..\host"
2627
cargo +stable run -q -p js-bindgen-ld -- %*

common/runner.cmd

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,14 @@
2525
:: Never reached on UNIX because we execute `exit`.
2626
@echo off
2727
pushd "%~dp0..\host\ld\src\js"
28-
tsc --build || exit /b %ERRORLEVEL%
28+
tsc --build
29+
if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%
2930
popd
3031
pushd "%~dp0..\host\runner\src\js"
31-
npm install -s --prefer-offline --no-audit --no-fund || exit /b %ERRORLEVEL%
32-
tsc --build || exit /b %ERRORLEVEL%
32+
npm install -s --prefer-offline --no-audit --no-fund
33+
if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%
34+
tsc --build
35+
if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%
3336
popd
3437
pushd "%~dp0..\host"
3538
cargo +stable run -q -p js-bindgen-runner -- %*

0 commit comments

Comments
 (0)