Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
32 changes: 30 additions & 2 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ env:
CACHE_TIMEOUT_MINUTES: 5
AWS_ACCESS_KEY_ID: "${{ secrets.AWS_ACCESS_KEY_ID }}"
AWS_SECRET_ACCESS_KEY: "${{ secrets.AWS_SECRET_ACCESS_KEY }}"
RUSTC_WRAPPER: "sccache"
CC: clang
CXX: clang++
# To minimize compile times: https://nnethercote.github.io/perf-book/build-configuration.html#minimizing-compile-times
Expand All @@ -41,17 +42,34 @@ env:
FIL_PROOFS_PARAMETER_CACHE: /var/tmp/filecoin-proof-parameters
RUST_LOG: error
FOREST_ACTOR_BUNDLE_PATH: /var/tmp/forest_actor_bundle.car.zst
# https://github.com/BurntSushi/quickcheck/blob/692527d1d9fc9043a70b7d2bf436902e2d0f595b/src/tester.rs#L20
QUICKCHECK_GENERATOR_SIZE: 20
QUICKCHECK_TESTS: 20
QUICKCHECK_MAX_TESTS: 1000

jobs:
codecov:
name: Coverage
if: github.event.pull_request.draft == false && github.actor != 'dependabot[bot]'
if: github.event.pull_request.draft == false
Comment thread
coderabbitai[bot] marked this conversation as resolved.
runs-on: warp-ubuntu-2404-arm64-8x
timeout-minutes: 30
steps:
- name: Configure SCCache variables
run: |
# External PRs do not have access to 'vars' or 'secrets'.
if [[ "${{secrets.AWS_ACCESS_KEY_ID}}" != "" ]]; then
echo "SCCACHE_ENDPOINT=${{ vars.SCCACHE_ENDPOINT}}" >> $GITHUB_ENV
echo "SCCACHE_BUCKET=${{ vars.SCCACHE_BUCKET}}" >> $GITHUB_ENV
echo "SCCACHE_REGION=${{ vars.SCCACHE_REGION}}" >> $GITHUB_ENV
fi
- name: Setup sccache
uses: mozilla-actions/sccache-action@v0.0.9
timeout-minutes: ${{ fromJSON(env.CACHE_TIMEOUT_MINUTES) }}
continue-on-error: true
- uses: actions/checkout@v6
- uses: jdx/mise-action@v4
- uses: taiki-e/install-action@cargo-llvm-cov
- uses: taiki-e/install-action@nextest
- uses: actions/cache@v5
id: cache-proof-params
with:
Expand All @@ -65,10 +83,20 @@ jobs:
- name: Fetch proof params and RPC test snapshots
run: |
# Use the same profile to re-use some compilation artifacts and speed up the entire job.
cargo llvm-cov run --no-report --bin forest-dev --no-default-features -- fetch-test-snapshots --actor-bundle $FOREST_ACTOR_BUNDLE_PATH
cargo llvm-cov run --profile codecov --no-report --bin forest-dev --no-default-features -- fetch-test-snapshots --actor-bundle $FOREST_ACTOR_BUNDLE_PATH
ls -ahl $FIL_PROOFS_PARAMETER_CACHE
- name: Generate code coverage
run: mise codecov
env:
FOREST_TEST_SKIP_PROOF_PARAM_CHECK: 1
- name: Upload Test Results to CodeCov
uses: codecov/codecov-action@v6
if: ${{ !cancelled() }}
with:
token: ${{ secrets.CODECOV_TOKEN }}
report_type: "test_results"
files: target/nextest/default/junit.xml
fail_ci_if_error: false
# Save lcov.info as an artifact for debugging purposes
- uses: actions/upload-artifact@v7
with:
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/forest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,10 @@ jobs:
with:
go-version-file: "go.work"
cache-dependency-path: "**/go.sum"
- name: Cargo Check
run: cargo check
- uses: jdx/mise-action@v4
- run: cargo check
# nextest doesn't run doctests https://github.com/nextest-rs/nextest/issues/16
- run: mise test:docs
Comment thread
hanabi1224 marked this conversation as resolved.
build-ubuntu:
name: Build Ubuntu
runs-on: ubuntu-24.04
Expand Down
101 changes: 0 additions & 101 deletions .github/workflows/unit-tests.yml

This file was deleted.

10 changes: 10 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,16 @@ debug = false
# Speed up debug tests and codecov tests
opt-level = 1

[profile.codecov]
inherits = "dev"
opt-level = 1

[profile.codecov.package."*"]
# Avoid generating any debug information for dependencies
debug = false
# Speed up debug tests and codecov tests
opt-level = 1
Comment thread
hanabi1224 marked this conversation as resolved.

# Profile for interactive debugging sessions, e.g., with LLDB.
# Doesn't work with Go FFI - disable it with `FOREST_F3_SIDECAR_FFI_BUILD_OPT_OUT=1`.
[profile.debugging]
Expand Down
32 changes: 23 additions & 9 deletions mise.toml
Original file line number Diff line number Diff line change
Expand Up @@ -160,13 +160,8 @@ rm -rf node_modules
# nextest doesn't run doctests https://github.com/nextest-rs/nextest/issues/16
# We need to run them separately.
description = "Run doctests."
usage = '''
arg "<profile>" help="Build profile (quick-test, dev, etc.)" default="quick-test" {
choices "quick" "quick-test" "release" "dev"
}
'''
run = '''
cargo test --doc --profile ${usage_profile?} --no-default-features --features "test doctest-private cargo-test" --no-fail-fast
cargo test --doc --no-default-features --features "test doctest-private cargo-test" --no-fail-fast
'''

[tasks."test:nextest"]
Expand Down Expand Up @@ -194,7 +189,7 @@ cargo test --lib --profile ${usage_profile?} --no-default-features --features "t
'''

[tasks.test]
description = "Run all tests."
description = "Run nextest and cargo-test groups (doctests run via `test:docs`)."
usage = '''
arg "<profile>" help="Build profile (quick-test, dev, etc.)" default="quick-test" {
choices "quick" "quick-test" "release" "dev"
Expand All @@ -203,13 +198,32 @@ arg "<profile>" help="Build profile (quick-test, dev, etc.)" default="quick-test
run = '''
mise task run test:nextest ${usage_profile?}
mise task run test:cargo ${usage_profile?}
mise task run test:docs ${usage_profile?}
'''
Comment thread
coderabbitai[bot] marked this conversation as resolved.

[tasks."codecov:nextest"]
description = "Run codecov with nextest"
run = '''
cargo llvm-cov --no-report nextest --cargo-profile codecov --workspace --no-default-features --features "test" --no-fail-fast
'''

[tasks."codecov:cargo"]
description = "Run codecov with cargo-test"
run = '''
cargo llvm-cov --no-report test -p forest-filecoin --profile codecov --lib --no-default-features --features "test cargo-test" --no-fail-fast -- "cargo_test_"
'''

[tasks."codecov:report"]
description = "Generate merged codecov report"
run = '''
cargo llvm-cov report --profile codecov --codecov --output-path lcov.info
'''

[tasks.codecov]
description = "Generate codecov report"
run = '''
cargo llvm-cov -p forest-filecoin --codecov --no-default-features --features "test cargo-test" --output-path lcov.info
mise task run codecov:nextest
mise task run codecov:cargo
Comment thread
hanabi1224 marked this conversation as resolved.
mise task run codecov:report
'''

[tasks."format-spellcheck-dictionary"]
Expand Down
Loading