-
Notifications
You must be signed in to change notification settings - Fork 41
138 lines (112 loc) · 3.5 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
name: CI
on:
push:
branches:
- main
tags:
- "v*"
pull_request:
branches:
- main
schedule:
- cron: "00 01 * * *"
# Stops the running workflow of previous pushes
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
env:
RUST_BACKTRACE: 1
RUSTUP_MAX_RETRIES: 10
CARGO_NET_RETRY: 10
jobs:
lints:
name: Rustfmt & Clippy lints
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# use nightly for rustfmt & clippy checks
- name: Install Rust nightly toolchain
uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt, clippy
- name: Rust format
run: cargo fmt --check
- name: Clippy lints
run: cargo clippy --no-deps -- -D warnings
test:
name: Test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
rust: ["1.70", stable, beta]
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rust-src
toolchain: ${{ matrix.rust }}
- name: Build
run: cargo build
- name: Test --no-default-features
run: cargo test --no-default-features
- name: Test feature serde
# this includes default features, `std` and `all-sentences`
run: cargo test -F serde
- name: Test feature defmt-03
# this includes default features, `std` and `all-sentences`
if: ${{ matrix.os != 'windows-latest' }}
run: cargo test -F defmt-03
- name: Test (Release)
run: cargo test --release --no-default-features
- name: Test (Release) feature serde
# this includes default features, `std` and `all-sentences`
run: cargo test --release -F serde
- name: Test (Release) feature defmt-03
if: ${{ matrix.os != 'windows-latest' }}
# this includes default features, `std` and `all-sentences`
run: cargo test --release -F defmt-03
bench:
name: Benches
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Run Benches
run: cargo bench -p benches-harness
# Detect cases where documentation links don't resolve and such.
doc:
name: Docs check
runs-on: ubuntu-latest
env:
RUSTDOCFLAGS: "-D warnings"
steps:
- uses: actions/checkout@v4
# Docs.rs uses nightly, which allows for easier syntax for linking to functions.
- uses: dtolnay/rust-toolchain@nightly
with:
components: rust-docs
- name: Docs --all-features
run: cargo doc --all-features --no-deps
- name: Docs --no-default-features
run: cargo doc --no-default-features --no-deps
codecov:
name: Generate code coverage
runs-on: ubuntu-latest
container:
image: xd009642/tarpaulin:develop-nightly
options: --security-opt seccomp=unconfined
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Generate code coverage
# this includes default features, `std` and `all-sentences`
run: cargo +nightly tarpaulin --features serde --verbose --workspace --timeout 120 --out xml
- name: Upload to codecov.io
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true