Add Unit::new_with_abbreviations() to allow the user to use custom ab… #364
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Rust | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
build: | |
strategy: | |
matrix: | |
os: ['ubuntu-latest'] | |
rust_channel: ['stable', 'beta', 'nightly', '1.65.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/[email protected] | |
- name: Build | |
run: cargo build --verbose --no-default-features --features read-all -p gimli | |
- name: Test | |
run: cargo test --verbose --no-default-features --features read-all -p gimli | |
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 | |
- powerpc64-unknown-linux-gnu | |
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 |