Tests #733
Workflow file for this run
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: Tests | |
# Cancel workflow if there is a new change to the branch. | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | |
on: | |
workflow_dispatch: | |
merge_group: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
env: | |
SCCACHE_GHA_ENABLED: "true" | |
RUSTC_WRAPPER: "sccache" | |
# https://github.com/BurntSushi/quickcheck/blob/master/src/tester.rs#L21 | |
QUICKCHECK_TESTS: 10 | |
QUICKCHECK_MAX_TESTS: 100 | |
jobs: | |
test: | |
name: build-and-test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup sccache | |
uses: mozilla-actions/[email protected] | |
timeout-minutes: 5 | |
continue-on-error: true | |
- uses: actions/setup-go@v4 | |
with: | |
go-version-file: "./go_compat/go.mod" | |
- name: Build | |
run: cargo check --workspace --all-features --all-targets | |
env: | |
CC: "sccache clang" | |
CXX: "sccache clang++" | |
- name: Run tests | |
run: cargo test --workspace --all-features --all-targets | |
env: | |
CC: "sccache clang" | |
CXX: "sccache clang++" | |
forest-sync-check: | |
if: ${{ contains(github.event.pull_request.labels.*.name, 'Release') }} | |
name: forest calibnet sync check | |
runs-on: buildjet-8vcpu-ubuntu-2004 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup sccache | |
uses: mozilla-actions/[email protected] | |
timeout-minutes: 5 | |
continue-on-error: true | |
- name: Update submodule forest | |
run: make update-forest | |
- name: Modify deps forest | |
run: make modify-forest | |
- name: Apt Dependencies Forest | |
uses: nick-fields/retry@v2 | |
with: | |
timeout_minutes: 5 | |
max_attempts: 3 | |
command: sudo make -C forest install-deps | |
- uses: actions/setup-go@v4 | |
with: | |
go-version-file: "./forest/src/libp2p_bitswap/tests/go-app/go.mod" | |
- name: Install nextest | |
uses: taiki-e/install-action@nextest | |
- name: Test forest | |
run: | | |
cd forest | |
make test | |
env: | |
CC: "sccache clang" | |
CXX: "sccache clang++" | |
- name: Install forest | |
run: | | |
cd forest | |
make install | |
env: | |
CC: "sccache clang" | |
CXX: "sccache clang++" | |
- name: Calibnet health check | |
run: | | |
cd forest | |
./scripts/tests/calibnet_other_check.sh | |
lint-all: | |
name: All lint checks (lint audit spellcheck udeps) | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Sources | |
uses: actions/checkout@v4 | |
- name: Setup sccache | |
uses: mozilla-actions/[email protected] | |
timeout-minutes: 5 | |
continue-on-error: true | |
- name: Apt Dependencies | |
uses: nick-fields/retry@v2 | |
with: | |
timeout_minutes: 5 | |
max_attempts: 3 | |
command: | | |
sudo apt-get update -y | |
sudo apt-get install -y libclang-dev # required dep for cargo-spellcheck | |
- uses: hanabi1224/[email protected] | |
- run: rustup toolchain install nightly | |
- name: Install Lint tools | |
run: make install-lint-tools | |
env: | |
RUSTFLAGS: "-Cstrip=symbols" | |
- run: make lint-all | |
env: | |
CC: "sccache clang" | |
CXX: "sccache clang++" | |
codecov: | |
name: Code coverage | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup sccache | |
uses: mozilla-actions/[email protected] | |
timeout-minutes: 5 | |
continue-on-error: true | |
- uses: actions/setup-go@v4 | |
with: | |
go-version-file: "./go_compat/go.mod" | |
- name: Install cargo-llvm-cov | |
uses: taiki-e/install-action@cargo-llvm-cov | |
- name: Generate code coverage | |
run: | | |
cargo llvm-cov --workspace --all-features --all-targets --lcov --output-path lcov.info | |
env: | |
CC: "sccache clang" | |
CXX: "sccache clang++" | |
- name: Upload CodeCov | |
uses: codecov/codecov-action@v3 | |
with: | |
files: lcov.info | |
fail_ci_if_error: true | |
cargo-dependency-check: | |
name: Check cargo files for duplicates | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: "3.1" | |
- name: Run rubocop | |
run: | | |
gem install rubocop --no-document | |
rubocop scripts/ | |
- name: Run dependencies checks | |
run: | | |
gem install toml-rb --no-document | |
ruby scripts/find_duplicate_deps.rb && \ | |
ruby scripts/find_unused_deps.rb --ignore serde --ignore num --ignore num-bigint --ignore num-traits --ignore fvm_ipld_bitfield |