-
-
Notifications
You must be signed in to change notification settings - Fork 6
200 lines (172 loc) · 5.87 KB
/
y-octo.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
name: Lint & Test & Fuzzing & Miri & Loom
on:
workflow_dispatch:
push:
branches: [main]
pull_request:
branches: [main]
env:
nightly: nightly-2023-08-19
# Cancels all previous workflow runs for pull requests that have not completed.
# See https://docs.github.com/en/actions/using-jobs/using-concurrency
concurrency:
# The concurrency group contains the workflow name and the branch name for
# pull requests or the commit hash for any other events.
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
cancel-in-progress: true
jobs:
lint:
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Rust
uses: ./.github/actions/setup-rust
with:
toolchain: nightly
components: clippy, rustfmt
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 18
cache: "yarn"
- name: Install Node.js dependencies
run: yarn install
- name: Install required cargo components
uses: taiki-e/install-action@v2
with:
tool: clippy-sarif,sarif-fmt
- name: Build & Check
run: |
cargo +nightly clippy --all-features --message-format=json -- -D warnings | clippy-sarif | tee rust-clippy-results.sarif | sarif-fmt
RUSTDOCFLAGS="-D rustdoc::broken-intra-doc-links" cargo doc --workspace --all-features --no-deps
env:
CARGO_TERM_COLOR: always
- name: Format check
run: |
yarn prettier --check .
yarn taplo fmt --check .
cargo +nightly fmt --all --check
- name: Upload analysis results to GitHub
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: rust-clippy-results.sarif
wait-for-processing: true
test:
name: test & collect coverage
runs-on: ubuntu-latest
continue-on-error: true
env:
RUSTFLAGS: -D warnings
CARGO_TERM_COLOR: always
steps:
- uses: actions/checkout@v3
- name: Setup Rust
uses: ./.github/actions/setup-rust
with:
components: llvm-tools-preview
- name: Install latest nextest release
uses: taiki-e/install-action@nextest
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Collect coverage data
run: cargo llvm-cov nextest --all-targets --lcov --output-path lcov.info
- name: Upload coverage data to codecov
uses: codecov/codecov-action@v3
with:
name: tests
files: lcov.info
loom:
name: loom thread test
runs-on: ubuntu-latest
continue-on-error: true
env:
RUSTFLAGS: --cfg loom
RUST_BACKTRACE: full
CARGO_TERM_COLOR: always
steps:
- uses: actions/checkout@v3
- name: Setup Rust
uses: ./.github/actions/setup-rust
- name: Install latest nextest release
uses: taiki-e/install-action@nextest
- name: Loom Thread Test
run: |
cargo nextest run -p y-octo --lib
fuzzing:
name: fuzzing
runs-on: ubuntu-latest
continue-on-error: true
env:
RUSTFLAGS: -D warnings
CARGO_TERM_COLOR: always
steps:
- uses: actions/checkout@v3
- name: Setup Rust
uses: ./.github/actions/setup-rust
with:
toolchain: ${{ env.nightly }}
- name: fuzzing
working-directory: ./y-octo-utils
run: |
cargo install cargo-fuzz
cargo +${{ env.nightly }} fuzz run apply_update -- -max_total_time=30
cargo +${{ env.nightly }} fuzz run codec_doc_any_struct -- -max_total_time=30
cargo +${{ env.nightly }} fuzz run codec_doc_any -- -max_total_time=30
cargo +${{ env.nightly }} fuzz run decode_bytes -- -max_total_time=30
cargo +${{ env.nightly }} fuzz run i32_decode -- -max_total_time=30
cargo +${{ env.nightly }} fuzz run i32_encode -- -max_total_time=30
cargo +${{ env.nightly }} fuzz run ins_del_text -- -max_total_time=30
cargo +${{ env.nightly }} fuzz run sync_message -- -max_total_time=30
cargo +${{ env.nightly }} fuzz run u64_decode -- -max_total_time=30
cargo +${{ env.nightly }} fuzz run u64_encode -- -max_total_time=30
cargo +${{ env.nightly }} fuzz run apply_update -- -max_total_time=30
- name: upload fuzz artifacts
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: fuzz-artifact
path: ./y-octo-utils/fuzz/artifacts/**/*
miri:
name: miri code check
runs-on: ubuntu-latest
continue-on-error: true
env:
RUST_BACKTRACE: full
CARGO_TERM_COLOR: always
MIRIFLAGS: -Zmiri-backtrace=full -Zmiri-tree-borrows
steps:
- uses: actions/checkout@v3
- name: Setup Rust
uses: ./.github/actions/setup-rust
with:
toolchain: ${{ env.nightly }}
components: miri
- name: Install latest nextest release
uses: taiki-e/install-action@nextest
- name: Miri Code Check
run: |
cargo +${{ env.nightly }} miri nextest run -p y-octo -j2
asan:
name: Address sanitizer
runs-on: ubuntu-latest
continue-on-error: true
env:
RUSTFLAGS: -D warnings -Zsanitizer=address
ASAN_OPTIONS: detect_leaks=1
CARGO_TERM_COLOR: always
steps:
- uses: actions/checkout@v3
- name: Setup Rust
uses: ./.github/actions/setup-rust
with:
toolchain: ${{ env.nightly }}
- name: Memory Check
run: |
rustup component add rust-src --toolchain ${{ env.nightly }}
cargo +${{ env.nightly }} test -Zbuild-std --target x86_64-unknown-linux-gnu -p y-octo --lib