Skip to content

Commit 66f03d5

Browse files
chore: enable codecov (lancedb#2088)
enable codecov also, because instrumentation build is slow at runtime: * switch over to big buildjet runner * pin rust version to `1.76` (1.70 is the default on buildjet) * switch cache over to buildjet
1 parent c914462 commit 66f03d5

File tree

2 files changed

+49
-9
lines changed

2 files changed

+49
-9
lines changed

.github/workflows/rust.yml

+36-9
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ env:
2828

2929
jobs:
3030
linux-build:
31-
runs-on: ubuntu-22.04
31+
runs-on: buildjet-8vcpu-ubuntu-2204
3232
timeout-minutes: 45
3333
strategy:
3434
matrix:
@@ -41,9 +41,30 @@ jobs:
4141
CXX: g++-12
4242
steps:
4343
- uses: actions/checkout@v4
44+
# pin the toolchain version to avoid surprises
45+
- uses: actions-rust-lang/setup-rust-toolchain@v1
46+
if: ${{ matrix.toolchain == 'stable' }}
47+
with:
48+
toolchain: "1.76.0"
49+
cache-workspaces: "src/rust"
50+
# Disable full debug symbol generation to speed up CI build and keep memory down
51+
# "1" means line tables only, which is useful for panic tracebacks.
52+
rustflags: "-C debuginfo=1"
53+
components: "rustfmt,clippy"
54+
- uses: actions-rust-lang/setup-rust-toolchain@v1
55+
if: ${{ matrix.toolchain != 'stable' }}
56+
with:
57+
toolchain: "nightly"
58+
cache-workspaces: "src/rust"
59+
# Disable full debug symbol generation to speed up CI build and keep memory down
60+
# "1" means line tables only, which is useful for panic tracebacks.
61+
rustflags: "-C debuginfo=1"
62+
components: "rustfmt,clippy"
4463
- uses: Swatinem/rust-cache@v2
4564
with:
65+
prefix-key: "buildjet-v1"
4666
workspaces: rust
67+
cache-provider: "buildjet"
4768
- name: Install dependencies
4869
run: |
4970
sudo apt update
@@ -52,25 +73,29 @@ jobs:
5273
rustup component add rustfmt
5374
- name: Run cargo fmt
5475
run: cargo fmt --check
55-
# split everything us so we know what's slow.
56-
- name: Build
57-
run: |
58-
cargo build --all-features --tests
5976
- name: Start DynamoDB local for tests
6077
if: ${{ matrix.toolchain == 'stable' }}
6178
run: |
6279
docker run -d -e AWS_ACCESS_KEY_ID=DUMMYKEY -e AWS_SECRET_ACCESS_KEY=DUMMYKEY -p 8000:8000 amazon/dynamodb-local
80+
- name: Install cargo-llvm-cov
81+
uses: taiki-e/install-action@cargo-llvm-cov
6382
- name: Run tests
6483
if: ${{ matrix.toolchain == 'stable' }}
6584
run: |
66-
cargo test --features dynamodb,tensorflow,dynamodb_tests,cli
85+
cargo llvm-cov --workspace --codecov --output-path coverage.codecov --features dynamodb,tensorflow,dynamodb_tests,cli
6786
- name: Run tests (nightly)
6887
if: ${{ matrix.toolchain != 'stable' }}
6988
run: |
7089
cargo test
71-
- name: Build benchmarks
90+
- name: Upload coverage to Codecov
7291
if: ${{ matrix.toolchain == 'stable' }}
73-
run: cargo build --benches
92+
uses: codecov/codecov-action@v4
93+
with:
94+
token: ${{ secrets.CODECOV_TOKEN }}
95+
codecov_yml_path: codecov.yml
96+
files: coverage.codecov
97+
flags: unittests
98+
fail_ci_if_error: false
7499
linux-arm:
75100
runs-on: buildjet-4vcpu-ubuntu-2204-arm
76101
timeout-minutes: 30
@@ -89,7 +114,7 @@ jobs:
89114
- name: Run tests
90115
run: |
91116
cargo test --all-features -- --test-threads 1
92-
clippy:
117+
clippy_and_benchmark:
93118
runs-on: ubuntu-22.04
94119
timeout-minutes: 30
95120
steps:
@@ -103,6 +128,8 @@ jobs:
103128
sudo apt install -y protobuf-compiler libssl-dev
104129
- name: Run clippy
105130
run: cargo clippy --features cli,dynamodb,tensorflow,dynamodb_tests --tests --benches -- -D warnings
131+
- name: Build benchmarks
132+
run: cargo build --benches
106133
mac-build:
107134
runs-on: "macos-14"
108135
timeout-minutes: 45

codecov.yml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# make all status informational -- pass no matter what
2+
coverage:
3+
status:
4+
project:
5+
default:
6+
target: 50%
7+
threshold: 10%
8+
informational: true
9+
patch:
10+
default:
11+
target: 50%
12+
threshold: 10%
13+
informational: true

0 commit comments

Comments
 (0)