Skip to content

refactor: some changes in the API that controls condition optimizatio… #2715

refactor: some changes in the API that controls condition optimizatio…

refactor: some changes in the API that controls condition optimizatio… #2715

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
- win-msvc
# - win-gnu
- no-default-features
- protoc
include:
- build: msrv
os: ubuntu-latest
rust: 1.78.0
args: "--features=magic-module"
rust_flags: "-Awarnings"
experimental: false
- build: stable
os: ubuntu-latest
rust: stable
args: "--features=magic-module"
rust_flags: "-Awarnings"
experimental: false
- build: nightly
os: ubuntu-latest
rust: nightly
args: "--features=magic-module"
# Link is currently failing with rust-lld (rust-lang/rust#124129)
# Disable rust-lld with -Zlinker-features=-lld
# See: https://github.com/dtolnay/linkme/commit/d13709bfd2c1278b4c8b6c846e2017b623923c0c
rust_flags: "-Awarnings -Zlinker-features=-lld"
experimental: true
- build: macos
os: macos-latest
rust: stable
args: ""
rust_flags: "-Awarnings"
experimental: false
- build: win-msvc
os: windows-latest
rust: stable
args: ""
rust_flags: "-Awarnings"
experimental: false
# Tests for the `stable-x86_64-pc-windows-gnu` toolchain disabled
# due to https://github.com/VirusTotal/yara-x/issues/29
#
# - build: win-gnu
# os: windows-latest
# rust: stable-x86_64-gnu
# args: ""
# experimental: false
- build: no-default-features
os: ubuntu-latest
rust: stable
args: "--package yara-x --no-default-features --features=test_proto2-module,test_proto3-module,string-module,time-module,hash-module,macho-module,magic-module,math-module,lnk-module,elf-module,pe-module,dotnet-module,console-module"
rust_flags: "-Awarnings"
experimental: false
- build: protoc
os: ubuntu-latest
rust: stable
args: "--package yara-x --features=protoc,magic-module"
rust_flags: "-Awarnings"
experimental: false
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Setup cache
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libmagic-dev
- name: Install protoc
if: matrix.build == 'protoc'
run: |
sudo apt-get install -y protobuf-compiler
cargo install protobuf-codegen
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
- name: Run cargo test
run: cargo test --all-targets ${{ matrix.args }}
env:
RUSTFLAGS: ${{ matrix.rust_flags }}