-
Notifications
You must be signed in to change notification settings - Fork 108
180 lines (169 loc) · 5.34 KB
/
rust.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: Rust
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
strategy:
matrix:
os: ['ubuntu-latest']
rust_channel: ['stable', 'beta', 'nightly', '1.64.0']
include:
- rust_channel: stable
os: macOS-latest
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v3
- name: Install rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{matrix.rust_channel}}
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
- name: Run dwarfdump (macos)
if: matrix.os == 'macOS-latest'
run: |
cargo run --bin dwarfdump -- \
$(find ./target/debug -type f | grep DWARF | grep gimli | head -n 1) \
> /dev/null
- name: Run dwarfdump (linux)
if: matrix.os == 'ubuntu-latest'
run: |
cargo run --bin dwarfdump -- \
$(find ./target/debug -type f -perm -100 | grep gimli | head -n 1) \
> /dev/null
msrv-read:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install rust
uses: dtolnay/rust-toolchain@1.60.0
- name: Build
run: cargo build --verbose --no-default-features --features read-all
- name: Test
run: cargo test --verbose --no-default-features --features read-all
build_fuzz_targets:
name: Build fuzz targets
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install rust nightly
uses: dtolnay/rust-toolchain@nightly
- name: Install `cargo fuzz`
run: cargo install cargo-fuzz --vers '^0.11.0'
- run: cargo fuzz build -Oa
- uses: actions/upload-artifact@v3
with:
name: fuzz-targets
path: fuzz/target/x86_64-unknown-linux-gnu/release/debug_*
- uses: actions/upload-artifact@v3
with:
name: fuzz-targets
path: fuzz/target/x86_64-unknown-linux-gnu/release/eh_*
run_fuzz_targets:
strategy:
matrix:
fuzz_target: ['debug_abbrev', 'debug_aranges', 'debug_info', 'debug_line', 'eh_frame', 'eh_frame_hdr']
name: Run `${{matrix.fuzz_target}}` fuzz target
needs: build_fuzz_targets
runs-on: ubuntu-latest
steps:
- name: Clone the fuzz corpora
uses: actions/checkout@v3
with:
repository: gimli-rs/gimli-libfuzzer-corpora
path: corpora
- name: Download fuzz targets
uses: actions/download-artifact@v1
with:
name: fuzz-targets
# Note: -max_total_time=300 == 300 seconds == 5 minutes.
- name: Run `${{matrix.fuzz_target}}` fuzz target
run: |
mkdir ${{matrix.fuzz_target}}_artifacts
chmod +x ./fuzz-targets/${{matrix.fuzz_target}}
./fuzz-targets/${{matrix.fuzz_target}} ./corpora/${{matrix.fuzz_target}} \
-max_total_time=300 \
-artifact_prefix=./${{matrix.fuzz_target}}_artifacts/
# If fuzzing finds a new crash/panic/etc, upload the input artifacts so we
# can debug them.
- name: Upload fuzz artifacts
if: failure()
uses: actions/upload-artifact@v3
with:
name: ${{matrix.fuzz_target}}_artifacts
path: ./${{matrix.fuzz_target}}_artifacts
features:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install rust stable
uses: dtolnay/rust-toolchain@stable
- uses: taiki-e/install-action@v2
with:
tool: cargo-hack
# Ensure gimli can be built without alloc.
- run: cargo check --no-default-features --features read-core
- run: cargo hack test --feature-powerset --exclude-features rustc-dep-of-std,read-core
bench:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install rust nightly
uses: dtolnay/rust-toolchain@nightly
- run: cargo bench
cross:
strategy:
matrix:
target:
# A 32-bit target.
- i686-unknown-linux-gnu
# A big-endian target
- mips64-unknown-linux-gnuabi64
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install rust stable
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{matrix.target}}
- uses: taiki-e/install-action@v2
with:
tool: cross
- run: cross test --target ${{matrix.target}}
rustfmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install rust stable
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- run: cargo fmt --all -- --check
coverage:
runs-on: ubuntu-latest
container:
image: xd009642/tarpaulin
options: --security-opt seccomp=unconfined
steps:
- uses: actions/checkout@v3
- name: Install rust stable
uses: dtolnay/rust-toolchain@stable
- name: Run cargo-tarpaulin
run: cargo tarpaulin --ignore-tests --out Lcov
- name: Upload to Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ./lcov.info
doc:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install rust stable
uses: dtolnay/rust-toolchain@stable
- run: cargo doc