[Cherry-pick] Fix panics
on reading entries by stale index. (#370) …
#1647
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, pull_request] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
nightly: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ ubuntu-22.04, macos-13 ] | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Install nightly toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: nightly-2022-07-13 | |
override: true | |
components: rustfmt, clippy, rust-src | |
- uses: Swatinem/rust-cache@v1 | |
with: | |
sharedKey: ${{ matrix.os }} | |
- name: Cache dependencies | |
if: ${{ matrix.os == 'ubuntu-22.04' }} | |
run: if [[ ! -e ~/.cargo/bin/grcov ]]; then cargo install --locked grcov --version 0.8.9; fi | |
- name: Format | |
run: | | |
make format | |
git diff --exit-code | |
- name: Clippy | |
run: make clippy | |
env: | |
EXTRA_CARGO_ARGS: '--fix' | |
- name: Run tests | |
run: make test | |
env: | |
RUST_BACKTRACE: 1 | |
EXTRA_CARGO_ARGS: '--verbose' | |
- name: Run asan tests | |
if: ${{ matrix.os == 'ubuntu-22.04' }} | |
run: make test | |
env: | |
RUST_BACKTRACE: 1 | |
RUSTFLAGS: '-Zsanitizer=address' | |
RUSTDOCFLAGS: '-Zsanitizer=address' | |
EXTRA_CARGO_ARGS: '--verbose -Zbuild-std --target x86_64-unknown-linux-gnu' | |
stable: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ ubuntu-22.04 ] | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Install stable toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: 1.63.0 | |
override: true | |
components: rustfmt, clippy, rust-src | |
- uses: Swatinem/rust-cache@v1 | |
with: | |
sharedKey: ${{ matrix.os }}-stable | |
- name: Clippy | |
run: make clippy | |
env: | |
WITH_STABLE_TOOLCHAIN: 'force' | |
- name: Run tests | |
run: make test | |
env: | |
RUST_BACKTRACE: 1 | |
EXTRA_CARGO_ARGS: '--verbose' | |
WITH_STABLE_TOOLCHAIN: 'force' | |
coverage: | |
runs-on: ubuntu-22.04 | |
needs: nightly | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Install nightly toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: nightly-2022-07-13 | |
override: true | |
components: llvm-tools-preview | |
- uses: Swatinem/rust-cache@v1 | |
with: | |
sharedKey: ubuntu-22.04 | |
- name: Install grcov | |
run: if [[ ! -e ~/.cargo/bin/grcov ]]; then cargo install --locked grcov --version 0.8.9; fi | |
- name: Run tests | |
run: | | |
make test | |
env WITH_STABLE_TOOLCHAIN=auto make test | |
env: | |
RUSTFLAGS: '-Zinstrument-coverage' | |
LLVM_PROFILE_FILE: '%p-%m.profraw' | |
EXTRA_CARGO_ARGS: '--verbose' | |
- name: Run grcov | |
run: grcov `find . \( -name "*.profraw" \) -print` --binary-path target/debug/deps/ -s . -t lcov --branch --ignore-not-existing --ignore '../**' --ignore '/*' -o coverage.lcov | |
- name: Upload | |
uses: codecov/codecov-action@v2 | |
with: | |
file: coverage.lcov |