-
Notifications
You must be signed in to change notification settings - Fork 1
167 lines (143 loc) · 5.19 KB
/
ci.yaml
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
name: CI
on:
pull_request:
push:
branches:
- main
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: -D warnings
# RUSTDOCFLAGS: -D warnings
jobs:
check:
name: Check
timeout-minutes: 2
permissions:
# required for ppremk/lfs-warning
pull-requests: read
# required for LouisBrunner/checks-action
checks: write
contents: read
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
with:
cache-all-crates: true
cache-on-failure: true
- uses: dtolnay/rust-toolchain@stable
- uses: taiki-e/install-action@v2
with:
tool: typos,cargo-deny
- name: Check spelling
if: success() || failure()
id: typos
run: typos
- name: Check dependencies
if: success() || failure()
id: cargo-deny
run: cargo deny check
- name: Check formatting
if: success() || failure()
id: cargo-fmt
run: cargo fmt --all -- --check
- name: Check file size
if: (success() || failure()) && github.event_name == 'pull_request'
id: lfs
uses: mahor1221/lfs-warning@master
with:
filesizelimit: 256000
sendComment: false
# create check runs for pull requests
- uses: LouisBrunner/checks-action@v2.0.0
if: (success() || failure()) && github.event_name == 'pull_request'
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: Check file size
conclusion: ${{ steps.lfs.outcome }}
- uses: LouisBrunner/checks-action@v2.0.0
if: (success() || failure()) && github.event_name == 'pull_request'
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: Check spelling
conclusion: ${{ steps.typos.outcome }}
- uses: LouisBrunner/checks-action@v2.0.0
if: (success() || failure()) && github.event_name == 'pull_request'
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: Check dependencies
conclusion: ${{ steps.cargo-deny.outcome }}
- uses: LouisBrunner/checks-action@v2.0.0
if: (success() || failure()) && github.event_name == 'pull_request'
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: Check formatting
conclusion: ${{ steps.cargo-fmt.outcome }}
check-target:
name: Check target
timeout-minutes: 5
strategy:
fail-fast: false
matrix:
include:
- { os: ubuntu-latest, target: aarch64-unknown-linux-gnu, cmd: cross }
- { os: ubuntu-latest, target: aarch64-unknown-linux-musl, cmd: cross }
- { os: ubuntu-latest, target: x86_64-unknown-linux-gnu, cmd: cargo }
- { os: ubuntu-latest, target: x86_64-unknown-linux-musl, cmd: cargo }
# - { os: windows-latest, target: aarch64-pc-windows-msvc, cmd: cross }
# - { os: windows-latest, target: x86_64-pc-windows-msvc, cmd: cargo }
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
with:
cache-all-crates: true
cache-on-failure: true
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- if: matrix.cmd == 'cross'
uses: taiki-e/install-action@v2
with:
tool: cross
- name: Check build
if: success() || failure()
id: cargo-check
run: ${{ matrix.cmd }} check --profile=ci --locked --target ${{ matrix.target }}
- name: Check lints
if: success() || failure()
id: cargo-clippy
run: ${{ matrix.cmd }} clippy --profile=ci --locked --target ${{ matrix.target }}
- name: Check tests
if: success()
id: cargo-test
run: ${{ matrix.cmd }} test --profile=ci --locked --target ${{ matrix.target }}
- name: Check documents
if: success()
id: cargo-doc
run: ${{ matrix.cmd }} doc --profile=ci --locked --target ${{ matrix.target }} --no-deps
# create check runs for pull requests
- uses: LouisBrunner/checks-action@v2.0.0
if: (success() || failure()) && github.event_name == 'pull_request'
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: Check build ${{ matrix.target }}
conclusion: ${{ steps.cargo-check.outcome }}
- uses: LouisBrunner/checks-action@v2.0.0
if: (success() || failure()) && github.event_name == 'pull_request'
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: Check lints ${{ matrix.target }}
conclusion: ${{ steps.cargo-clippy.outcome }}
- uses: LouisBrunner/checks-action@v2.0.0
if: (success() || failure()) && github.event_name == 'pull_request'
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: Check tests ${{ matrix.target }}
conclusion: ${{ steps.cargo-test.outcome }}
- uses: LouisBrunner/checks-action@v2.0.0
if: (success() || failure()) && github.event_name == 'pull_request'
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: Check documents ${{ matrix.target }}
conclusion: ${{ steps.cargo-doc.outcome }}