@@ -15,6 +15,8 @@ defaults:
1515env :
1616 CARGO_INCREMENTAL : 0
1717 RUSTFLAGS : " -Dwarnings"
18+ CARGO_TERM_COLOR : always
19+ NEXTEST_NO_TESTS : warn
1820
1921jobs :
2022 no_std :
@@ -35,19 +37,76 @@ jobs:
3537 targets : ${{ matrix.target }}
3638 - run : cargo build --target ${{ matrix.target }} --no-default-features
3739
38- test :
40+ # because we're sharding tests, we'll compile them once first
41+ # upload that as artifact, and then re-download those artifacts
42+ # and run the tests.
43+ # This is heavily insired by https://github.com/nextest-rs/reuse-build-partition-example/blob/main/.github/workflows/ci.yml
44+ build-test :
3945 runs-on : ubuntu-latest
4046 strategy :
4147 matrix :
4248 rust :
4349 - 1.81.0 # MSRV
4450 - stable
51+ test_config :
52+ - --no-default-features
53+ - --all-features
54+ - default
4555 steps :
4656 - uses : actions/checkout@v4
4757 - uses : dtolnay/rust-toolchain@master
4858 with :
4959 toolchain : ${{ matrix.rust }}
60+ - uses : taiki-e/install-action@nextest
5061 - run : cargo check --all-features
51- - run : cargo test --no-default-features
52- - run : cargo test
53- - run : cargo test --all-features
62+ - name : Build and archive tests
63+ run : |
64+ PROFILE="${{ matrix.test_config }}"
65+ if [ "$PROFILE" = "default" ]; then
66+ PROFILE="--features default"
67+ fi
68+ cargo nextest archive --archive-file nextest-archive-${{ matrix.rust }}-${{ matrix.test_config }}.tar.zst $PROFILE
69+ - name : Upload archive to workflow
70+ uses : actions/upload-artifact@v4
71+ with :
72+ name : nextest-archive-${{ matrix.rust }}-${{ matrix.test_config }}
73+ # NOTE: upload-artifact does not respect the working directory, we need to prefix it.
74+ # https://github.com/actions/upload-artifact/issues/294
75+ path : slh-dsa/nextest-archive-${{ matrix.rust }}-${{ matrix.test_config }}.tar.zst
76+
77+ if-no-files-found : error
78+ compression-level : 0
79+ retention-days : 1
80+
81+ run-test :
82+ name : slh-dsa/run tests
83+ needs : build-test
84+ runs-on : ubuntu-latest
85+ strategy :
86+ matrix :
87+ test-partition : [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]
88+ rust :
89+ - 1.81.0 # MSRV
90+ - stable
91+ test_config :
92+ - --no-default-features
93+ - --all-features
94+ - " default"
95+ steps :
96+ - uses : actions/checkout@v4
97+ - run : mkdir -p ~/.cargo/bin
98+ - uses : taiki-e/install-action@nextest
99+ - name : Download test archive
100+ uses : actions/download-artifact@v4
101+ with :
102+ name : nextest-archive-${{ matrix.rust }}-${{ matrix.test_config }}
103+ path : slh-dsa
104+ - name : Run tests (${{ matrix.rust }}) (${{ matrix.test_config }})
105+ run : |
106+ PROFILE="${{ matrix.test_config }}"
107+ if [ "$PROFILE" = "default" ]; then
108+ PROFILE="--features default"
109+ fi
110+
111+ ~/.cargo/bin/cargo-nextest nextest run --archive-file nextest-archive-${{ matrix.rust }}-${{ matrix.test_config }}.tar.zst \
112+ --partition count:${{ matrix.test-partition }}/16
0 commit comments