-
Notifications
You must be signed in to change notification settings - Fork 16
112 lines (98 loc) · 3.92 KB
/
test_suite.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
name: "Test Suite"
on:
push:
branches-ignore:
- 'dependabot/**' #avoid duplicates: only run the PR, not the push
- 'renovate/**' #avoid duplicates: only run the PR, not the push
- 'gh-pages' #github pages do not trigger all tests
tags-ignore:
- 'v*' #avoid rerun existing commit on release
pull_request:
branches:
- 'main'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
test:
if: (github.event_name != 'pull_request' && ! github.event.pull_request.head.repo.fork) || (github.event_name == 'pull_request' && (github.event.pull_request.head.repo.fork || startsWith(github.head_ref, 'dependabot/') || startsWith(github.head_ref, 'renovate/') || startsWith(github.head_ref, 'release-plz')))
name: cargo test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: nightly
components: llvm-tools-preview
- name: Install grcov
uses: taiki-e/install-action@v2
with:
tool: grcov
- name: Build
run: cargo build --all-targets
env:
RUSTFLAGS: "-Cinstrument-coverage"
- name: Start minio
run: ./ci/minio_start.sh
- name: Test
run: cargo test --all-features -- -Z unstable-options --format json --report-time | tee results.json
env:
LLVM_PROFILE_FILE: "target/coverage/prof/%p-%m.profraw"
RUSTFLAGS: "-Cinstrument-coverage"
- name: Stop minio
run: ./ci/minio_stop.sh
- name: Prepare junit report
id: cargo_reporter
uses: innoq/action-cargo-test-report@v1
with:
cargo-test-report-json: 'results.json'
- name: Publish Test Report
uses: mikepenz/action-junit-report@v4
if: always() # always run even if the previous step fails
with:
check_name: Test Report
fail_on_failure: true
require_tests: true
annotate_only: true
summary: ${{ steps.cargo_reporter.outputs.summary }}
- name: Create coverage report
run: |
grcov \
--source-dir . \
--binary-path target/debug \
--branch \
--excl-start 'mod tests \{' \
--ignore 'tests/*' \
-t lcov \
-o lcov.info \
target/coverage/prof
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
files: lcov.info
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}
# Check formatting with rustfmt
formatting:
if: (github.event_name != 'pull_request' && ! github.event.pull_request.head.repo.fork) || (github.event_name == 'pull_request' && (github.event.pull_request.head.repo.fork || startsWith(github.head_ref, 'dependabot/') || startsWith(github.head_ref, 'renovate/') || startsWith(github.head_ref, 'release-plz')))
name: cargo fmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Ensure rustfmt is installed and setup problem matcher
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: rustfmt
- name: Rustfmt Check
uses: actions-rust-lang/rustfmt@v1
lint:
if: (github.event_name != 'pull_request' && ! github.event.pull_request.head.repo.fork) || (github.event_name == 'pull_request' && (github.event.pull_request.head.repo.fork || startsWith(github.head_ref, 'dependabot/') || startsWith(github.head_ref, 'renovate/') || startsWith(github.head_ref, 'release-plz')))
name: cargo clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- run: cargo clippy --all-features --all-targets --workspace -- -D warnings