Skip to content

Commit da598b6

Browse files
committed
Auto merge of #4303 - rust-lang:coverage, r=Turbo87
CI: Extract test coverage tracking into dedicated workflow ... and run that workflow only for pushes on the primary branch, instead of slowing down every single PR. Unless we make that coverage data more visible (e.g. using something like Codecov), it is probably not worth it to send 60% of the CI time of each PR just on the backend test coverage tracking, which somehow seems to escape the regular CI caches.
2 parents c20cc99 + 033fdbf commit da598b6

File tree

2 files changed

+51
-9
lines changed

2 files changed

+51
-9
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -140,16 +140,7 @@ jobs:
140140
cargo install diesel_cli --vers $(cat .diesel_version) --no-default-features --features postgres --debug
141141
diesel database setup --locked-schema
142142
143-
- name: Install cargo-tarpaulin
144-
if: matrix.rust == 'stable'
145-
run: cargo install cargo-tarpaulin --version ~0.18.0-alpha.3
146-
147-
- name: Run tests (with coverage report)
148-
if: matrix.rust == 'stable'
149-
run: cargo tarpaulin --avoid-cfg-tarpaulin --workspace
150-
151143
- name: Run tests
152-
if: matrix.rust != 'stable'
153144
run: cargo test --workspace
154145

155146

.github/workflows/coverage.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Coverage
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- master
8+
9+
env:
10+
RUST_VERSION: 1.57.0
11+
12+
jobs:
13+
coverage:
14+
name: Test Coverage
15+
runs-on: ubuntu-20.04
16+
17+
env:
18+
RUST_BACKTRACE: 1
19+
DATABASE_URL: postgres://postgres:postgres@localhost/cargo_registry_test
20+
TEST_DATABASE_URL: postgres://postgres:postgres@localhost/cargo_registry_test
21+
RUSTFLAGS: "-D warnings"
22+
MALLOC_CONF: "background_thread:true,abort_conf:true,abort:true,junk:true"
23+
24+
services:
25+
postgres:
26+
image: postgres:13
27+
env:
28+
POSTGRES_PASSWORD: postgres
29+
# Set health checks to wait until postgres has started
30+
options: >-
31+
--health-cmd pg_isready
32+
--health-interval 10s
33+
--health-timeout 5s
34+
--health-retries 5
35+
ports:
36+
- 5432:5432
37+
38+
steps:
39+
- uses: actions/checkout@v2
40+
41+
# Set up Rust
42+
- run: rustup default ${{ env.RUST_VERSION }}
43+
- uses: Swatinem/rust-cache@v1.3.0
44+
45+
# Set up database
46+
- run: cargo install diesel_cli --vers $(cat .diesel_version) --no-default-features --features postgres --debug
47+
- run: diesel database setup --locked-schema
48+
49+
# Set up cargo-tarpaulin and run the tests
50+
- run: cargo install cargo-tarpaulin --version ~0.18.0-alpha.3
51+
- run: cargo tarpaulin --avoid-cfg-tarpaulin --workspace

0 commit comments

Comments
 (0)