From 5d2ae149e91ff5fcbb44bc22a315aa79e0ecd70e Mon Sep 17 00:00:00 2001 From: Dominik Nakamura Date: Mon, 14 Jun 2021 15:48:52 +0900 Subject: [PATCH] Upload coverage to GitHub Pages instead of codecov --- .gitignore | 2 -- Justfile | 31 +++++++++++-------------------- README.md | 4 ++-- 3 files changed, 13 insertions(+), 24 deletions(-) diff --git a/.gitignore b/.gitignore index 168b899..a9f9ee8 100644 --- a/.gitignore +++ b/.gitignore @@ -4,5 +4,3 @@ *.profraw .env Cargo.lock -codecov -lcov.info diff --git a/Justfile b/Justfile index 3282a66..ed6a7fd 100644 --- a/Justfile +++ b/Justfile @@ -4,31 +4,22 @@ default: # run integration tests with coverage coverage: - cargo install grcov + cargo install grcov --git https://github.com/mozilla/grcov.git --rev c7a9b20d246a0cda812db509f206b38b3116cba4 rustup component add --toolchain nightly llvm-tools-preview - rm -rf *.profraw ./target/debug/coverage lcov.info + rm -rf *.profraw ./target/debug/coverage RUSTFLAGS="-Zinstrument-coverage -Clink-dead-code" LLVM_PROFILE_FILE="coverage-%p-%m.profraw" cargo +nightly test --all-features rustup run nightly grcov . -s . --binary-path ./target/debug/ -t html --branch --ignore-not-existing -o ./target/debug/coverage - rustup run nightly grcov . -s . --binary-path ./target/debug/ -t lcov --branch --ignore-not-existing --ignore "/*" -o lcov.info rm -f *.profraw -# upload coverage to https://codecov.io -upload-coverage: get-codecov - @# {{env_var("CODECOV_TOKEN")}} - just coverage - bash -c "export CODECOV_TOKEN=$CODECOV_TOKEN && ./codecov -f lcov.info" - -get-codecov: - #!/usr/bin/env bash - set -euo pipefail - curl -s https://codecov.io/bash > codecov; - VERSION=$(grep -o 'VERSION=\"[0-9\.]*\"' codecov | cut -d'"' -f2); - for i in 1 256 512 - do - shasum -a $i -c --ignore-missing <(curl -s "https://raw.githubusercontent.com/codecov/codecov-bash/${VERSION}/SHA${i}SUM") || - shasum -a $i -c <(curl -s "https://raw.githubusercontent.com/codecov/codecov-bash/${VERSION}/SHA${i}SUM") - done - chmod +x codecov +# upload coverage to GitHub Pages +upload-coverage: coverage + git checkout gh-pages + rm -rf badges examples src tests coverage.json index.html + cp -R target/debug/coverage/ . + git add -A badges examples src tests coverage.json index.html + git commit -m "Coverage for $(git rev-parse --short main)" + # git push + git checkout main diff --git a/README.md b/README.md index 77d220c..b51a5aa 100644 --- a/README.md +++ b/README.md @@ -11,8 +11,8 @@ [crates-url]: https://crates.io/crates/obws [doc-img]: https://img.shields.io/badge/docs.rs-obws-4d76ae?style=for-the-badge [doc-url]: https://docs.rs/obws -[cover-img]: https://img.shields.io/codecov/c/gh/dnaka91/obws?style=for-the-badge -[cover-url]: https://codecov.io/gh/dnaka91/obws +[cover-img]: https://img.shields.io/endpoint?url=https://dnaka91.github.io/obws/coverage.json&style=for-the-badge +[cover-url]: https://dnaka91.github.io/obws Remote control OBS with the [obs-websocket] plugin from Rust 🦀.