forked from FactbirdHQ/atat
-
Notifications
You must be signed in to change notification settings - Fork 0
220 lines (197 loc) · 5.82 KB
/
ci.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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
name: CI
on:
push:
branches:
- master
pull_request:
env:
CLIPPY_PARAMS: -W clippy::all -W clippy::pedantic -W clippy::nursery -W clippy::cargo
jobs:
cancel_previous_runs:
name: Cancel previous runs
runs-on: ubuntu-latest
steps:
- uses: styfle/cancel-workflow-action@0.4.1
with:
access_token: ${{ secrets.GITHUB_TOKEN }}
rustfmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
components: rustfmt
- name: Run rustfmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check --verbose
# tomlfmt:
# name: tomlfmt
# runs-on: ubuntu-latest
# steps:
# - name: Checkout source code
# uses: actions/checkout@v2
# - name: Install Rust
# uses: actions-rs/toolchain@v1
# with:
# profile: minimal
# toolchain: nightly
# override: true
# - name: Install tomlfmt
# uses: actions-rs/install@v0.1
# with:
# crate: cargo-tomlfmt
# version: latest
# use-tool-cache: true
# - name: Run Tomlfmt
# uses: actions-rs/cargo@v1
# with:
# command: tomlfmt
# args: --dryrun
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: clippy
- name: Run clippy
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: -- ${{ env.CLIPPY_PARAMS }}
build:
name: Build
runs-on: ubuntu-latest
strategy:
matrix:
target: ["x86_64-unknown-linux-gnu", "thumbv7em-none-eabihf"]
features:
[
"",
"derive",
"derive, log",
"derive, defmt",
]
include:
- target: "x86_64-unknown-linux-gnu"
features: "derive"
std: ", std"
- target: "x86_64-unknown-linux-gnu"
features: "derive, log"
std: ", std"
- target: "x86_64-unknown-linux-gnu"
features: "derive, defmt"
std: ", std"
- target: "thumbv7em-none-eabihf"
examples: "--examples"
steps:
- name: Checkout source code
uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: thumbv7em-none-eabihf
override: true
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --all --target '${{ matrix.target }}' --features '${{ matrix.features }}${{ matrix.std }}' ${{ matrix.examples }}
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: thumbv7em-none-eabihf
override: true
- name: Library tests
uses: actions-rs/cargo@v1
with:
command: test
args: --all
grcov:
name: Coverage
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
target: thumbv7em-none-eabihf
override: true
- name: Install grcov
uses: actions-rs/cargo@v1
# uses: actions-rs/install@v0.1
with:
# crate: grcov
# version: latest
# use-tool-cache: true
command: install
args: --locked grcov --git https://github.com/mozilla/grcov
- name: Test
uses: actions-rs/cargo@v1
with:
command: test
args: --lib --no-fail-fast
env:
CARGO_INCREMENTAL: "0"
RUSTFLAGS: "-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=unwind -Zpanic_abort_tests"
RUSTDOCFLAGS: "-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=unwind -Zpanic_abort_tests"
- name: Generate coverage data
id: grcov
# uses: actions-rs/grcov@v0.1
run: |
grcov target/debug/ \
--branch \
--llvm \
--source-dir . \
--output-file lcov.info \
--ignore='/**' \
--ignore='C:/**' \
--ignore='../**' \
--ignore-not-existing \
--excl-line "#\\[derive\\(" \
--excl-br-line "(#\\[derive\\()|(debug_assert)" \
--excl-start "#\\[cfg\\(test\\)\\]" \
--excl-br-start "#\\[cfg\\(test\\)\\]" \
--commit-sha ${{ github.sha }} \
--service-job-id ${{ github.job }} \
--service-name "GitHub Actions" \
--service-number ${{ github.run_id }}
- name: Upload coverage as artifact
uses: actions/upload-artifact@v2
with:
name: lcov.info
# path: ${{ steps.grcov.outputs.report }}
path: lcov.info
- name: Upload coverage to codecov.io
uses: codecov/codecov-action@v1
with:
# file: ${{ steps.grcov.outputs.report }}
file: lcov.info
fail_ci_if_error: false