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

CI/Build: Speedup unit tests #3632

Merged
merged 2 commits into from
Mar 30, 2023
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
22 changes: 0 additions & 22 deletions .github/actions/bitcoin-int-tests/Dockerfile.code-cov

This file was deleted.

14 changes: 9 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,21 @@ jobs:
unit-tests:
runs-on: ubuntu-latest
steps:
- name: Add code coverage tools
run: |
rustup component add llvm-tools-preview
cargo install grcov
- uses: actions/checkout@v2
- name: Run units tests (with coverage)
env:
DOCKER_BUILDKIT: 1
# Remove .dockerignore file so codecov has access to git info
RUSTFLAGS: -Cinstrument-coverage
LLVM_PROFILE_FILE: stacks-blockchain-%p-%m.profraw
run: |
rm .dockerignore
docker build -o coverage-output -f ./.github/actions/bitcoin-int-tests/Dockerfile.code-cov .
cargo test --workspace
grcov . --binary-path ./target/debug/ -s . -t lcov --branch --ignore-not-existing --ignore "/*" -o lcov.info
- uses: codecov/codecov-action@v2
with:
files: ./coverage-output/lcov.info
files: ./lcov.info
name: unit_tests
fail_ci_if_error: false

Expand Down
12 changes: 10 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,16 @@ monitoring_prom = ["prometheus"]
slog_json = ["slog-json", "stacks_common/slog_json", "clarity/slog_json"]
testing = []

[profile.dev.package.regex]
opt-level = 2
# Use a bit more than default optimization for
# dev builds to speed up test execution
[profile.dev]
opt-level = 1

# Use release-level optimization for dependencies
# This slows down "first" builds on development environments,
# but won't impact subsequent builds.
[profile.dev.package."*"]
opt-level = 3

[target.'cfg(all(any(target_arch = "x86_64", target_arch = "x86", target_arch = "aarch64"), not(target_env = "msvc")))'.dependencies]
sha2 = { version = "0.10", features = ["asm"] }
Expand Down