Skip to content

Commit debf2a7

Browse files
authored
chore: Enable coverage on PR (getdozer#663)
1 parent fc84a43 commit debf2a7

File tree

3 files changed

+83
-93
lines changed

3 files changed

+83
-93
lines changed

.github/workflows/coverage.yaml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: Dozer Coverage
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
12+
concurrency:
13+
group: coverage/${{ github.ref }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
# Run coverage
18+
coverage:
19+
timeout-minutes: 60
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v3
23+
- name: Install stable with llvm-tools-preview
24+
uses: actions-rs/toolchain@v1
25+
with:
26+
profile: minimal
27+
toolchain: stable
28+
components: llvm-tools-preview
29+
30+
- name: Install Protoc
31+
uses: arduino/setup-protoc@v1
32+
with:
33+
repo-token: ${{ secrets.GITHUB_TOKEN }}
34+
35+
- name: MongoDB in GitHub Actions
36+
uses: supercharge/[email protected]
37+
38+
- uses: ./.github/workflows/setup-snowflake-and-kafka
39+
40+
- uses: actions-rs/cargo@v1
41+
with:
42+
command: test
43+
args: --all-features --no-fail-fast
44+
env:
45+
CARGO_INCREMENTAL: "0"
46+
RUSTFLAGS: "-Cinstrument-coverage"
47+
LLVM_PROFILE_FILE: "cargo-test-%p-%m.profraw"
48+
49+
- uses: actions-rs/cargo@v1
50+
with:
51+
command: test
52+
args: connector_e2e_ --all-features -- --ignored
53+
env:
54+
CARGO_INCREMENTAL: "0"
55+
RUSTFLAGS: "-Cinstrument-coverage"
56+
LLVM_PROFILE_FILE: "cargo-test-%p-%m.profraw"
57+
58+
- name: Get current date
59+
id: date
60+
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
61+
62+
- id: coverage
63+
run: |
64+
cargo install grcov
65+
grcov . --binary-path ./target/debug/deps/ -s . -t lcov --branch --ignore-not-existing --ignore '../*' --ignore "/*" --ignore 'target/*' --ignore 'dozer-tests/*' -o target/coverage.lcov
66+
echo "::set-output name=report::target/coverage.lcov"
67+
68+
- uses: actions/upload-artifact@v3
69+
with:
70+
name: coverage
71+
path: |
72+
${{ steps.coverage.outputs.report }}
73+
retention-days: 10
74+
75+
- id: coveralls
76+
name: Coveralls upload
77+
uses: coverallsapp/github-action@master
78+
with:
79+
github-token: ${{ secrets.GITHUB_TOKEN }}
80+
path-to-lcov: ${{ steps.coverage.outputs.report }}

.github/workflows/dozer.yaml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ env:
88
CARGO_TERM_COLOR: always
99

1010
concurrency:
11-
group: ${{ github.ref }}
11+
group: ci/${{ github.ref }}
1212
cancel-in-progress: true
1313

1414
jobs:
15-
test:
15+
lint:
1616
timeout-minutes: 60
1717
runs-on: ubuntu-latest
1818
steps:
@@ -33,11 +33,6 @@ jobs:
3333
with:
3434
repo-token: ${{ secrets.GITHUB_TOKEN }}
3535

36-
- name: MongoDB in GitHub Actions
37-
uses: supercharge/[email protected]
38-
39-
- uses: ./.github/workflows/setup-snowflake-and-kafka
40-
4136
- name: ⚡ Cache
4237
uses: actions/cache@v3
4338
with:
@@ -61,6 +56,3 @@ jobs:
6156
- name: Lint
6257
run: |
6358
cargo fmt -- --check
64-
65-
- name: Run tests
66-
run: cargo test --verbose --features mongodb

.github/workflows/nightly.yaml

Lines changed: 1 addition & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: Dozer Main
2-
# Long running tests, Performance benchmarks, Code vulnerability, Code coverage etc
2+
# Performance benchmarks, Code vulnerability etc
33
on:
44
push:
55
branches: [main]
@@ -9,88 +9,6 @@ concurrency:
99
cancel-in-progress: true
1010

1111
jobs:
12-
# Run coverage
13-
coverage:
14-
timeout-minutes: 60
15-
runs-on: ubuntu-latest
16-
steps:
17-
- uses: actions/checkout@v3
18-
- name: Install stable with llvm-tools-preview
19-
uses: actions-rs/toolchain@v1
20-
with:
21-
profile: minimal
22-
toolchain: stable
23-
components: llvm-tools-preview
24-
25-
- name: Install Protoc
26-
uses: arduino/setup-protoc@v1
27-
with:
28-
repo-token: ${{ secrets.GITHUB_TOKEN }}
29-
30-
- name: MongoDB in GitHub Actions
31-
uses: supercharge/[email protected]
32-
33-
- uses: ./.github/workflows/setup-snowflake-and-kafka
34-
35-
- uses: actions-rs/cargo@v1
36-
with:
37-
command: test
38-
args: --all-features --no-fail-fast
39-
env:
40-
CARGO_INCREMENTAL: "0"
41-
RUSTFLAGS: "-Cinstrument-coverage"
42-
LLVM_PROFILE_FILE: "cargo-test-%p-%m.profraw"
43-
44-
- uses: actions-rs/cargo@v1
45-
with:
46-
command: test
47-
args: connector_e2e_ --all-features -- --ignored
48-
env:
49-
CARGO_INCREMENTAL: "0"
50-
RUSTFLAGS: "-Cinstrument-coverage"
51-
LLVM_PROFILE_FILE: "cargo-test-%p-%m.profraw"
52-
53-
- name: Get current date
54-
id: date
55-
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
56-
57-
- id: coverage
58-
run: |
59-
cargo install grcov
60-
grcov . --binary-path ./target/debug/deps/ -s . -t lcov --branch --ignore-not-existing --ignore '../*' --ignore "/*" --ignore 'target/*' --ignore 'dozer-tests/*' -o target/coverage.lcov
61-
echo "::set-output name=report::target/coverage.lcov"
62-
63-
- uses: actions/upload-artifact@v3
64-
with:
65-
name: coverage
66-
path: |
67-
${{ steps.coverage.outputs.report }}
68-
retention-days: 10
69-
70-
- id: coveralls
71-
name: Coveralls upload
72-
uses: coverallsapp/github-action@master
73-
with:
74-
github-token: ${{ secrets.GITHUB_TOKEN }}
75-
path-to-lcov: ${{ steps.coverage.outputs.report }}
76-
77-
- name: Post to a Slack channel
78-
id: slack
79-
continue-on-error: true
80-
uses: slackapi/[email protected]
81-
with:
82-
channel-id: "release-notifications"
83-
slack-message: |
84-
```
85-
Coverage: ${{ job.status }}
86-
87-
Last Commit: ${{ github.event.head_commit.url }}
88-
89-
Response: ${{ steps.coveralls.outputs.coveralls-api-result }}
90-
```
91-
env:
92-
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
93-
9412
# Run benches
9513
bench:
9614
timeout-minutes: 60

0 commit comments

Comments
 (0)