Skip to content

refactor: extract, document, and test pure work selection and payload builders #391

refactor: extract, document, and test pure work selection and payload builders

refactor: extract, document, and test pure work selection and payload builders #391

Workflow file for this run

---
name: "\U0001F980 Rust"
on:
merge_group:
pull_request:
branches:
- main
- feat/more-attack-cov
types:
- opened
- synchronize
- reopened
paths:
- 'ares-*/**'
- 'Cargo.toml'
- 'Cargo.lock'
- '.github/workflows/rust.yaml'
push:
branches:
- main
paths:
- 'ares-*/**'
- 'Cargo.toml'
- 'Cargo.lock'
- '.github/workflows/rust.yaml'
workflow_dispatch:
concurrency:
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.ref }}
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
permissions:
actions: read
checks: write
contents: read
pull-requests: write
jobs:
check:
name: "\U0001F50D Cargo check"
runs-on: ubuntu-latest
steps:
- name: Set up git repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
- name: Cache cargo registry and build
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-check-${{ github.ref }}-${{ hashFiles('Cargo.lock', 'Cargo.toml') }}
restore-keys: |
${{ runner.os }}-cargo-check-${{ github.ref }}-
${{ runner.os }}-cargo-check-refs/heads/main-
- name: Run cargo check
run: cargo check --workspace
test:
name: "\U0001F9EA Tests"
runs-on: ubuntu-latest
needs: check
steps:
- name: Set up git repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
with:
components: llvm-tools-preview
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@735e5933943122c5ac182670a935f54a949265c1 # v2
with:
tool: cargo-llvm-cov
- name: Cache cargo registry and build
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-test-${{ github.ref }}-${{ hashFiles('Cargo.lock', 'Cargo.toml') }}
restore-keys: |
${{ runner.os }}-cargo-test-${{ github.ref }}-
${{ runner.os }}-cargo-test-refs/heads/main-
- name: Run tests with coverage
run: cargo llvm-cov --workspace --lcov --output-path lcov.info
- name: Upload coverage to Codecov
uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6
with:
files: lcov.info
token: ${{ secrets.CODECOV_TOKEN }}
- name: Add test summary
if: always()
run: |
{
echo "## \U0001F980 Rust Test Results"
echo
echo '```'
cargo test --workspace 2>&1 || true
echo '```'
} >> "$GITHUB_STEP_SUMMARY"
fmt:
name: "\U0001F4D0 Format"
runs-on: ubuntu-latest
steps:
- name: Set up git repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
with:
components: rustfmt
- name: Check formatting
run: cargo fmt --all -- --check
clippy:
name: "\U0001F4CE Clippy"
runs-on: ubuntu-latest
needs: check
steps:
- name: Set up git repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
with:
components: clippy
- name: Cache cargo registry and build
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-clippy-${{ github.ref }}-${{ hashFiles('Cargo.lock', 'Cargo.toml') }}
restore-keys: |
${{ runner.os }}-cargo-clippy-${{ github.ref }}-
${{ runner.os }}-cargo-clippy-refs/heads/main-
- name: Run clippy
run: cargo clippy --workspace -- -D warnings