yara 0.32.0

Rust bindings for VirusTotal/yara
name: bindings

on:
  push:
    paths:
      - .github/workflows/bindings.yaml
      - yara-sys/yara
      - yara-sys/Cargo.toml
      - yara-sys/build.rs
      - yara-sys/wrapper.h
  pull_request:
    paths:
      - .github/workflows/bindings.yaml
      - yara-sys/yara
      - yara-sys/Cargo.toml
      - yara-sys/build.rs
      - yara-sys/wrapper.h

jobs:
  x86_64_bindings:
    strategy:
      matrix:
        include:
          - os: "ubuntu-latest"
            target: "x86_64-unknown-linux-gnu"
          - os: "ubuntu-latest"
            target: "x86_64-unknown-linux-musl"
          - os: "windows-latest"
            target: "x86_64-pc-windows-msvc"
          - os: "windows-latest"
            target: "x86_64-pc-windows-gnu"
          - os: "macos-latest"
            target: "x86_64-apple-darwin"

    runs-on: ${{ matrix.os }}
    steps:
      # required for bindgen to work, see https://github.com/rust-lang/rust-bindgen/issues/1797
      - name: Install LLVM and Clang
        uses: KyleMayes/install-llvm-action@v1
        if: matrix.os == 'windows-latest'
        with:
          version: "14.0"
          directory: ${{ runner.temp }}/llvm
      - name: Set LIBCLANG_PATH
        if: matrix.os == 'windows-latest'
        run: echo "LIBCLANG_PATH=$((gcm clang).source -replace "clang.exe")" >> $env:GITHUB_ENV
      - uses: actions/checkout@v3
        with:
          submodules: true
      - name: Install rust toolchain
        uses: dtolnay/rust-toolchain@stable
        with:
          toolchain: stable
          targets: ${{ matrix.target }}
      - name: Generate bindings
        shell: bash
        run: |
          cargo build --verbose --no-default-features --features vendored,bindgen
          mkdir out
          find . -name 'bindings.rs'
          cp "$(find . -name 'bindings.rs')" "./out/yara-${{ matrix.target }}.rs"
          ls out
      - name: Archive production artifacts
        uses: actions/upload-artifact@v4
        with:
          name: bindings-${{ matrix.target }}
          path: ./out/yara-${{ matrix.target }}.rs