Skip to content

Commit f5f91c7

Browse files
authored
Split up test jobs on CI (#982)
* Split up test jobs on CI Currently CI takes a pretty significant chunk of time for this repository so try to speed it up by sharding jobs. Each language is now tested in isolation to avoid the need to have one giant builder with all the deps for all the languages. That helps split out install steps and test less on each builder while maintaining the same set of test coverage. This also merges the `csharp-{naot,mono}` features as for CI they were both already always enabled so now there's just one `csharp` feature. * Add wasi target * Try to fix CI * Add back csharp-mono feature * Skip wasi-sdk for csharp * Revert "Skip wasi-sdk for csharp" This reverts commit 44d0f1d.
1 parent 266d638 commit f5f91c7

File tree

3 files changed

+36
-14
lines changed

3 files changed

+36
-14
lines changed

.github/workflows/main.yml

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -58,19 +58,21 @@ jobs:
5858
fail-fast: false
5959
matrix:
6060
os: [ubuntu-latest, macos-latest, windows-latest]
61+
lang: [c, rust, teavm-java, go, csharp]
6162
runs-on: ${{ matrix.os }}
6263
steps:
6364
- uses: actions/checkout@v4
6465
with:
6566
submodules: true
6667
- name: Install Rust
6768
run: rustup update stable --no-self-update && rustup default stable
68-
- name: Install wasm32-unknown-unknown target
69-
run: rustup target add wasm32-unknown-unknown
70-
- name: Install wasm32-wasi target
71-
run: rustup target add wasm32-wasi
69+
- run: rustup target add wasm32-wasi
70+
71+
- run: rustup target add wasm32-unknown-unknown
72+
if: matrix.lang == 'rust'
7273

7374
- uses: ./.github/actions/install-wasi-sdk
75+
if: matrix.lang == 'c' || (matrix.lang == 'csharp' && matrix.os == 'windows-latest')
7476

7577
- run: |
7678
curl.exe -LO https://dotnet.microsoft.com/download/dotnet/scripts/v1/dotnet-install.ps1
@@ -80,25 +82,45 @@ jobs:
8082
echo $LOCALAPPDATA'\Microsoft\dotnet' >> $GITHUB_PATH
8183
echo $LOCALAPPDATA'\Microsoft\dotnet\tools' >> $GITHUB_PATH
8284
$LOCALAPPDATA/Microsoft/dotnet/dotnet --info
83-
if : matrix.os == 'windows-latest'
85+
if: matrix.os == 'windows-latest' && matrix.lang == 'csharp'
8486
8587
- run: ci/download-teavm.sh
86-
87-
- uses: actions/setup-node@v4
88-
with:
89-
node-version: '16'
88+
if: matrix.lang == 'teavm-java'
9089
- uses: actions/setup-java@v4
90+
if: matrix.lang == 'teavm-java'
9191
with:
9292
java-version: '18'
9393
distribution: 'adopt'
94+
9495
- uses: actions/setup-go@v4
96+
if: matrix.lang == 'go'
9597
with:
9698
go-version: '1.20'
9799
- uses: acifani/setup-tinygo@v2
100+
if: matrix.lang == 'go'
98101
with:
99102
tinygo-version: 0.31.0
100-
- name: cargo test --workspace
101-
run: cargo test --workspace
103+
104+
- run: |
105+
cargo test \
106+
-p wit-bindgen-cli \
107+
-p wit-bindgen-${{ matrix.lang }} \
108+
--no-default-features \
109+
--features ${{ matrix.lang }}
110+
111+
test_unit:
112+
name: Crate Unit Tests
113+
runs-on: ubuntu-latest
114+
steps:
115+
- uses: actions/checkout@v4
116+
with:
117+
submodules: true
118+
- name: Install Rust
119+
run: rustup update stable --no-self-update && rustup default stable
120+
- run: rustup target add wasm32-wasi
121+
- run: cargo test -p wit-bindgen-core
122+
- run: cargo test -p wit-bindgen
123+
- run: cargo test --workspace --exclude 'wit-bindgen*'
102124

103125
check:
104126
name: Check
@@ -169,6 +191,7 @@ jobs:
169191
runs-on: ubuntu-latest
170192
needs:
171193
- test
194+
- test_unit
172195
- rustfmt
173196
- build
174197
- verify-publish

Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,14 @@ default = [
6868
'markdown',
6969
'teavm-java',
7070
'go',
71-
'csharp-naot',
71+
'csharp',
7272
]
7373
c = ['dep:wit-bindgen-c']
7474
rust = ['dep:wit-bindgen-rust']
7575
markdown = ['dep:wit-bindgen-markdown']
7676
teavm-java = ['dep:wit-bindgen-teavm-java']
7777
go = ['dep:wit-bindgen-go']
7878
csharp = ['dep:wit-bindgen-csharp']
79-
csharp-naot = ['csharp']
8079
csharp-mono = ['csharp']
8180

8281
[dev-dependencies]

tests/runtime/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,7 @@ fn tests(name: &str, dir_name: &str) -> Result<Vec<PathBuf>> {
658658
}
659659
}
660660

661-
#[cfg(feature = "csharp-naot")]
661+
#[cfg(feature = "csharp")]
662662
if cfg!(windows) && !c_sharp.is_empty() {
663663
let (resolve, world) = resolve_wit_dir(&dir);
664664
for path in c_sharp.iter() {

0 commit comments

Comments
 (0)