-
Notifications
You must be signed in to change notification settings - Fork 1
223 lines (191 loc) · 5.96 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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
name: ci
on:
push:
branches:
- "master"
- "**_ci"
pull_request:
schedule:
- cron: "0 1 * * 0"
env:
CARGO_TERM_COLOR: always
MIRIFLAGS: -Zmiri-disable-isolation
RUST_BACKTRACE: full
jobs:
ci:
runs-on: ${{ matrix.runs_on }}
strategy:
matrix:
rust:
- stable
- beta
- 1.73.0 # MSRV
runs_on:
- ubuntu-latest
- windows-latest
- macos-latest
feature:
- net-std
- net-async-std
- net-tokio
- net-smol
- all
- ""
include:
- runs_on: ubuntu-latest
feature: net-tokio,socket2
rust: stable
- runs_on: ubuntu-latest
feature: net-tokio,socket2
rust: beta
- runs_on: ubuntu-latest
feature: net-tokio,socket2
rust: 1.73.0 # MSRV
env:
RUSTFLAGS: --deny warnings
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@v1
with:
toolchain: ${{ matrix.rust }}
components: rustfmt,clippy
- name: build rsdns
if: ${{ matrix.feature != 'all' && matrix.feature != '' }}
run: cargo build --no-default-features --features ${{ matrix.feature }}
- name: build all rsdns
if: ${{ matrix.feature == 'all' }}
run: cargo build --all-features
- name: build no-default-features rsdns
if: ${{ matrix.feature == '' }}
run: cargo build --no-default-features
- name: test rsdns
if: ${{ matrix.feature != 'all' && matrix.feature != '' }}
run: cargo test --no-default-features --features ${{ matrix.feature }}
- name: test all rsdns
if: ${{ matrix.feature == 'all' }}
run: cargo test --all-features
- name: test no-default-features rsdns
if: ${{ matrix.feature == '' }}
run: cargo test --no-default-features
- name: lint rsdns
if: ${{ matrix.feature != 'all' && matrix.feature != '' }}
run: cargo clippy --no-default-features --features ${{ matrix.feature }} --all-targets
- name: lint all rsdns
if: ${{ matrix.feature == 'all' }}
run: cargo clippy --all-features --all-targets
- name: lint no-default-features rsdns
if: ${{ matrix.feature == '' }}
run: cargo clippy --no-default-features --all-targets
common-ci:
runs-on: ubuntu-latest
env:
RUSTFLAGS: --deny warnings
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@v1
with:
toolchain: nightly
components: rustfmt
- name: format all
run: cargo fmt -- --check
- name: doc rsdns
env:
RUSTDOCFLAGS: "--cfg docsrs"
run: cargo doc --all-features --no-deps
no-rustfmt:
runs-on: ubuntu-latest
env:
RUSTFLAGS: --deny warnings
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@v1
with:
toolchain: stable
- name: remove rustfmt
run: |
if which rustfmt; then
rm $(which rustfmt)
echo "remove-rustfmt: OK"
fi
if which rustfmt; then
echo "remove-rustfmt: VERIFY ERR"
exit 1
fi
shell: bash
- name: build with minimal toolchain
run: cargo build --all-features
- name: test with minimal toolchain
run: cargo build --all-features
- name: check with minimal toolchain
run: cargo check --all-features
fuzz:
runs-on: ubuntu-latest
steps:
- name: install llvm-18
run: sudo apt install -y llvm-18
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.x"
- uses: jannekem/run-python-script-action@v1
with:
script: |
lines = []
with open("fuzz/Cargo.toml", "r") as cargo:
lines = cargo.readlines()
for i in range(len(lines)):
if lines[i] == '# path = ".."\n':
lines[i] = 'path = ".."\n'
print('rsdns path set to ".."')
with open("fuzz/Cargo.toml", "w") as cargo:
cargo.write(''.join(lines))
print('Cargo.toml updated succcessfully')
- uses: dtolnay/rust-toolchain@v1
with:
toolchain: nightly
components: llvm-tools-preview,rust-src
- name: install cargo-fuzz
run: cargo install cargo-fuzz
- name: fuzz rrset_from_msg
run: cargo fuzz run rrset_from_msg -- -max_total_time=5 -verbosity=0
miri:
if: false # disabled until miri RAM consumption is fixed
runs-on: ${{ matrix.runs_on }}
strategy:
matrix:
runs_on:
- ubuntu-latest
feature:
- all
- ""
- default
- net-std
- net-async-std
- net-tokio
- net-tokio,socket2
- net-smol
steps:
- name: Set Swap Space
uses: pierotofy/set-swap-space@master
with:
swap-size-gb: 10
- id: find_miri
run: |
MIRI_NIGHTLY=nightly-$(curl -s https://rust-lang.github.io/rustup-components-history/x86_64-unknown-linux-gnu/miri)
echo "Found miri at: $MIRI_NIGHTLY"
echo "miri=$MIRI_NIGHTLY" >> $GITHUB_OUTPUT
shell: bash
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@v1
with:
toolchain: ${{ steps.find_miri.outputs.miri }}
components: miri,rust-src,rustfmt
- name: miri
if: ${{ matrix.feature != 'all' && matrix.feature != '' }}
run: cargo miri test --no-default-features --features ${{ matrix.feature }}
- name: miri all
if: ${{ matrix.feature == 'all' }}
run: cargo miri test --all-features
- name: miri no-default-features
if: ${{ matrix.feature == '' }}
run: cargo miri test --no-default-features