forked from svartalf/rust-battery
-
-
Notifications
You must be signed in to change notification settings - Fork 8
138 lines (119 loc) · 3.84 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
on: [push, pull_request]
name: Continuous integration
env:
CARGO_INCREMENTAL: 0
CARGO_NET_RETRY: 10
RUST_BACKTRACE: short
RUSTUP_MAX_RETRIES: 10
CARGO: cargo
jobs:
test:
name: Test
strategy:
matrix:
toolchain:
- stable
- 1.69.0 # MSRV
target:
- i686-unknown-linux-gnu
- x86_64-unknown-linux-gnu
- x86_64-unknown-linux-musl
- i686-pc-windows-msvc
- x86_64-pc-windows-msvc
- x86_64-apple-darwin
include:
- target: i686-unknown-linux-gnu
os: ubuntu-latest
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
- target: i686-pc-windows-msvc
os: windows-latest
- target: x86_64-pc-windows-msvc
os: windows-latest
- target: x86_64-apple-darwin
os: macos-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/[email protected]
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
target: ${{ matrix.target }}
- uses: Swatinem/[email protected]
with:
key: ${{ matrix.target }}
- name: Setup | Install cross [Linux]
if: matrix.os == 'ubuntu-latest'
uses: taiki-e/install-action@cross
- name: Setup | Use cross [Linux]
if: matrix.os == 'ubuntu-latest'
run: echo "CARGO=cross" >> $GITHUB_ENV
- name: Build
run: ${{ env.CARGO }} build --target ${{ matrix.target }} --all-features --all-targets
- name: Run tests
run: ${{ env.CARGO }} test --target ${{ matrix.target }} --all-features --all-targets
- name: Run clippy
if: matrix.toolchain == 'stable'
run: ${{ env.CARGO }} clippy --target ${{ matrix.target }} -- -D clippy::all
build_only:
name: Test [Build only]
strategy:
matrix:
toolchain:
- stable
- 1.69.0 # MSRV
target:
- x86_64-unknown-freebsd
- x86_64-unknown-netbsd
- aarch64-unknown-linux-gnu
- aarch64-unknown-linux-musl
- aarch64-pc-windows-msvc
- aarch64-apple-darwin
include:
- target: x86_64-unknown-freebsd
os: ubuntu-latest
- target: x86_64-unknown-netbsd
os: ubuntu-latest
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
- target: aarch64-unknown-linux-musl
os: ubuntu-latest
- target: aarch64-pc-windows-msvc
os: windows-latest
- target: aarch64-apple-darwin
os: macos-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/[email protected]
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
target: ${{ matrix.target }}
- uses: Swatinem/[email protected]
with:
key: ${{ matrix.target }}
- name: Setup | Install cross [Linux]
if: matrix.os == 'ubuntu-latest'
uses: taiki-e/install-action@cross
- name: Setup | Use cross [Linux]
if: matrix.os == 'ubuntu-latest'
run: echo "CARGO=cross" >> $GITHUB_ENV
- name: Build
run: ${{ env.CARGO }} build --target ${{ matrix.target }} --all-features --all-targets
- name: Run clippy
if: matrix.toolchain == 'stable'
run: ${{ env.CARGO }} clippy --target ${{ matrix.target }} -- -D clippy::all
rustfmt:
name: Rustfmt [Formatter]
runs-on: ubuntu-latest
steps:
- name: Setup | Checkout
uses: actions/checkout@v4
- name: Setup | Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Build | Format
run: cargo fmt --all -- --check