Skip to content

Commit 7af7a74

Browse files
committed
Expand CI
1 parent 2cb3410 commit 7af7a74

5 files changed

Lines changed: 81 additions & 10 deletions

File tree

.github/workflows/build.yaml

Lines changed: 37 additions & 4 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,7 +57,17 @@ 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:
@@ -46,6 +77,8 @@ jobs:
4677
if: runner.os == 'macOS'
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: 36 additions & 3 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 }}
5052

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

@@ -59,6 +61,25 @@ 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+
}
6283

6384
defaults:
6485
run:
@@ -68,7 +89,17 @@ jobs:
6889
- name: Checkout
6990
uses: actions/checkout@v4
7091
- name: Install Rust
71-
run: rustup target add wasm32-unknown-unknown
92+
run: |
93+
rustup install --profile minimal ${{ matrix.target-feature.components || matrix.target.components }} ${{ matrix.target-feature.rust || matrix.target.rust }}
94+
rustup default ${{ matrix.target-feature.rust || matrix.target.rust }}
95+
- name: Install Target
96+
if: matrix.target.install
97+
run: rustup target add ${{ matrix.target.target }}
98+
- name: Set Target `RUSTFLAG`
99+
shell: bash
100+
run: |
101+
TARGET=$(echo "${{ matrix.target.target }}" | tr '[:lower:]-' '[:upper:]_')
102+
echo "CARGO_TARGET_${TARGET}_RUSTFLAGS=${{ matrix.target-feature.rustflags }}" >> $GITHUB_ENV
72103
- name: Install LLVM
73104
uses: ZhongRuoyu/setup-llvm@ec41d6e5f3c15c96fa642a49c6e7effac6261778
74105
with:
@@ -83,4 +114,6 @@ jobs:
83114
with:
84115
node-version: latest
85116
- name: Run Tests
86-
run: cargo test --workspace --all-features --no-fail-fast
117+
run:
118+
cargo test --workspace --all-features --no-fail-fast --target ${{ matrix.target.target }}
119+
${{ 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/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)