diff --git a/.cargo/config.toml b/.cargo/config.toml index 997f237..3f9ae11 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,11 +1,14 @@ [build] -target = "x86_64-unknown-linux-musl" +#target = "x86_64-unknown-linux-musl" # Flags to enable code-coverage for all builds. # These can be removed later. -rustflags = ["-Cinstrument-coverage"] +#rustflags = ["-Cinstrument-coverage"] incremental = true [env] # Name of coverage instrumentation log file. LLVM_PROFILE_FILE="target/cargo-test-%p-%m.profraw" + +[target.x86_64-unknown-linux-gnu] +rustflags = ["-Cinstrument-coverage"] diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index d310ebd..00ca61d 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -28,3 +28,7 @@ jobs: run: cargo clippy --all-targets --no-deps -- -Dwarnings - name: Run tests run: cargo test --verbose + - name: Build (MUSL) + run: cargo build --verbose --all-targets --target x86_64-unknown-linux-musl + - name: Run tests (MUSL) + run: cargo test --verbose --target x86_64-unknown-linux-musl diff --git a/scripts/coverage b/scripts/coverage index 096202a..f651cd5 100755 --- a/scripts/coverage +++ b/scripts/coverage @@ -32,7 +32,7 @@ echo "Running tests" cargo test # Generate html -grcov target/ --binary-path ./target/x86_64-unknown-linux-musl/debug/deps -s src/ -t html \ +grcov target/ --binary-path ./target/debug/deps -s src/ -t html \ --branch --ignore-not-existing --ignore '../*' --ignore "/*" -o target/coverage/html if [ "$1" == "--show" ]; then @@ -42,7 +42,7 @@ if [ "$1" == "--show" ]; then fi # Generate markdown -grcov target/ --binary-path ./target/x86_64-unknown-linux-musl/debug/deps -s src/ -t markdown \ +grcov target/ --binary-path ./target/debug/deps -s src/ -t markdown \ --branch --ignore-not-existing --ignore '../*' --ignore "/*" -o target/coverage/markdown cat target/coverage/markdown diff --git a/scripts/pre-commit b/scripts/pre-commit index bcea321..0363a86 100755 --- a/scripts/pre-commit +++ b/scripts/pre-commit @@ -6,7 +6,7 @@ set -eo pipefail if [ -f Cargo.toml ]; then # Ensure that all targets can be built. - scripts/coverage --no-run + cargo build --all-targets #Ensure that code is correctly formatted. cargo fmt --check || (echo "Run cargo fmt to fix formatting" && exit 1) diff --git a/scripts/pre-push b/scripts/pre-push index 439a4c0..7790f4b 100755 --- a/scripts/pre-push +++ b/scripts/pre-push @@ -11,5 +11,7 @@ if [ -f Cargo.toml ]; then # Ensure that all tests pass # Also generate coverage information. - scripts/coverage + if [[ "$OSTYPE" == "linux-gnu"* ]]; then + scripts/coverage + fi fi