Skip to content

Commit b3b5161

Browse files
authored
Split test job into multiple jobs (#2395)
1 parent 1d61d57 commit b3b5161

File tree

1 file changed

+157
-109
lines changed

1 file changed

+157
-109
lines changed

.github/workflows/ci.yml

Lines changed: 157 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,46 @@ jobs:
231231
if: ${{ matrix.os != 'macos-latest' }}
232232
run: cargo nextest run -p zenoh
233233

234+
- name: Check for feature leaks
235+
if: ${{ matrix.os == 'ubuntu-latest' }}
236+
run: cargo nextest run -p zenohd --no-default-features
237+
238+
- name: Upload test results to Codecov
239+
if: ${{ !cancelled() }}
240+
uses: codecov/test-results-action@v1
241+
with:
242+
token: ${{ secrets.CODECOV_TOKEN }}
243+
244+
test_unstable:
245+
needs: determine-runner
246+
name: Unit tests on ${{ matrix.os }} (unstable)
247+
runs-on: ${{ matrix.os }}
248+
strategy:
249+
fail-fast: false
250+
matrix:
251+
os: ${{ fromJSON(needs.determine-runner.outputs.runner) }}
252+
253+
steps:
254+
- name: Clone this repository
255+
uses: actions/checkout@v4
256+
257+
- name: Install latest Rust toolchain
258+
run: rustup show
259+
260+
- name: Setup rust-cache
261+
uses: Swatinem/rust-cache@v2
262+
with:
263+
cache-bin: false
264+
265+
- name: Set rustflags
266+
if: ${{ matrix.os == 'windows-latest' }}
267+
shell: bash
268+
run: |
269+
echo "RUSTFLAGS=-Clink-arg=/DEBUG:NONE" >> $GITHUB_ENV
270+
271+
- name: Install latest nextest
272+
uses: taiki-e/install-action@nextest
273+
234274
- name: Run tests with unstable (sudo macos)
235275
if: ${{ matrix.os == 'macos-latest' }}
236276
run: |
@@ -243,13 +283,41 @@ jobs:
243283
cargo build -p zenoh-plugin-rest --lib
244284
cargo nextest run -F test -F plugins,unstable,internal --exclude zenoh-examples --exclude zenoh-plugin-example --workspace
245285
246-
- name: Rename junit test report (sudo macos)
247-
if: ${{ matrix.os == 'macos-latest' }}
248-
run: sudo mv target/nextest/default/junit.xml target/nextest/default/tests.junit.xml
286+
- name: Upload test results to Codecov
287+
if: ${{ !cancelled() }}
288+
uses: codecov/test-results-action@v1
289+
with:
290+
token: ${{ secrets.CODECOV_TOKEN }}
249291

250-
- name: Rename junit test report
251-
if: ${{ matrix.os != 'macos-latest' }}
252-
run: mv target/nextest/default/junit.xml target/nextest/default/tests.junit.xml
292+
test_shm:
293+
needs: determine-runner
294+
name: Unit tests on ${{ matrix.os }} (shared memory)
295+
runs-on: ${{ matrix.os }}
296+
strategy:
297+
fail-fast: false
298+
matrix:
299+
os: ${{ fromJSON(needs.determine-runner.outputs.runner) }}
300+
301+
steps:
302+
- name: Clone this repository
303+
uses: actions/checkout@v4
304+
305+
- name: Install latest Rust toolchain
306+
run: rustup show
307+
308+
- name: Setup rust-cache
309+
uses: Swatinem/rust-cache@v2
310+
with:
311+
cache-bin: false
312+
313+
- name: Set rustflags
314+
if: ${{ matrix.os == 'windows-latest' }}
315+
shell: bash
316+
run: |
317+
echo "RUSTFLAGS=-Clink-arg=/DEBUG:NONE" >> $GITHUB_ENV
318+
319+
- name: Install latest nextest
320+
uses: taiki-e/install-action@nextest
253321

254322
- name: Run tests with SHM (sudo macos)
255323
if: ${{ matrix.os == 'macos-latest' }}
@@ -261,32 +329,12 @@ jobs:
261329
if: ${{ matrix.os == 'windows-latest' }}
262330
run: cargo nextest run -F test -F shared-memory -F unstable -E 'not (test(test_default_features) or test(test_adminspace_read))' --exclude zenoh-examples --exclude zenoh-plugin-example --workspace
263331

264-
- name: Rename junit test report (sudo macos)
265-
if: ${{ matrix.os == 'macos-latest' }}
266-
run: sudo mv target/nextest/default/junit.xml target/nextest/default/tests-shm.junit.xml
267-
268-
- name: Rename junit test report
269-
if: ${{ matrix.os == 'windows-latest' }}
270-
run: mv target/nextest/default/junit.xml target/nextest/default/tests-shm.junit.xml
271-
272332
- name: Run tests with SHM + unixpipe
273333
if: ${{ matrix.os == 'ubuntu-latest' }}
274334
run: |
275335
sudo prlimit --memlock=unlimited --pid=$$
276336
cargo nextest run -F test -F shared-memory -F unstable -F transport_unixpipe -E 'not (test(test_default_features) or test(test_adminspace_read))' --exclude zenoh-examples --exclude zenoh-plugin-example --workspace
277337
278-
- name: Rename junit test report
279-
if: ${{ matrix.os == 'ubuntu-latest' }}
280-
run: mv target/nextest/default/junit.xml target/nextest/default/tests-shm-unixpipe.junit.xml
281-
282-
- name: Check for feature leaks
283-
if: ${{ matrix.os == 'ubuntu-latest' }}
284-
run: cargo nextest run -p zenohd --no-default-features
285-
286-
- name: Rename junit test report
287-
if: ${{ matrix.os == 'ubuntu-latest' }}
288-
run: mv target/nextest/default/junit.xml target/nextest/default/tests-feature-leaks.junit.xml
289-
290338
- name: Upload test results to Codecov
291339
if: ${{ !cancelled() }}
292340
uses: codecov/test-results-action@v1
@@ -364,88 +412,88 @@ jobs:
364412
--config build.rustdocflags='["--cfg", "docsrs", "-Z", "unstable-options", "--emit=invocation-specific", "--cap-lints", "warn", "--extern-html-root-takes-precedence"]'
365413
366414
coverage:
367-
name: Coverage
368-
strategy:
369-
fail-fast: false
370-
matrix:
371-
os: [ubuntu-latest]
372-
rust: [nightly]
373-
runs-on: ${{ matrix.os }}
374-
steps:
375-
- name: Free Disk Space (Ubuntu)
376-
uses: jlumbroso/free-disk-space@main
377-
with:
378-
tool-cache: false
379-
android: true
380-
dotnet: true
381-
haskell: true
382-
large-packages: true
383-
docker-images: true
384-
swap-storage: true
385-
386-
- name: Install build-essential (Ubuntu)
387-
if: ${{ matrix.os == 'ubuntu-latest' }}
388-
run: |
389-
sudo apt-get update
390-
sudo apt-get install -y build-essential clang libc6-dev
391-
392-
- name: Checkout sources
393-
uses: actions/checkout@v4
394-
395-
#
396-
# Temporary workaround to remmove transitive dependency
397-
# of static-init 1.0.3 which fails with nigtly Rust.
398-
# This allows Rust to automatically pick a compatible version 1.0.4
399-
# where the issue is fixed.
400-
#
401-
- name: Remove zenoh-pinned-deps-1-75 dependency and Cargo.lock
402-
run: |
403-
sed -i '/zenoh-pinned-deps-1-75/d' Cargo.toml
404-
rm -f Cargo.lock
405-
406-
- name: Install ${{ matrix.rust }} Rust toolchain
407-
run: |
408-
rustup override set ${{ matrix.rust }}
409-
rustup update ${{ matrix.rust }}
410-
rustup component add llvm-tools-preview
411-
412-
- uses: Swatinem/rust-cache@v2
413-
with:
414-
cache-bin: false
415-
416-
- name: Install cargo-llvm-cov
417-
uses: taiki-e/install-action@cargo-llvm-cov
418-
419-
- name: Generate code coverage
420-
run: |
421-
sudo prlimit --memlock=unlimited --pid=$$
422-
cargo +${{ matrix.rust }} llvm-cov test --features unstable --features test --features shared-memory \
423-
${{ matrix.rust == 'nightly' && '--doctests' || '' }} --lcov --output-path lcov.info \
424-
--no-cfg-coverage --no-cfg-coverage-nightly --ignore-run-fail -- \
425-
--skip test_default_features \
426-
--skip router_linkstate \
427-
--skip three_node_combination \
428-
--skip three_node_combination_multicast \
429-
--skip two_node_combination \
430-
--skip test_gossip \
431-
--skip metadata_alloc_concurrent \
432-
--skip metadata_link_concurrent \
433-
--skip metadata_link_failure_concurrent
434-
env:
435-
RUST_LOG: None
436-
437-
- name: Upload coverage to Codecov
438-
uses: codecov/codecov-action@v5
439-
with:
440-
token: ${{ secrets.CODECOV_TOKEN }}
441-
files: lcov.info
442-
fail_ci_if_error: true
443-
444-
# Cleanup profraw files to avoid failing during rust-cache
445-
# post run cleanup. It requires enough space on disk left to save the cache
446-
- name: Cleanup profraw files
447-
run: |
448-
find . -name "*.profraw" -type f -delete
415+
name: Coverage
416+
strategy:
417+
fail-fast: false
418+
matrix:
419+
os: [ubuntu-latest]
420+
rust: [nightly]
421+
runs-on: ${{ matrix.os }}
422+
steps:
423+
- name: Free Disk Space (Ubuntu)
424+
uses: jlumbroso/free-disk-space@main
425+
with:
426+
tool-cache: false
427+
android: true
428+
dotnet: true
429+
haskell: true
430+
large-packages: true
431+
docker-images: true
432+
swap-storage: true
433+
434+
- name: Install build-essential (Ubuntu)
435+
if: ${{ matrix.os == 'ubuntu-latest' }}
436+
run: |
437+
sudo apt-get update
438+
sudo apt-get install -y build-essential clang libc6-dev
439+
440+
- name: Checkout sources
441+
uses: actions/checkout@v4
442+
443+
#
444+
# Temporary workaround to remmove transitive dependency
445+
# of static-init 1.0.3 which fails with nigtly Rust.
446+
# This allows Rust to automatically pick a compatible version 1.0.4
447+
# where the issue is fixed.
448+
#
449+
- name: Remove zenoh-pinned-deps-1-75 dependency and Cargo.lock
450+
run: |
451+
sed -i '/zenoh-pinned-deps-1-75/d' Cargo.toml
452+
rm -f Cargo.lock
453+
454+
- name: Install ${{ matrix.rust }} Rust toolchain
455+
run: |
456+
rustup override set ${{ matrix.rust }}
457+
rustup update ${{ matrix.rust }}
458+
rustup component add llvm-tools-preview
459+
460+
- uses: Swatinem/rust-cache@v2
461+
with:
462+
cache-bin: false
463+
464+
- name: Install cargo-llvm-cov
465+
uses: taiki-e/install-action@cargo-llvm-cov
466+
467+
- name: Generate code coverage
468+
run: |
469+
sudo prlimit --memlock=unlimited --pid=$$
470+
cargo +${{ matrix.rust }} llvm-cov test --features unstable --features test --features shared-memory \
471+
${{ matrix.rust == 'nightly' && '--doctests' || '' }} --lcov --output-path lcov.info \
472+
--no-cfg-coverage --no-cfg-coverage-nightly --ignore-run-fail -- \
473+
--skip test_default_features \
474+
--skip router_linkstate \
475+
--skip three_node_combination \
476+
--skip three_node_combination_multicast \
477+
--skip two_node_combination \
478+
--skip test_gossip \
479+
--skip metadata_alloc_concurrent \
480+
--skip metadata_link_concurrent \
481+
--skip metadata_link_failure_concurrent
482+
env:
483+
RUST_LOG: None
484+
485+
- name: Upload coverage to Codecov
486+
uses: codecov/codecov-action@v5
487+
with:
488+
token: ${{ secrets.CODECOV_TOKEN }}
489+
files: lcov.info
490+
fail_ci_if_error: true
491+
492+
# Cleanup profraw files to avoid failing during rust-cache
493+
# post run cleanup. It requires enough space on disk left to save the cache
494+
- name: Cleanup profraw files
495+
run: |
496+
find . -name "*.profraw" -type f -delete
449497
450498
# NOTE: In GitHub repository settings, the "Require status checks to pass
451499
# before merging" branch protection rule ensures that commits are only merged
@@ -455,7 +503,7 @@ jobs:
455503
ci:
456504
name: CI status checks
457505
runs-on: ubuntu-latest
458-
needs: [check_rust, check, test, valgrind, typos, markdown_lint, doc, coverage]
506+
needs: [check_rust, check_rust_without_cargo_lock, check, test, test_unstable, test_shm, valgrind, typos, markdown_lint, doc, coverage]
459507
if: always()
460508
steps:
461509
- name: Check whether all jobs pass

0 commit comments

Comments
 (0)