yara 0.32.0

Rust bindings for VirusTotal/yara
name: tests

on:
  push:
    paths-ignore:
      - 'LICENSE-*'
      - '**.md'
  pull_request:
    paths-ignore:
      - 'LICENSE-*'
      - '**.md'

jobs:
  linters:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v3
        with:
          submodules: true
      - name: Install rust toolchain
        uses: dtolnay/rust-toolchain@stable
        with:
          toolchain: stable
          components: rustfmt, clippy
      - name: Cargo fmt
        run: cargo fmt --all -- --check
      - name: Cargo clippy
        run: cargo clippy --features bindgen,bundled-4_5_5,vendored -- -D warnings

  test-posix:
    strategy:
      matrix:
        os: [ ubuntu-latest ]
        target: ["x86_64-unknown-linux-musl", "x86_64-unknown-linux-gnu"]
        features: [ "vendored,bindgen", "vendored,bundled-4_5_5" ]
        rust: [ stable, nightly ]

    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v3
        with:
          submodules: true
      - name: Install rust toolchain
        uses: dtolnay/rust-toolchain@stable
        with:
          toolchain: ${{ matrix.rust }}
          targets: ${{ matrix.target }}
      # Skip tests containing "proc", they seem to fail randomly on the pipeline.
      - name: Test
        run: cargo test --verbose --no-default-features --features ${{ matrix.features }},module-hash,module-dotnet,module-dex,module-macho,ndebug -- --skip proc

  test-windows:
    strategy:
      matrix:
        os: [ windows-2025 ]
        features: [ "vendored,bundled-4_5_5" ]
        rust: [ stable ]
        cryptolib: [ "WinCrypt", "disabled" ]

    runs-on: ${{ matrix.os }}
    steps:
        - name: Install OpenSSL
          if: ${{ matrix.cryptolib == 'OpenSSL' }}
          run: choco install openssl
        - uses: actions/checkout@v3
          with:
            submodules: true
        - name: Install rust toolchain
          uses: dtolnay/rust-toolchain@stable
          with:
            toolchain: ${{ matrix.rust }}
        - name: Test
          env:
            YARA_CRYPTO_LIB: ${{ matrix.cryptolib }}
          # Skip tests containing "proc", they seem to fail randomly on the pipeline.
          run: cargo test --verbose --no-default-features --features ${{ matrix.features }},module-hash,module-dotnet,module-dex,module-macho,ndebug -- --skip proc


  build-macos:
    strategy:
      matrix:
        os: [ macos-13 ]
        features: [ "vendored,bindgen", "vendored,bundled-4_5_5" ]
        rust: [ stable, nightly ]
        cryptolib: [ "OpenSSL", "CommonCrypto", "disabled" ]
        openssl_dir: [ "/usr/local/opt/openssl@1.1" ]

    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v3
        with:
          submodules: true
      - name: Install rust toolchain
        uses: dtolnay/rust-toolchain@stable
        with:
          toolchain: ${{ matrix.rust }}
      - name: Test
        env:
          YARA_CRYPTO_LIB: '${{ matrix.cryptolib }}'
          CFLAGS: '-I ${{ matrix.openssl_dir }}/include'
          OPENSSL_LIB_DIR: '${{ matrix.openssl_dir }}/lib'
        run: cargo build --verbose --no-default-features --features ${{ matrix.features }},module-hash,module-dotnet,module-dex,module-macho,ndebug