-
-
Notifications
You must be signed in to change notification settings - Fork 13
180 lines (149 loc) · 5.19 KB
/
build_and_test.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
name: Build & Test
on:
push:
branches: [ main ]
paths:
- "**.rs"
- "**.toml"
- ".github/workflows/**"
pull_request:
branches: [ main ]
paths:
- "**.rs"
- "**.toml"
- ".github/workflows/**"
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
check:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- uses: taiki-e/install-action@v2
with:
tool: cargo-hack
- name: Check
# TODO: We exclude the tokio demos for now to bypass a "none of the selected packages contains these features" error.
run: |
cargo hack check \
--workspace \
--exclude tokio-client --exclude tokio-server --exclude tokio-support \
--feature-powerset \
--group-features starttls,ext_condstore_qresync,ext_login_referrals,ext_mailbox_referrals \
--exclude-features ext,split
test:
strategy:
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup | Install toolchain
run: |
rustup toolchain install stable --profile minimal
rustup toolchain install nightly --profile minimal
- name: Setup | Install cargo-fuzz
run: |
cargo install cargo-fuzz
- name: Setup | Cache dependencies
uses: Swatinem/[email protected]
id: cache
with:
cache-all-crates: true
- name: Test | Everything w/o fuzzing (macOS, Ubuntu)
if: matrix.os != 'windows-latest'
run: |
for build_mode in "" "--release";
do
for feature_mode in "" "--all-features";
do
echo "# Testing" ${build_mode} ${feature_mode}
cargo test --workspace ${build_mode} ${feature_mode} --doc
cargo test --workspace ${build_mode} ${feature_mode} --all-targets --exclude imap-codec-fuzz --exclude imap-types-fuzz
done
done
- name: Test | Everything w/o fuzzing (Windows)
if: matrix.os == 'windows-latest'
run: |
$build_modes = @('','--release')
$feature_modes = @('','--all-features')
foreach ($build_mode in $build_modes) {
foreach ($feature_mode in $feature_modes) {
echo "# Testing" ${build_mode} ${feature_mode}
cargo test --workspace ${build_mode} ${feature_mode} --doc
cargo test --workspace ${build_mode} ${feature_mode} --all-targets --exclude imap-codec-fuzz --exclude imap-types-fuzz
}
}
- name: Test | Limited fuzzing (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
cd imap-codec
for fuzz_target in $(cargo +nightly fuzz list);
do
echo "# Fuzzing ${fuzz_target}";
cargo +nightly fuzz run --features=ext ${fuzz_target} -- -dict=fuzz/terminals.dict -max_len=256 -only_ascii=1 -runs=25000
done
minimal-versions:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup | Install toolchain
run: |
# 1.65 is the Minimum Supported Rust Version (MSRV) for imap-codec.
rustup toolchain install 1.65 --profile minimal
rustup toolchain install nightly --profile minimal
- name: Setup | Cache dependencies
uses: Swatinem/[email protected]
id: cache
with:
cache-all-crates: true
- name: Check
run: |
cargo +nightly update -Z minimal-versions
cargo +1.65 check --workspace --all-targets --all-features --exclude tokio-server
cargo +1.65 test --workspace --all-targets --all-features --exclude tokio-server --exclude imap-codec-fuzz --exclude imap-types-fuzz
env:
RUSTFLAGS: -Dwarnings
audit:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Audit dependencies
uses: EmbarkStudios/cargo-deny-action@7257a18a9c2fe3f92b85d41ae473520dff953c97
clippy:
runs-on: ubuntu-latest
steps:
- name: Install toolchain
uses: actions-rs/toolchain@88dc2356392166efad76775c878094f4e83ff746
with:
profile: minimal
toolchain: stable
override: true
components: clippy
- name: Checkout code
uses: actions/checkout@v3
- name: Check for common mistakes and missed improvements
uses: actions-rs/clippy-check@b5b5f21f4797c02da247df37026fcd0a5024aa4d
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features
formatting:
runs-on: ubuntu-latest
steps:
- name: Install nightly toolchain
uses: actions-rs/toolchain@88dc2356392166efad76775c878094f4e83ff746
with:
profile: minimal
toolchain: nightly
override: true
components: rustfmt
- name: Checkout code
uses: actions/checkout@v3
- name: Check code formatting
run: cargo +nightly fmt --check