diff --git a/.github/actions/bitcoin-int-tests/Dockerfile.code-cov b/.github/actions/bitcoin-int-tests/Dockerfile.code-cov deleted file mode 100644 index 209b80473..000000000 --- a/.github/actions/bitcoin-int-tests/Dockerfile.code-cov +++ /dev/null @@ -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 / diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d1a04a194..fcdc1ebda 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 diff --git a/Cargo.toml b/Cargo.toml index b930bacb7..4af100218 100644 --- a/Cargo.toml +++ b/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"] }