Skip to content

Commit

Permalink
Split nightly crates tests job to build and run steps (#1984)
Browse files Browse the repository at this point in the history
This way we can build stable and nightly in parallel, instead of first
waiting for stable to build and then building nightly. I suggest using
nextest, even if we do not use partitioning, because it's well suited
for archiving build and running from the archive.

---------

Signed-off-by: maciektr <[email protected]>
Co-authored-by: Maksim Zdobnikau <[email protected]>
  • Loading branch information
maciektr and DelevoXDG authored Mar 10, 2025
1 parent 2da25c2 commit 9990bff
Showing 1 changed file with 42 additions and 14 deletions.
56 changes: 42 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,39 +89,67 @@ jobs:
- name: run tests
run: cargo test -p scarb-metadata

test-nightly-crates:
name: test nightly crates ${{ matrix.platform.name }}
build-nightly-test:
name: build nightly test ${{ matrix.platform.name }}
runs-on: ${{ matrix.platform.os }}
strategy:
fail-fast: false
matrix:
platform:
# TODO: Enable tests on windows when stwo supports it.
- name: linux x86-64
os: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_NIGHTLY_TOOLCHAIN }}
- uses: taiki-e/install-action@nextest
- uses: Swatinem/rust-cache@v2
- name: nextest archive
run: cargo nextest archive --all-features --cargo-profile ci --archive-file 'nextest-nightly-archive-${{ matrix.platform.os }}.tar.zst' --package scarb-prove --package scarb-verify
- uses: actions/upload-artifact@v4
with:
name: nextest-nightly-archive-${{ matrix.platform.os }}
path: nextest-nightly-archive-${{ matrix.platform.os }}.tar.zst

test-nightly:
name: test nightly ${{ matrix.platform.name }}
runs-on: ${{ matrix.platform.os }}
needs:
- build-test
- build-nightly-test
strategy:
fail-fast: false
matrix:
platform:
- name: linux x86-64
os: ubuntu-latest
# Do not run tests on windows, until stwo supports it.
# - name: windows x86-64
# os: windows-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_NIGHTLY_TOOLCHAIN }}
- uses: taiki-e/install-action@nextest
- uses: Swatinem/rust-cache@v2
- uses: actions/download-artifact@v4
- name: Download stable build artifacts
uses: actions/download-artifact@v4
with:
name: nextest-archive-${{ matrix.platform.os }}
- name: Unpack build stable rust artifacts on ubuntu
- name: Unpack build stable rust artifacts from nextest archive on linux
if: matrix.platform.os == 'ubuntu-latest'
run: tar --use-compress-program=unzstd -xvf nextest-archive-ubuntu-latest.tar.zst
- name: Unpack build stable rust artifacts on windows
if: matrix.platform.os == 'windows-latest'
run: |
zstd -d nextest-archive-windows-latest.tar.zst
tar -xf nextest-archive-windows-latest.tar
- name: Run scarb-prove and scarb-verify tests
run: cargo +${{ env.RUST_NIGHTLY_TOOLCHAIN }} test -p scarb-prove -p scarb-verify --profile=ci
tar --use-compress-program=unzstd -xvf nextest-archive-ubuntu-latest.tar.zst
mv target stable-crates-target
echo "NEXTEST_BIN_EXE_scarb=$GITHUB_WORKSPACE/stable-crates-target/ci/scarb" >> $GITHUB_ENV
echo "$GITHUB_WORKSPACE/stable-crates-target/ci" >> $GITHUB_PATH
echo "$GITHUB_WORKSPACE/target/ci" >> $GITHUB_PATH
- name: Download nightly build artifacts
uses: actions/download-artifact@v4
with:
name: nextest-nightly-archive-${{ matrix.platform.os }}
- name: nextest partition
run: cargo nextest run --archive-file 'nextest-nightly-archive-${{ matrix.platform.os }}.tar.zst' --extract-to ./

check-rust:
runs-on: ubuntu-latest
Expand Down

0 comments on commit 9990bff

Please sign in to comment.