From 519789c6be8da869c9fdce76b6ea32b0774b853d Mon Sep 17 00:00:00 2001 From: Simon Walker Date: Fri, 26 Jul 2024 23:06:04 +0100 Subject: [PATCH 1/5] Add codecov --- .github/codecov.yml | 20 +++++++++++ .github/workflows/coverage.yml | 63 ++++++++++++++++++++++++++-------- 2 files changed, 68 insertions(+), 15 deletions(-) create mode 100644 .github/codecov.yml diff --git a/.github/codecov.yml b/.github/codecov.yml new file mode 100644 index 00000000..b8bfd7f4 --- /dev/null +++ b/.github/codecov.yml @@ -0,0 +1,20 @@ +# ref: https://docs.codecov.com/docs/codecovyml-reference +coverage: + range: 70..100 + round: down + precision: 1 + status: + # ref: https://docs.codecov.com/docs/commit-status + project: + default: + # Avoid false negatives + threshold: 1% + +# Test files aren't important for coverage +ignore: + - "tests" + +# Make comments less noisy +comment: + layout: "files" + require_changes: true \ No newline at end of file diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index f1842f02..ed364c6d 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -10,13 +10,41 @@ on: jobs: coverage: runs-on: ubuntu-latest - container: - image: xd009642/tarpaulin:develop-nightly - options: --security-opt seccomp=unconfined - steps: - - name: Checkout sources - uses: actions/checkout@v4 + # container: + # image: xd009642/tarpaulin:develop-nightly + # options: --security-opt seccomp=unconfined + # steps: + # - name: Checkout sources + # uses: actions/checkout@v4 + + # - name: Install ubuntu dependencies + # run: | + # apt-get update && apt-get install --no-install-recommends -y \ + # build-essential \ + # llvm-dev \ + # libcfitsio-dev \ + # pkg-config \ + # libssl-dev \ + # python3 + + # - name: Run cargo-tarpaulin + # run: | + # cargo +nightly tarpaulin --manifest-path fitsio/Cargo.toml --verbose --timeout 120 --out lcov + # - name: Coveralls + # uses: coverallsapp/github-action@master + # with: + # github-token: ${{ secrets.GITHUB_TOKEN }} + # path-to-lcov: lcov.info + + steps: + - uses: actions/checkout@v4 + with: + submodules: true + - name: Install stable + uses: dtolnay/rust-toolchain@stable + with: + components: llvm-tools-preview - name: Install ubuntu dependencies run: | apt-get update && apt-get install --no-install-recommends -y \ @@ -26,13 +54,18 @@ jobs: pkg-config \ libssl-dev \ python3 - - - name: Run cargo-tarpaulin - run: | - cargo +nightly tarpaulin --manifest-path fitsio/Cargo.toml --verbose --timeout 120 --out lcov - - - name: Coveralls - uses: coverallsapp/github-action@master + - name: cargo install cargo-llvm-cov + uses: taiki-e/install-action@cargo-llvm-cov + - name: cargo generate-lockfile + if: hashFiles('Cargo.lock') == '' + run: cargo generate-lockfile + - name: cargo llvm-cov + run: cargo llvm-cov -p fitsio --locked --all-features --lcov --output-path lcov.info + - name: Record Rust version + run: echo "RUST=$(rustc --version)" >> "$GITHUB_ENV" + - name: Upload to codecov.io + uses: codecov/codecov-action@v4 with: - github-token: ${{ secrets.GITHUB_TOKEN }} - path-to-lcov: lcov.info + fail_ci_if_error: true + token: ${{ secrets.CODECOV_TOKEN }} + env_vars: OS,RUST From 1308900a54490000ab44968f17cc0073ed23baa2 Mon Sep 17 00:00:00 2001 From: Simon Walker Date: Fri, 26 Jul 2024 23:09:15 +0100 Subject: [PATCH 2/5] Use sudo --- .github/workflows/coverage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index ed364c6d..15b37a16 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -47,7 +47,7 @@ jobs: components: llvm-tools-preview - name: Install ubuntu dependencies run: | - apt-get update && apt-get install --no-install-recommends -y \ + sudo apt-get update && sudo apt-get install --no-install-recommends -y \ build-essential \ llvm-dev \ libcfitsio-dev \ From ddec7a36bcf106d94356ba1918d572ca0bbc9139 Mon Sep 17 00:00:00 2001 From: Simon Walker Date: Fri, 26 Jul 2024 23:12:41 +0100 Subject: [PATCH 3/5] Don't test all features for cov --- .github/workflows/coverage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 15b37a16..8a20ad99 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -60,7 +60,7 @@ jobs: if: hashFiles('Cargo.lock') == '' run: cargo generate-lockfile - name: cargo llvm-cov - run: cargo llvm-cov -p fitsio --locked --all-features --lcov --output-path lcov.info + run: cargo llvm-cov -p fitsio --locked --lcov --output-path lcov.info - name: Record Rust version run: echo "RUST=$(rustc --version)" >> "$GITHUB_ENV" - name: Upload to codecov.io From fcc4fe5e0141cc58e3d37e3a342b6043ab6a2b55 Mon Sep 17 00:00:00 2001 From: Simon Walker Date: Fri, 26 Jul 2024 23:17:20 +0100 Subject: [PATCH 4/5] Bump minimum coverage level --- .github/codecov.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/codecov.yml b/.github/codecov.yml index b8bfd7f4..81ea2203 100644 --- a/.github/codecov.yml +++ b/.github/codecov.yml @@ -1,6 +1,6 @@ # ref: https://docs.codecov.com/docs/codecovyml-reference coverage: - range: 70..100 + range: 85..100 round: down precision: 1 status: From 4fc45690515205136006839b78b5f35d669b367e Mon Sep 17 00:00:00 2001 From: Simon Walker Date: Fri, 26 Jul 2024 23:18:17 +0100 Subject: [PATCH 5/5] Remove commented cov --- .github/workflows/coverage.yml | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 8a20ad99..3c36e351 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -10,32 +10,6 @@ on: jobs: coverage: runs-on: ubuntu-latest - # container: - # image: xd009642/tarpaulin:develop-nightly - # options: --security-opt seccomp=unconfined - # steps: - # - name: Checkout sources - # uses: actions/checkout@v4 - - # - name: Install ubuntu dependencies - # run: | - # apt-get update && apt-get install --no-install-recommends -y \ - # build-essential \ - # llvm-dev \ - # libcfitsio-dev \ - # pkg-config \ - # libssl-dev \ - # python3 - - # - name: Run cargo-tarpaulin - # run: | - # cargo +nightly tarpaulin --manifest-path fitsio/Cargo.toml --verbose --timeout 120 --out lcov - - # - name: Coveralls - # uses: coverallsapp/github-action@master - # with: - # github-token: ${{ secrets.GITHUB_TOKEN }} - # path-to-lcov: lcov.info steps: - uses: actions/checkout@v4