-
Notifications
You must be signed in to change notification settings - Fork 99
186 lines (176 loc) · 6.09 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
181
182
183
184
185
186
name: Rust
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
strategy:
matrix:
os: ["ubuntu-latest"]
rust_channel: ["stable", "beta", "nightly", "1.42.0"]
include:
- rust_channel: "stable"
os: "macOS-latest"
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v2
- name: Install rustup
run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile=minimal
- name: Install rust channel
run: |
rustup install ${{matrix.rust_channel}}
rustup default ${{matrix.rust_channel}}
- name: MSRV dependencies
if: matrix.rust_channel == '1.42.0'
run: |
cargo update -p indexmap --precise 1.6.2
cargo update -p once_cell --precise 1.14.0
- 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 --example 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 --example dwarfdump -- \
$(find ./target/debug -type f -perm -100 | grep gimli | head -n 1) \
> /dev/null
build_fuzz_targets:
name: Build fuzz targets
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install rustup
run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile=minimal
- name: Install nightly rust
run: |
rustup install nightly
rustup default nightly
- name: Install `cargo fuzz`
run: cargo install cargo-fuzz --vers "^0.11.0"
- run: cargo fuzz build -Oa
- uses: actions/upload-artifact@v2
with:
name: fuzz-targets
path: fuzz/target/x86_64-unknown-linux-gnu/release/debug_*
- uses: actions/upload-artifact@v2
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@v2
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@v2
with:
name: ${{matrix.fuzz_target}}_artifacts
path: ./${{matrix.fuzz_target}}_artifacts
features:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: cargo test --no-default-features
# Ensure gimli can be built without alloc.
- run: cargo check --no-default-features --features read-core
- run: cargo test --no-default-features --features read
- run: cargo test --no-default-features --features read,fallible-iterator
- run: cargo test --no-default-features --features read,std
- run: cargo test --no-default-features --features read,endian-reader
- run: cargo test --no-default-features --features read,endian-reader,std
- run: cargo test --no-default-features --features write
bench:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install rustup
run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile=minimal
- name: Install nightly rust
run: |
rustup install nightly
rustup default 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@v2
- name: Install rustup
run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile=minimal
- run: cargo install cross
- run: rustup target add ${{matrix.target}}
- run: cross test --target ${{matrix.target}}
rustfmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install rustup
run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile=minimal
- name: Install rust
run: |
rustup install stable
rustup default stable
rustup component add rustfmt
- run: cargo fmt --all -- --check
coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install rustup
run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile=minimal
- name: Install rust
run: |
rustup install stable
rustup default stable
- name: Run cargo-tarpaulin
uses: actions-rs/tarpaulin@v0.1
with:
args: '--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@v2
- run: cargo doc