Skip to content

Commit e2b8df4

Browse files
committed
space management and use codecov
1 parent 4baa925 commit e2b8df4

File tree

2 files changed

+35
-8
lines changed

2 files changed

+35
-8
lines changed

ci/ci-fuzz.sh

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,31 @@
22
set -eox pipefail
33

44
echo -e "\n\nGenerating fuzz coverage report"
5-
# In CI, store coverage in a specific directory for artifact collection
6-
COVERAGE_DIR="coverage-report"
5+
# In CI, store coverage in target directory for consistency with other artifacts
6+
COVERAGE_DIR="target/coverage-report"
77
echo "Installing cargo-llvm-cov..."
88
# Install cargo-llvm-cov if not already installed
99
cargo install cargo-llvm-cov --locked
10+
11+
# Clean up disk space if needed
12+
if [ "$CI_MINIMIZE_DISK_USAGE" != "" ]; then
13+
echo "Cleaning up to save disk space..."
14+
rm -rf target/debug/incremental/
15+
rm -rf target/debug/.fingerprint/
16+
# Remove previous coverage reports if they exist
17+
rm -rf target/coverage-report/
18+
rm -rf fuzz/coverage-report/
19+
# Clean release artifacts but keep debug for current run
20+
cargo clean --release
21+
echo "Disk cleanup completed"
22+
fi
23+
1024
echo "Running fuzz coverage generation..."
1125
./contrib/generate_fuzz_coverage.sh --output-dir "$COVERAGE_DIR"
1226
echo "Coverage generation completed. Checking results..."
13-
if [ -f "fuzz/$COVERAGE_DIR/html/index.html" ]; then
14-
echo "✓ Coverage report successfully generated at fuzz/$COVERAGE_DIR/html/index.html"
15-
ls -la "fuzz/$COVERAGE_DIR/html/"
16-
else
17-
echo "✗ Coverage report not found at expected location"
18-
fi
27+
28+
# Upload fuzz coverage to codecov if the file exists (CI only)
29+
if [ -f "$COVERAGE_DIR/fuzz-codecov.json" ]; then
30+
echo "Uploading fuzz coverage to codecov..."
31+
bash <(curl -s https://codecov.io/bash) -f "$COVERAGE_DIR/fuzz-codecov.json" -F fuzz -t "f421b687-4dc2-4387-ac3d-dc3b2528af57"
32+
fi

contrib/generate_fuzz_coverage.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,19 @@ export RUSTFLAGS="--cfg=fuzzing --cfg=secp256k1_fuzz --cfg=hashes_fuzz"
5555
# ignore anything in fuzz directory since we don't want coverage of targets
5656
cargo llvm-cov --html --ignore-filename-regex "fuzz/" --output-dir "$OUTPUT_DIR"
5757

58+
# Generate codecov JSON format if running in CI environment
59+
if [ "$CI" = "true" ] || [ "$GITHUB_ACTIONS" = "true" ]; then
60+
echo "CI environment detected, generating codecov JSON format..."
61+
cargo llvm-cov --codecov --ignore-filename-regex "fuzz/" --output-path "$OUTPUT_DIR/fuzz-codecov.json"
62+
63+
# If we're in the fuzz directory, move the codecov file to the parent target directory
64+
if [ -f "$OUTPUT_DIR/fuzz-codecov.json" ] && [[ "$OUTPUT_DIR" == *"target/"* ]]; then
65+
TARGET_DIR="${OUTPUT_DIR%/coverage-report}"
66+
cp "$OUTPUT_DIR/fuzz-codecov.json" "$TARGET_DIR/fuzz-codecov.json"
67+
echo "Fuzz codecov report copied to $TARGET_DIR/fuzz-codecov.json"
68+
fi
69+
fi
70+
5871
# Check if coverage report was generated successfully
5972
# The report is generated in $OUTPUT_DIR/html/index.html when using --html --output-dir
6073
if [ ! -f "$OUTPUT_DIR/html/index.html" ]; then

0 commit comments

Comments
 (0)