This repository has been archived by the owner on Jun 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 23
172 lines (133 loc) · 3.82 KB
/
rust-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
name: Rust CI
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
on:
workflow_dispatch:
pull_request:
paths:
- 'packages/rust-core/**'
- '.github/workflows/rust-ci.yml'
push:
branches: [main]
paths:
- 'packages/rust-core/**'
- '.github/workflows/rust-ci.yml'
env:
RUST_BACKTRACE: full
CARGO_PROFILE_RELEASE_BUILD_OVERRIDE_DEBUG: true
CARGO_TERM_COLOR: always
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
RUST_LOG: debug
defaults:
run:
working-directory: packages/rust-core
jobs:
security-audit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install cargo-audit
run: cargo install cargo-audit
- name: Audit dependencies
run: cargo audit
udeps:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
- uses: taiki-e/install-action@v2
with:
tool: cargo-udeps
- name: udeps
run: cargo +nightly udeps
lint:
name: rust-ci-lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: fmt
run: cargo fmt --check
- name: lint
run: cargo check --all-targets --all-features
- name: Clippy
run: cargo clippy --all-targets --all-features -- -D warnings
deny:
name: rust-ci-deny
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: taiki-e/install-action@v2
with:
tool: cargo-deny
- run: cargo deny check
windows-test:
name: rust-ci-test-windows
runs-on: windows-latest
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-pc-windows-msvc
steps:
- uses: actions/checkout@v4
- name: Setup Choco and perl
uses: crazy-max/ghaction-chocolatey@v3
with:
args: install -y strawberryperl
- uses: dtolnay/rust-toolchain@stable
with:
target: ${{ matrix.target }}
- name: Install cross-compilation tools
uses: taiki-e/setup-cross-toolchain-action@v1
with:
target: ${{ matrix.target }}
- name: Build
run: cargo build --profile=test
# - name: Test
# run: cargo test --verbose -- --nocapture
test:
name: rust-ci-test
runs-on: ${{ matrix.os }}
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
test: true
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
- os: ubuntu-latest
target: aarch64-unknown-linux-musl
- os: macos-latest
target: x86_64-apple-darwin
test: true
- os: macos-latest
target: aarch64-apple-darwin
- os: ubuntu-latest
target: x86_64-pc-windows-gnu
command: sudo apt-get install -y gcc-mingw-w64-x86-64-win32 && cargo install cargo-xwin
steps:
- uses: actions/checkout@v4
- name: Run command ${{ matrix.command }}
if: ${{ matrix.command }}
run: ${{ matrix.command }}
- uses: dtolnay/rust-toolchain@stable
with:
target: ${{ matrix.target }}
- name: Install cross-compilation tools
uses: taiki-e/setup-cross-toolchain-action@v1
with:
target: ${{ matrix.target }}
- name: Build
run: cargo build --profile=test
- name: Test
if: ${{ matrix.test }}
run: cargo test --verbose -- --nocapture