Migrate to Yara-X #312
Workflow file for this run
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 | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
lint: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- 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 | |
clippy: | |
needs: lint | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- 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@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3 | |
with: | |
key: x86_64-unknown-linux-gnu | |
- name: Run Clippy | |
run: cargo clippy -- -D clippy::all -D clippy::pedantic -D clippy::cargo -A clippy::cargo_common_metadata -A clippy::multiple_crate_versions | |
test: | |
needs: lint | |
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@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- 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@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3 | |
with: | |
key: ${{ matrix.triple.target }} | |
- name: Run tests | |
env: | |
RUST_BACKTRACE: full | |
run: cargo test --no-fail-fast | |
docs-build: | |
needs: lint | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- 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@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3 | |
with: | |
key: x86_64-unknown-linux-gnu | |
- name: Build docs | |
run: cargo doc --no-deps --document-private-items | |
# `.lock` is set to `rw-------`, which causes `actions/deploy-pages` to fail, | |
# because it expects all files to be at least `rw-r--r--` | |
- name: Remove '.lock' file | |
run: rm ./target/doc/.lock | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@0252fc4ba7626f0298f0cf00902a25c6afc77fa8 # v3.0.0 | |
with: | |
path: ./target/doc | |
docs-deploy: | |
needs: docs-build | |
if: github.ref == 'refs/heads/main' | |
# Sets permissions of the `GITHUB_TOKEN` to allow deployment to GitHub Pages | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@87c3283f01cd6fe19a0ab93a23b2f6fcba5a8e42 # v4.0.3 |