Testnet4 #441
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
# Some integration tests can produce too much INFO logs that are infeasible to be printed on failure. | ||
RUST_LOG: error | ||
# RUSTFLAGS: -D warnings | ||
RUSTDOCFLAGS: -D warnings | ||
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: rustfmt | ||
#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: Install Foundry | ||
uses: foundry-rs/foundry-toolchain@v1 | ||
- name: Set environment variables | ||
run: | | ||
echo "CARGO_PROFILE_TEST_BUILD_OVERRIDE_DEBUG=true" >> $GITHUB_ENV | ||
- name: cargo test | ||
run: | | ||
export PATH=$HOME/.foundry/bin:$PATH | ||
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 | ||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # Pin v4.1.1 | ||
with: | ||
ref: ${{ github.event.inputs.sui_repo_ref || github.ref }} | ||
- run: rustup component add rustfmt | ||
- name: rustfmt | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: fmt | ||
args: --all --check | ||
args: --check | ||
cargo-deny: | ||
name: cargo-deny (advisories, licenses, bans, ...) | ||
needs: diff | ||
if: needs.diff.outputs.isRust == 'true' | ||
runs-on: [ ubuntu-latest ] | ||
steps: | ||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # Pin v4.1.1 | ||
with: | ||
ref: ${{ github.event.inputs.sui_repo_ref || github.ref }} | ||
- uses: taiki-e/install-action@cargo-deny | ||
- run: cargo deny check | ||
sui-excution-cut: | ||
name: cutting a new execution layer | ||
needs: diff | ||
if: needs.diff.outputs.isRust == 'true' | ||
runs-on: [ ubuntu-ghcloud ] | ||
steps: | ||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # Pin v4.1.1 | ||
with: | ||
ref: ${{ github.event.inputs.sui_repo_ref || github.ref }} | ||
- name: Install cargo-hakari, and cache the binary | ||
uses: baptiste0928/cargo-install@1cd874a5478fdca35d868ccc74640c5aabbb8f1b # pin@v3.0.0 | ||
with: | ||
crate: cargo-hakari | ||
locked: true | ||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # Pin v4.1.1 | ||
with: | ||
ref: ${{ github.event.inputs.sui_repo_ref || github.ref }} | ||
- name: Make cut | ||
run: ./scripts/execution_layer.py cut for_ci_test | ||
- name: Check execution builds | ||
run: cargo build -p sui-execution |