Fix bugs discovered by fuzzing tests #2
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 | |
env: | |
CARGO_TERM_COLOR: always | |
permissions: | |
contents: read | |
on: | |
push: | |
branches: | |
- master | |
paths: | |
- ".github/workflows/*.yml" | |
- "Cargo.toml" | |
- "src/**.rs" | |
- "tests/**.rs" | |
pull_request: | |
branches: | |
- master | |
paths: | |
- ".github/workflows/*.yml" | |
- "Cargo.toml" | |
- "src/**.rs" | |
- "tests/**.rs" | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
name: Lint | |
permissions: | |
checks: write | |
contents: write | |
pull-requests: write | |
steps: | |
- name: Repository checkout | |
uses: actions/checkout@v3 | |
- name: Setup Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: nightly | |
default: true | |
profile: minimal | |
components: rustfmt, clippy | |
- name: Run cargo fmt | |
uses: actions-rs/cargo@v1 | |
with: | |
command: fmt | |
args: --check --verbose | |
- name: Run cargo clippy | |
uses: actions-rs/clippy-check@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
args: --all-features -- --deny clippy::cargo | |
build-and-test-linux: | |
needs: | |
- lint | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
toolchain: [1.63.0, stable, nightly] | |
name: "Build and test (OS: Linux, Toolchain: ${{ matrix.toolchain }})" | |
steps: | |
- name: Repository checkout | |
uses: actions/checkout@v3 | |
- name: Setup Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: ${{ matrix.toolchain }} | |
default: true | |
profile: minimal | |
- name: Run cargo build | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --all-features --verbose | |
- name: Run cargo test | |
uses: actions-rs/cargo@v1 | |
with: | |
command: test | |
args: --all-features --verbose | |
build-and-test-macos: | |
needs: | |
- lint | |
runs-on: macos-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
toolchain: [1.63.0, stable, nightly] | |
name: "Build and test (OS: MacOS, Toolchain: ${{ matrix.toolchain }})" | |
steps: | |
- name: Repository checkout | |
uses: actions/checkout@v3 | |
- name: Setup Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: ${{ matrix.toolchain }} | |
default: true | |
profile: minimal | |
- name: Run cargo build | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --all-features --verbose | |
- name: Run cargo test | |
uses: actions-rs/cargo@v1 | |
with: | |
command: test | |
args: --all-features --verbose | |
build-and-test-windows: | |
needs: | |
- lint | |
runs-on: windows-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
toolchain: [1.63.0, stable, nightly] | |
name: "Build and test (OS: Windows, Toolchain: ${{ matrix.toolchain }})" | |
steps: | |
- name: Repository checkout | |
uses: actions/checkout@v3 | |
- name: Setup Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: ${{ matrix.toolchain }} | |
default: true | |
profile: minimal | |
- name: Run cargo build | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --all-features --verbose | |
- name: Run cargo test | |
uses: actions-rs/cargo@v1 | |
with: | |
command: test | |
args: --all-features --verbose | |
fuzzing-test: | |
needs: | |
- build-and-test-linux | |
runs-on: ubuntu-latest | |
name: Fuzzing test | |
steps: | |
- name: Repository checkout | |
uses: actions/checkout@v3 | |
- name: Setup Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: nightly | |
default: true | |
profile: minimal | |
components: llvm-tools | |
- name: Run cargo install cargo-fuzz | |
uses: actions-rs/cargo@v1 | |
with: | |
command: install | |
args: cargo-fuzz | |
- name: Run cargo fuzz run hash | |
uses: actions-rs/cargo@v1 | |
with: | |
command: fuzz | |
args: run hash -- -max_len=65536 -max_total_time=60 | |
- name: Run cargo fuzz run update | |
uses: actions-rs/cargo@v1 | |
with: | |
command: fuzz | |
args: run update -- -max_len=65536 -max_total_time=60 |