mirror of
https://github.com/alexgo-io/stacks-puppet-node.git
synced 2026-01-12 22:43:42 +08:00
Merge pull request #3632 from stacks-network/chore/unit-test-speedup
CI/Build: Speedup unit tests
This commit is contained in:
@@ -1,22 +0,0 @@
|
||||
FROM rust:bullseye AS test
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
ENV CARGO_MANIFEST_DIR="$(pwd)"
|
||||
|
||||
RUN rustup component add llvm-tools-preview && \
|
||||
cargo install grcov
|
||||
|
||||
ENV RUSTFLAGS="-Cinstrument-coverage" \
|
||||
LLVM_PROFILE_FILE="stacks-blockchain-%p-%m.profraw"
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN cargo build --workspace && \
|
||||
cargo test --workspace
|
||||
|
||||
# Generate coverage report and upload it to codecov
|
||||
RUN grcov . --binary-path ./target/debug/ -s . -t lcov --branch --ignore-not-existing --ignore "/*" -o lcov.info
|
||||
|
||||
FROM scratch AS export-stage
|
||||
COPY --from=test /build/lcov.info /
|
||||
14
.github/workflows/ci.yml
vendored
14
.github/workflows/ci.yml
vendored
@@ -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
|
||||
|
||||
|
||||
12
Cargo.toml
12
Cargo.toml
@@ -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"] }
|
||||
|
||||
Reference in New Issue
Block a user