Skip to content

Fix CI

Fix CI #117

Workflow file for this run

name: Rust
on:
push:
branches: [ main, devnet, testnet ]
pull_request:
concurrency:
# cancel redundant builds on PRs (only on PR, not on branches)
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
# Disable incremental compilation.
#
# Incremental compilation is useful as part of an edit-build-test-edit cycle,
# as it lets the compiler avoid recompiling code that hasn't changed. However,
# on CI, we're not making small edits; we're almost always building the entire
# project from scratch. Thus, incremental compilation on CI actually
# introduces *additional* overhead to support making future builds
# faster...but no future builds will ever occur in any given CI environment.
#
# See https://matklad.github.io/2021/09/04/fast-rust-builds.html#ci-workflow
# for details.
CARGO_INCREMENTAL: 0
# Allow more retries for network requests in cargo (downloading crates) and
# rustup (installing toolchains). This should help to reduce flaky CI failures
# from transient network timeouts or other issues.
CARGO_NET_RETRY: 10
CARGO_NET_GIT_FETCH_WITH_CLI: true
CARGO_BUILD_JOBS: 16
RUSTUP_MAX_RETRIES: 10
# Don't emit giant backtraces in the CI logs.
RUST_BACKTRACE: short
jobs:
test:
env:
# Tests written with #[sim_test] are often flaky if run as #[tokio::test] - this var
# causes #[sim_test] to only run under the deterministic `simtest` job, and not the
# non-deterministic `test` job.
SUI_SKIP_SIMTESTS: 1
timeout-minutes: 45
runs-on: [self-hosted]
needs: clippy
steps:
- uses: actions/checkout@v3
- uses: arduino/setup-protoc@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: webfactory/ssh-agent@v0.6.0
with:
ssh-private-key: |
${{ secrets.MAMORU_CORE_KEY }}
${{ secrets.VALIDATION_CHAIN_KEY }}
- uses: ./.github/actions/rust-setup
- uses: taiki-e/install-action@nextest
- name: cargo test
run: |
sudo sysctl -w net.ipv6.conf.all.disable_ipv6=0 # Enable ipv6
cargo nextest run --profile ci --no-fail-fast
- name: External crates tests
run: |
cargo xtest
# Ensure there are no uncommitted changes in the repo after running tests
- run: scripts/changed-files.sh
shell: bash
clippy:
runs-on: [self-hosted]
needs: rustfmt
steps:
- uses: arduino/setup-protoc@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v3
- uses: webfactory/ssh-agent@v0.6.0
with:
ssh-private-key: |
${{ secrets.MAMORU_CORE_KEY }}
${{ secrets.VALIDATION_CHAIN_KEY }}
- uses: ./.github/actions/rust-setup
# TODO(bradh): debug and re-enable this; the caching is breaking the clippy build
# Enable caching of the 'librocksdb-sys' crate by additionally caching the
# 'librocksdb-sys' src directory which is managed by cargo
# - uses: bmwill/rust-cache@v1 # Fork of 'Swatinem/rust-cache' which allows caching additional paths
# with:
# path: ~/.cargo/registry/src/**/librocksdb-sys-*
# See '.cargo/config' for list of enabled/disappled clippy lints
- name: cargo clippy
run: cargo xclippy -D warnings
rustfmt:
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v3
- run: rustup component add rustfmt
- name: rustfmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all --check