Merge pull request #58 from vipyrsec/shenanigansd-patch-1 #155
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 CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
lint: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | |
- name: Setup Rust | |
run: | | |
set -e | |
rustup toolchain install stable --no-self-update --profile minimal --component rustfmt | |
rustup default stable | |
- name: Run Clippy | |
run: cargo fmt --all --check | |
yara: | |
needs: lint | |
uses: ./.github/workflows/yara.yaml | |
with: | |
runs-on: ubuntu-22.04 | |
clippy: | |
needs: yara | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | |
- name: Download YARA | |
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | |
with: | |
name: ${{ needs.yara.outputs.artifacts }} | |
path: .yara | |
- name: Setup Rust | |
run: | | |
set -e | |
rustup toolchain install stable --no-self-update --profile minimal --component clippy | |
rustup default stable | |
- name: Cache dependencies | |
uses: Swatinem/rust-cache@dd05243424bd5c0e585e4b55eb2d7615cdd32f1f # v2.5.1 | |
with: | |
key: x86_64-unknown-linux-gnu | |
- name: Run Clippy | |
env: | |
YARA_INCLUDE_DIR: ${{ github.workspace }}/.yara/${{ needs.yara.outputs.include-dir }} | |
YARA_LIBRARY_PATH: ${{ github.workspace }}/.yara/${{ needs.yara.outputs.library-path }} | |
run: cargo clippy -- -D clippy::all -D clippy::pedantic -D clippy::cargo -A clippy::cargo_common_metadata | |
yara-test: | |
needs: clippy | |
strategy: | |
fail-fast: true | |
matrix: | |
runs-on: | |
- ubuntu-22.04 | |
uses: ./.github/workflows/yara.yaml | |
with: | |
runs-on: ${{ matrix.runs-on }} | |
yara-test-output: | |
needs: yara-test | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Read Matrix Output | |
id: read | |
uses: cloudposse/github-action-matrix-outputs-read@main | |
with: | |
matrix-step-name: yara | |
outputs: | |
result: ${{ steps.read.outputs.result }} | |
test: | |
needs: [yara-test, yara-test-output] | |
strategy: | |
matrix: | |
triple: | |
- runs-on: ubuntu-22.04 | |
target: x86_64-unknown-linux-gnu | |
runs-on: ${{ matrix.triple.runs-on }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | |
- name: Download YARA | |
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | |
with: | |
name: ${{ fromJson(needs.yara-test-output.outputs.result).artifacts[matrix.triple.runs-on] }} | |
path: .yara | |
- name: Setup Rust | |
run: | | |
set -e | |
rustup toolchain install stable --no-self-update --profile minimal | |
rustup default stable | |
- name: Cache dependencies | |
uses: Swatinem/rust-cache@dd05243424bd5c0e585e4b55eb2d7615cdd32f1f # v2.5.1 | |
with: | |
key: ${{ matrix.triple.target }} | |
- name: Run tests | |
env: | |
RUST_BACKTRACE: full | |
YARA_INCLUDE_DIR: ${{ github.workspace }}/.yara/${{ needs.yara-test.outputs.include-dir }} | |
YARA_LIBRARY_PATH: ${{ github.workspace }}/.yara/${{ needs.yara-test.outputs.library-path }} | |
run: cargo test --no-fail-fast |