feat: continue node binding #182
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: Lint & Test & Fuzzing & Miri & Loom | |
on: | |
workflow_dispatch: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
env: | |
nightly: nightly-2024-07-06 | |
# Cancels all previous workflow runs for pull requests that have not completed. | |
# See https://docs.github.com/en/actions/using-jobs/using-concurrency | |
concurrency: | |
# The concurrency group contains the workflow name and the branch name for | |
# pull requests or the commit hash for any other events. | |
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} | |
cancel-in-progress: true | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
security-events: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup Rust | |
uses: ./.github/actions/setup-rust | |
with: | |
toolchain: nightly | |
components: clippy, rustfmt | |
- name: Install Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
cache: "yarn" | |
- name: Install Node.js dependencies | |
run: yarn install | |
- name: Install required cargo components | |
uses: taiki-e/install-action@v2 | |
with: | |
tool: clippy-sarif,sarif-fmt | |
- name: Build & Check | |
run: | | |
cargo +nightly clippy --all-features --message-format=json -- -D warnings | clippy-sarif | tee rust-clippy-results.sarif | sarif-fmt | |
RUSTDOCFLAGS="-D rustdoc::broken-intra-doc-links" cargo doc --workspace --all-features --no-deps | |
env: | |
CARGO_TERM_COLOR: always | |
- name: Format check | |
run: | | |
yarn prettier --check . | |
yarn taplo fmt --check . | |
cargo +nightly fmt --all --check | |
- name: Upload analysis results to GitHub | |
uses: github/codeql-action/upload-sarif@v2 | |
with: | |
sarif_file: rust-clippy-results.sarif | |
wait-for-processing: true | |
test: | |
name: test & collect coverage | |
runs-on: ubuntu-latest | |
continue-on-error: true | |
env: | |
RUSTFLAGS: -D warnings | |
CARGO_TERM_COLOR: always | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Rust | |
uses: ./.github/actions/setup-rust | |
with: | |
components: llvm-tools-preview | |
- name: Install latest nextest release | |
uses: taiki-e/install-action@nextest | |
- name: Install cargo-llvm-cov | |
uses: taiki-e/install-action@cargo-llvm-cov | |
- name: Collect coverage data | |
run: cargo llvm-cov nextest --all-targets --lcov --output-path lcov.info | |
- name: Upload coverage data to codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
name: tests | |
files: lcov.info | |
loom: | |
name: loom thread test | |
runs-on: ubuntu-latest | |
continue-on-error: true | |
env: | |
RUSTFLAGS: --cfg loom | |
RUST_BACKTRACE: full | |
CARGO_TERM_COLOR: always | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Rust | |
uses: ./.github/actions/setup-rust | |
- name: Install latest nextest release | |
uses: taiki-e/install-action@nextest | |
- name: Loom Thread Test | |
run: | | |
cargo nextest run -p y-octo --lib | |
fuzzing: | |
name: fuzzing | |
runs-on: ubuntu-latest | |
continue-on-error: true | |
env: | |
RUSTFLAGS: -D warnings | |
CARGO_TERM_COLOR: always | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Rust | |
uses: ./.github/actions/setup-rust | |
with: | |
toolchain: ${{ env.nightly }} | |
- name: fuzzing | |
working-directory: ./y-octo-utils | |
run: | | |
cargo install cargo-fuzz | |
cargo +${{ env.nightly }} fuzz run apply_update -- -max_total_time=30 | |
cargo +${{ env.nightly }} fuzz run codec_doc_any_struct -- -max_total_time=30 | |
cargo +${{ env.nightly }} fuzz run codec_doc_any -- -max_total_time=30 | |
cargo +${{ env.nightly }} fuzz run decode_bytes -- -max_total_time=30 | |
cargo +${{ env.nightly }} fuzz run i32_decode -- -max_total_time=30 | |
cargo +${{ env.nightly }} fuzz run i32_encode -- -max_total_time=30 | |
cargo +${{ env.nightly }} fuzz run ins_del_text -- -max_total_time=30 | |
cargo +${{ env.nightly }} fuzz run sync_message -- -max_total_time=30 | |
cargo +${{ env.nightly }} fuzz run u64_decode -- -max_total_time=30 | |
cargo +${{ env.nightly }} fuzz run u64_encode -- -max_total_time=30 | |
cargo +${{ env.nightly }} fuzz run apply_update -- -max_total_time=30 | |
- name: upload fuzz artifacts | |
if: ${{ failure() }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: fuzz-artifact | |
path: ./y-octo-utils/fuzz/artifacts/**/* | |
miri: | |
name: miri code check | |
runs-on: ubuntu-latest | |
continue-on-error: true | |
env: | |
RUST_BACKTRACE: full | |
CARGO_TERM_COLOR: always | |
MIRIFLAGS: -Zmiri-backtrace=full -Zmiri-tree-borrows | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Rust | |
uses: ./.github/actions/setup-rust | |
with: | |
toolchain: ${{ env.nightly }} | |
components: miri | |
- name: Install latest nextest release | |
uses: taiki-e/install-action@nextest | |
- name: Miri Code Check | |
run: | | |
cargo +${{ env.nightly }} miri nextest run -p y-octo -j2 | |
asan: | |
name: Address sanitizer | |
runs-on: ubuntu-latest | |
continue-on-error: true | |
env: | |
RUSTFLAGS: -D warnings -Zsanitizer=address | |
ASAN_OPTIONS: detect_leaks=1 | |
CARGO_TERM_COLOR: always | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Rust | |
uses: ./.github/actions/setup-rust | |
with: | |
toolchain: ${{ env.nightly }} | |
- name: Memory Check | |
run: | | |
rustup component add rust-src --toolchain ${{ env.nightly }} | |
cargo +${{ env.nightly }} test -Zbuild-std --target x86_64-unknown-linux-gnu -p y-octo --lib |