Skip to content

Commit 44b810e

Browse files
Partition nextest runs (KittyCAD#6574)
* Partition nextest runs * move name back to 'cargo test' * Fix duplicate name There were two jobs both named `build-test-artifacts`. Changed the latter to `run-test-artifacts` * cd into rust/ before running nextest * Get token when running the tests * Try getting archive into correct dir via different method * Bump shards to 6 * Replace llvm-cov with nextest * Adjust job name * Remove unnecessary comments --------- Co-authored-by: Jace Browning <jacebrowning@gmail.com>
1 parent a9998be commit 44b810e

File tree

1 file changed

+59
-15
lines changed

1 file changed

+59
-15
lines changed

.github/workflows/cargo-test.yml

Lines changed: 59 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ concurrency:
1313
cancel-in-progress: true
1414
name: cargo test
1515
jobs:
16-
cargotest:
17-
name: cargo test
16+
build-test-artifacts:
17+
name: Build test artifacts
1818
runs-on:
1919
- runs-on=${{ github.run_id }}
2020
- runner=32cpu-linux-x64
@@ -43,7 +43,6 @@ jobs:
4343
env:
4444
GH_ACTIONS_AXIOM_TOKEN: ${{ secrets.GH_ACTIONS_AXIOM_TOKEN }}
4545
OS_NAME: ${{ env.OS_NAME }}
46-
- uses: taiki-e/install-action@cargo-llvm-cov
4746
- uses: taiki-e/install-action@nextest
4847
- name: Install just
4948
uses: taiki-e/install-action@just
@@ -121,21 +120,66 @@ jobs:
121120
# Configure nextest when it's run by insta (via just).
122121
NEXTEST_PROFILE: ci
123122
RUST_BACKTRACE: full
124-
- name: cargo test
125-
if: steps.path-changes.outputs.outside-kcl-samples == 'true'
123+
- name: Build and archive tests
124+
run: |
125+
cd rust
126+
cargo nextest archive --workspace --features artifact-graph --archive-file nextest-archive.tar.zst
127+
- name: Upload archive to workflow
128+
uses: actions/upload-artifact@v4
129+
with:
130+
name: nextest-archive
131+
path: rust/nextest-archive.tar.zst
132+
133+
run-test-artifacts:
134+
name: cargo test (shard ${{ matrix.partitionIndex}})
135+
runs-on:
136+
- runs-on=${{ github.run_id }}
137+
- runner=32cpu-linux-x64
138+
- extras=s3-cache
139+
needs: build-test-artifacts
140+
strategy:
141+
matrix:
142+
partitionIndex: [1, 2, 3, 4, 5, 6]
143+
partitionTotal: [6]
144+
steps:
145+
- uses: runs-on/action@v1
146+
- uses: actions/create-github-app-token@v1
147+
id: app-token
148+
with:
149+
app-id: ${{ secrets.MODELING_APP_GH_APP_ID }}
150+
private-key: ${{ secrets.MODELING_APP_GH_APP_PRIVATE_KEY }}
151+
owner: ${{ github.repository_owner }}
152+
- uses: actions/checkout@v4
153+
with:
154+
token: ${{ steps.app-token.outputs.token }}
155+
- name: Use correct Rust toolchain
156+
shell: bash
157+
run: |
158+
[ -e rust-toolchain.toml ] || cp rust/rust-toolchain.toml ./
159+
- name: Install rust
160+
uses: actions-rust-lang/setup-rust-toolchain@v1
161+
with:
162+
cache: false # Configured below.
163+
- name: Start Vector
164+
run: .github/ci-cd-scripts/start-vector-ubuntu.sh
165+
env:
166+
GH_ACTIONS_AXIOM_TOKEN: ${{ secrets.GH_ACTIONS_AXIOM_TOKEN }}
167+
OS_NAME: ${{ env.OS_NAME }}
168+
- uses: taiki-e/install-action@nextest
169+
- name: Download archive
170+
uses: actions/download-artifact@v4
171+
with:
172+
name: nextest-archive
173+
- name: Run tests
126174
shell: bash
127175
run: |-
176+
cp nextest-archive.tar.zst rust/nextest-archive.tar.zst
177+
ls -lah
128178
cd rust
129-
cargo llvm-cov nextest --workspace --features artifact-graph --lcov --output-path lcov.info --retries=2 --no-fail-fast -P ci 2>&1 | tee /tmp/github-actions.log
179+
cargo nextest run\
180+
--retries=2 --no-fail-fast -P ci --archive-file nextest-archive.tar.zst \
181+
--partition count:${{ matrix.partitionIndex}}/${{ matrix.partitionTotal }} \
182+
2>&1 | tee /tmp/github-actions.log
130183
env:
131184
KITTYCAD_API_TOKEN: ${{secrets.KITTYCAD_API_TOKEN}}
132-
- name: Upload to codecov.io
133-
if: steps.path-changes.outputs.outside-kcl-samples == 'true'
134-
uses: codecov/codecov-action@v5
135-
with:
136-
token: ${{secrets.CODECOV_TOKEN}}
137-
fail_ci_if_error: true
138-
flags: rust
139-
verbose: true
140-
files: lcov.info
141185

0 commit comments

Comments
 (0)