Skip to content

Commit e35765b

Browse files
authored
Add code coverage (#3)
* Add codecov.yml * add back codecov * add codecov badge
1 parent 3c7b549 commit e35765b

File tree

3 files changed

+73
-48
lines changed

3 files changed

+73
-48
lines changed

.github/codecov.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Taken from https://github.com/jonhoo/rust-ci-conf/blob/main/.github/codecov.yml
2+
3+
# ref: https://docs.codecov.com/docs/codecovyml-reference
4+
coverage:
5+
# Hold ourselves to a high bar
6+
range: 85..100
7+
round: down
8+
precision: 1
9+
status:
10+
# ref: https://docs.codecov.com/docs/commit-status
11+
project:
12+
default:
13+
# Avoid false negatives
14+
threshold: 1%
15+
16+
# Test files aren't important for coverage
17+
ignore:
18+
- "tests"
19+
20+
# Make comments less noisy
21+
comment:
22+
layout: "files"
23+
require_changes: true

.github/workflows/test.yml

Lines changed: 47 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -109,51 +109,50 @@ jobs:
109109
run: cargo generate-lockfile
110110
- name: cargo test
111111
run: cargo test --locked --all-features --all-targets
112-
# # TODO: Setup code coverage.
113-
# coverage:
114-
# # use llvm-cov to build and collect coverage and outputs in a format that
115-
# # is compatible with codecov.io
116-
# #
117-
# # note that codecov as of v4 requires that CODECOV_TOKEN from
118-
# #
119-
# # https://app.codecov.io/gh/<user or org>/<project>/settings
120-
# #
121-
# # is set in two places on your repo:
122-
# #
123-
# # - https://github.com/jonhoo/guardian/settings/secrets/actions
124-
# # - https://github.com/jonhoo/guardian/settings/secrets/dependabot
125-
# #
126-
# # (the former is needed for codecov uploads to work with Dependabot PRs)
127-
# #
128-
# # PRs coming from forks of your repo will not have access to the token, but
129-
# # for those, codecov allows uploading coverage reports without a token.
130-
# # it's all a little weird and inconvenient. see
131-
# #
132-
# # https://github.com/codecov/feedback/issues/112
133-
# #
134-
# # for lots of more discussion
135-
# runs-on: ubuntu-latest
136-
# name: ubuntu / stable / coverage
137-
# steps:
138-
# - uses: actions/checkout@v4
139-
# with:
140-
# submodules: true
141-
# - name: Install stable
142-
# uses: dtolnay/rust-toolchain@stable
143-
# with:
144-
# components: llvm-tools-preview
145-
# - name: cargo install cargo-llvm-cov
146-
# uses: taiki-e/install-action@cargo-llvm-cov
147-
# - name: cargo generate-lockfile
148-
# if: hashFiles('Cargo.lock') == ''
149-
# run: cargo generate-lockfile
150-
# - name: cargo llvm-cov
151-
# run: cargo llvm-cov --locked --all-features --lcov --output-path lcov.info
152-
# - name: Record Rust version
153-
# run: echo "RUST=$(rustc --version)" >> "$GITHUB_ENV"
154-
# - name: Upload to codecov.io
155-
# uses: codecov/codecov-action@v5
156-
# with:
157-
# fail_ci_if_error: true
158-
# token: ${{ secrets.CODECOV_TOKEN }}
159-
# env_vars: OS,RUST
112+
coverage:
113+
# use llvm-cov to build and collect coverage and outputs in a format that
114+
# is compatible with codecov.io
115+
#
116+
# note that codecov as of v4 requires that CODECOV_TOKEN from
117+
#
118+
# https://app.codecov.io/gh/<user or org>/<project>/settings
119+
#
120+
# is set in two places on your repo:
121+
#
122+
# - https://github.com/jonhoo/guardian/settings/secrets/actions
123+
# - https://github.com/jonhoo/guardian/settings/secrets/dependabot
124+
#
125+
# (the former is needed for codecov uploads to work with Dependabot PRs)
126+
#
127+
# PRs coming from forks of your repo will not have access to the token, but
128+
# for those, codecov allows uploading coverage reports without a token.
129+
# it's all a little weird and inconvenient. see
130+
#
131+
# https://github.com/codecov/feedback/issues/112
132+
#
133+
# for lots of more discussion
134+
runs-on: ubuntu-latest
135+
name: ubuntu / stable / coverage
136+
steps:
137+
- uses: actions/checkout@v4
138+
with:
139+
submodules: true
140+
- name: Install stable
141+
uses: dtolnay/rust-toolchain@stable
142+
with:
143+
components: llvm-tools-preview
144+
- name: cargo install cargo-llvm-cov
145+
uses: taiki-e/install-action@cargo-llvm-cov
146+
- name: cargo generate-lockfile
147+
if: hashFiles('Cargo.lock') == ''
148+
run: cargo generate-lockfile
149+
- name: cargo llvm-cov
150+
run: cargo llvm-cov --locked --all-features --lcov --output-path lcov.info
151+
- name: Record Rust version
152+
run: echo "RUST=$(rustc --version)" >> "$GITHUB_ENV"
153+
- name: Upload to codecov.io
154+
uses: codecov/codecov-action@v5
155+
with:
156+
fail_ci_if_error: true
157+
token: ${{ secrets.CODECOV_TOKEN }}
158+
env_vars: OS,RUST

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1+
[![codecov](https://codecov.io/gh/cmu-db/optd/graph/badge.svg?token=FYM7I3R3GZ)](https://codecov.io/gh/cmu-db/optd)
2+
13
# optd
4+
25
Query Optimizer Service
36

47
## Documentation

0 commit comments

Comments
 (0)