diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 35b73f0..345b91b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,8 +32,14 @@ jobs: - name: Build project run: cargo build --verbose - - name: Generate coverage report - run: cargo llvm-cov --lcov --output-path lcov.info + - name: Generate coverage and check threshold + run: | + COVERAGE=$(cargo llvm-cov report | grep "TOTAL" | awk '{print $4}' | sed 's/%//') + echo "Coverage: $COVERAGE%" + if (( $(echo "$COVERAGE < 80" | bc -l) )); then + echo "Coverage is below 80%" + exit 1 + fi - name: Upload coverage to Codecov uses: codecov/codecov-action@v5 diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 0000000..f1fac19 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,9 @@ +coverage: + status: + project: + default: + target: 80% + threshold: 1% + patch: + default: + target: 80%