Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shard rust canister tests #1629

Merged
merged 5 commits into from
May 22, 2023
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 41 additions & 11 deletions .github/workflows/canister-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -195,19 +195,12 @@ jobs:

# Run the tests, user the output of the docker build as Wasm module
# (note: this runs _all_ cargo tests)
canister-tests:
canister-tests-build:
runs-on: ${{ matrix.os }}
needs: [docker-build-ii, docker-build-archive]
strategy:
matrix:
os: [ ubuntu-latest, macos-latest ]
steps:
# Required by the ic-test-state-machine
- name: Install openssl (macos)
if: ${{ matrix.os == 'macos-latest' }}
run: |
brew install openssl@3

- uses: actions/checkout@v3
with:
# Pull a deep copy so that we can set meaningful timestamps across builds, based on the commit history
Expand Down Expand Up @@ -237,6 +230,9 @@ jobs:
echo "now: $commit_now"

- uses: ./.github/actions/bootstrap
- name: Install nextest
run: |
curl -LsSf https://get.nexte.st/latest/${{ matrix.os == 'macos-latest' && 'mac' || 'linux' }} | tar zxf - -C ${CARGO_HOME:-~/.cargo}/bin

# Rustup only installs cargo on the first call, so we use a dedicated step to get a good idea of how
# time is spent in each step separately
Expand Down Expand Up @@ -326,11 +322,45 @@ jobs:
run: rsync -av --compare-dest="/tmp/target-deps/" "$PWD/target/" "/tmp/target-canister/"

# Build the tests
- name: Build
- name: Build test archive
run: |
git checkout ${{ steps.git_info.outputs.commit_now }}
cargo build --tests --release --frozen
cargo nextest archive --archive-file canister-tests-${{ matrix.os }}.tar.zst --release

- name: 'Upload canister test archive'
uses: actions/upload-artifact@v3
with:
# name is the name used to display and retrieve the artifact
name: canister-tests-${{ matrix.os }}.tar.zst
# path is the name used as the file to upload and the name of the
# downloaded file
path: ./canister-tests-${{ matrix.os }}.tar.zst

canister-tests-run:
runs-on: ${{ matrix.os }}
needs: [canister-tests-build, docker-build-ii, docker-build-archive]
strategy:
matrix:
os: [ ubuntu-latest, macos-latest ]
partition: ['1/3', '2/3', '3/3']
frederikrothenberger marked this conversation as resolved.
Show resolved Hide resolved
steps:
- uses: actions/checkout@v3

# Required by the ic-test-state-machine
- name: Install openssl (macos)
if: ${{ matrix.os == 'macos-latest' }}
run: |
brew install openssl@3

- name: Download nextest
run: |
curl -LsSf https://get.nexte.st/latest/${{ matrix.os == 'macos-latest' && 'mac' || 'linux' }} | tar zxf -

- name: 'Download nextest test archive'
uses: actions/download-artifact@v3
with:
name: canister-tests-${{ matrix.os }}.tar.zst
path: .
- name: Download ic-test-state-machine binary
run: |
uname_sys=$(uname -s | tr '[:upper:]' '[:lower:]')
Expand Down Expand Up @@ -362,7 +392,7 @@ jobs:
# a relatively small price to pay to make sure PRs are always tested against the latest release.
curl -sSL https://github.com/dfinity/internet-identity/releases/latest/download/internet_identity_test.wasm.gz -o internet_identity_previous.wasm.gz
curl -sSL https://github.com/dfinity/internet-identity/releases/latest/download/archive.wasm.gz -o archive_previous.wasm.gz
cargo test --release
./cargo-nextest nextest run --archive-file canister-tests-${{ matrix.os }}.tar.zst --partition hash:${{ matrix.partition }}
frederikrothenberger marked this conversation as resolved.
Show resolved Hide resolved
env:
RUST_BACKTRACE: 1

Expand Down