Skip to content

Commit 9bb8969

Browse files
authored
ci: use dedicated action to start MongoDB replica set for tests (#2)
1 parent 9b83574 commit 9bb8969

2 files changed

Lines changed: 17 additions & 12 deletions

File tree

.github/workflows/coverage.yaml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,27 @@ jobs:
66
coverage:
77
runs-on: ubuntu-latest
88

9-
services:
10-
mongodb:
11-
image: mongo
12-
ports:
13-
- 27017:27017
14-
159
env:
1610
CARGO_TERM_COLOR: always
11+
1712
steps:
1813
- uses: actions/checkout@v4
14+
1915
- name: Install Rust
2016
run: rustup update stable
17+
2118
- name: Install cargo-llvm-cov
2219
uses: taiki-e/install-action@cargo-llvm-cov
20+
21+
- name: Start MongoDB replica set
22+
uses: supercharge/mongodb-github-action@1.12.0
23+
with:
24+
mongodb-version: 8
25+
mongodb-replica-set: rs0
26+
2327
- name: Generate code coverage
2428
run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info
29+
2530
- name: Upload coverage to Codecov
2631
uses: codecov/codecov-action@v3
2732
with:

.github/workflows/format-lint-test.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,6 @@ jobs:
1212
build:
1313
runs-on: ubuntu-latest
1414

15-
services:
16-
mongodb:
17-
image: mongo
18-
ports:
19-
- 27017:27017
20-
2115
steps:
2216
- uses: actions/checkout@v4
2317

@@ -29,5 +23,11 @@ jobs:
2923
- name: Lint
3024
run: cargo clippy --all-targets --all-features -- -D warnings
3125

26+
- name: Start MongoDB replica set
27+
uses: supercharge/mongodb-github-action@1.12.0
28+
with:
29+
mongodb-version: 8
30+
mongodb-replica-set: rs0
31+
3232
- name: Test
3333
run: cargo test --workspace

0 commit comments

Comments
 (0)