This repository was archived by the owner on Mar 24, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
118 lines (97 loc) · 2.73 KB
/
push-rust.yml
File metadata and controls
118 lines (97 loc) · 2.73 KB
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
113
114
115
116
117
118
---
name: Rust
"on":
push:
paths:
- "**.rs"
- "**.toml"
env:
CARGO_INCREMENTAL: 0
CARGO_PROFILE_TEST_DEBUG: 0
jobs:
lint:
name: Lint code
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: clippy
- name: Cache build artifacts
uses: swatinem/rust-cache@v2.2.1
- name: Run Clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-targets --all-features -- -D warnings
style:
name: Check style
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt
- name: Run Rustfmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
test:
name: Run tests
runs-on: ubuntu-latest
outputs:
collect_coverage: ${{ steps.coverage.outputs.enable }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Cache build artifacts
uses: swatinem/rust-cache@v2.2.1
- name: Determine whether to measure test coverage
id: coverage
run: |
if [[ "${{ secrets.CODECOV_TOKEN }}" != "" ]]; then
echo "Enable collection of test coverage"
echo "::set-output name=enable::true"
else
echo "Run tests without coverage"
echo "::set-output name=enable::false"
fi
- name: Run tests
uses: actions-rs/cargo@v1
if: ${{ steps.coverage.outputs.enable != 'true' }}
with:
command: test
args: --verbose
- name: Run tests with test coverage
uses: actions-rs/tarpaulin@master
if: ${{ steps.coverage.outputs.enable == 'true' }}
with:
args: --skip-clean
version: 0.20.0
- name: Upload to codecov.io
uses: codecov/codecov-action@v3
if: ${{ steps.coverage.outputs.enable == 'true' }}
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Archive code coverage results
uses: actions/upload-artifact@v3
if: ${{ steps.coverage.outputs.enable == 'true' }}
with:
name: code-coverage-report
path: cobertura.xml