Skip to content

Commit

Permalink
Add codecov
Browse files Browse the repository at this point in the history
  • Loading branch information
simonrw committed Jul 26, 2024
1 parent b90e8a7 commit 519789c
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 15 deletions.
20 changes: 20 additions & 0 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
@@ -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
63 changes: 48 additions & 15 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -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

0 comments on commit 519789c

Please sign in to comment.