Skip to content

[pull] main from VirusTotal:main #39

[pull] main from VirusTotal:main

[pull] main from VirusTotal:main #39

Workflow file for this run

name: Tests
on:
pull_request:
types: [ opened, reopened, synchronize, ready_for_review ]
push:
jobs:
test:
name: Test
env:
CARGO_TERM_COLOR: always
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.experimental }}
strategy:
fail-fast: true
matrix:
build:
- msrv
- stable
- nightly
- macos
- 32bits
- windows-msvc
- windows-gnu
- windows-32bits
- no-default-features
- protoc
include:
- build: msrv
os: ubuntu-latest
rust: 1.88.0
target: x86_64-unknown-linux-gnu
args: "--features=magic-module,rules-profiling"
rust_flags: "-Awarnings"
experimental: false
use_cache: true
- build: stable
os: ubuntu-latest
rust: stable
target: x86_64-unknown-linux-gnu
args: "--features=magic-module,rules-profiling"
rust_flags: "-Awarnings"
experimental: false
use_cache: true
- build: nightly
os: ubuntu-latest
rust: nightly
target: x86_64-unknown-linux-gnu
args: "--features=magic-module,rules-profiling"
rust_flags: "-Awarnings"
experimental: true
use_cache: true
- build: macos
os: macos-latest
rust: stable
target: aarch64-apple-darwin
args: "--features=rules-profiling"
rust_flags: "-Awarnings"
experimental: false
use_cache: true
- build: 32bits
os: ubuntu-latest
rust: stable
target: i686-unknown-linux-gnu
# yara-x-py is excluded because the Python version installed in the
# host is 64-bits, but the YARA-X library is 32-bits.
args: "--features=rules-profiling --workspace --exclude=yara-x-py"
rust_flags: "-Awarnings"
experimental: false
use_cache: true
- build: windows-msvc
os: windows-latest
rust: stable
target: x86_64-pc-windows-msvc
args: "--features=rules-profiling"
rust_flags: "-Awarnings"
experimental: false
use_cache: true
- build: windows-gnu
os: windows-latest
rust: stable
target: x86_64-pc-windows-gnu
args: " --no-default-features --features=default-modules,rules-profiling,inventory"
rust_flags: "-Awarnings"
experimental: false
use_cache: true
- build: windows-32bits
os: windows-latest
rust: stable
target: i686-pc-windows-msvc
# yara-x-py is excluded because the Python version installed in the
# host is 64-bits, but the YARA-X library is 32-bits.
args: "--features=rules-profiling --workspace --exclude=yara-x-py"
rust_flags: "-Awarnings"
experimental: false
use_cache: true
- build: no-default-features
os: ubuntu-latest
rust: stable
target: x86_64-unknown-linux-gnu
args: "--no-default-features --features=default-modules,magic-module,linkme"
rust_flags: "-Awarnings"
experimental: false
use_cache: false
- build: protoc
os: ubuntu-latest
rust: stable
target: x86_64-unknown-linux-gnu
args: "--features=protoc,magic-module"
rust_flags: "-Awarnings"
experimental: false
use_cache: true
steps:
- name: Checkout sources
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
target: ${{ matrix.target }}
- name: Print Rust version to file (for correct caching)
run: rustc --version > .rustc_version
- name: Cache cargo registry
if: matrix.use_cache == true
uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- name: Install dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libmagic-dev gcc-multilib
sudo apt-get autoremove -y
sudo apt-get clean
- name: Install protoc
if: matrix.build == 'protoc'
run: |
sudo apt-get install -y protobuf-compiler
cargo install protobuf-codegen
- name: Run tests
run: cargo test --target ${{ matrix.target }} ${{ matrix.args }}
env:
RUSTFLAGS: ${{ matrix.rust_flags }}
- name: Build CLI
run: cargo build --bin yr --target ${{ matrix.target }} ${{ matrix.args }}
env:
RUSTFLAGS: ${{ matrix.rust_flags }}
- name: Run tests for CLI
run: cargo test --target ${{ matrix.target }} -p yara-x-cli --bin yr
env:
CARGO_BIN_EXE_yr: ${{ github.workspace }}/target/${{ matrix.target }}/debug/yr
RUSTFLAGS: ${{ matrix.rust_flags }}
- name: Run doc tests
run: cargo doc --no-deps
env:
RUSTDOCFLAGS: ${{ matrix.rust_flags }}