-
Notifications
You must be signed in to change notification settings - Fork 0
140 lines (115 loc) · 3.5 KB
/
Copy pathci.yml
File metadata and controls
140 lines (115 loc) · 3.5 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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
name: CI
on:
pull_request:
push:
branches:
- main
workflow_dispatch:
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
lint:
name: lint
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Rust toolchain
uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 # v1
with:
toolchain: stable
components: rustfmt, clippy
- name: Rust cache
uses: ./.github/actions/setup-rust-cache
with:
cache-key-suffix: lint
toolchain: stable
- name: rustfmt
run: cargo fmt --check -- --config-path .config/rustfmt.toml
- name: clippy
run: cargo clippy --all-targets --all-features -- -D warnings
test:
name: test
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Rust toolchain
uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 # v1
with:
toolchain: stable
- name: Rust cache
uses: ./.github/actions/setup-rust-cache
with:
cache-key-suffix: test
toolchain: stable
- name: Install nextest
uses: ./.github/actions/setup-cargo-tools
with:
binstall-tools: cargo-nextest
- name: nextest
run: cargo nextest run --profile ci
- name: doctests
run: cargo test --doc
deny:
name: cargo-deny
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Check dependencies
uses: EmbarkStudios/cargo-deny-action@3fd3802e88374d3fe9159b834c7714ec57d6c979 # v2.0.15
with:
command: check
command-arguments: --config .config/deny.toml
msrv:
name: msrv
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Read MSRV
id: msrv
shell: bash
run: |
set -euo pipefail
if [ ! -f Cargo.toml ]; then
echo "found=false" >>"$GITHUB_OUTPUT"
exit 0
fi
msrv="$(awk -F= '
/^[[:space:]]*rust-version[[:space:]]*=/ {
v=$2
gsub(/^[[:space:]]+|[[:space:]]+$/, "", v)
gsub(/"/, "", v)
print v
exit
}
' Cargo.toml || true)"
if [ -z "${msrv}" ]; then
echo "found=false" >>"$GITHUB_OUTPUT"
exit 0
fi
echo "found=true" >>"$GITHUB_OUTPUT"
echo "msrv=${msrv}" >>"$GITHUB_OUTPUT"
- name: Rust toolchain (MSRV)
if: steps.msrv.outputs.found == 'true'
uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 # v1
with:
toolchain: ${{ steps.msrv.outputs.msrv }}
- name: Rust cache
if: steps.msrv.outputs.found == 'true'
uses: ./.github/actions/setup-rust-cache
with:
cache-key-suffix: msrv
toolchain: ${{ steps.msrv.outputs.msrv }}
- name: cargo check (MSRV)
if: steps.msrv.outputs.found == 'true'
run: cargo check --all-targets --all-features