authenticode-parser 0.5.0

Bindings to the authenticode-parser library
Documentation
name: CI

on:
  pull_request:
  push:
    branches:
      - master
  schedule:
    - cron: '45 4 * * 3'

env:
  RUSTFLAGS: -Dwarnings

jobs:
  test-linux:
    name: Test ${{matrix.build}}
    runs-on: ubuntu-latest

    steps:
      - name: Install openssl x86 and 32 support for gcc
        if: ${{ matrix.build == 'linux32' }}
        run: |

          sudo dpkg --add-architecture i386
          sudo apt update
          sudo apt install libssl-dev:i386 gcc-multilib
          echo "OPENSSL_INCLUDE_DIR=/usr/include" >> $GITHUB_ENV
          echo "OPENSSL_LIB_DIR=/usr/lib/i386-linux-gnu" >> $GITHUB_ENV

      - uses: actions/checkout@v3
        with:
          submodules: true
      - uses: dtolnay/rust-toolchain@stable
        with:
          target: ${{matrix.target}}

      - run: cargo test --workspace --target=${{matrix.target}}
      - run: cargo test --workspace --features bindgen --target=${{matrix.target}}

      - name: Add libcrypto.a to lib path
        if: ${{ matrix.build == 'linux' }}
        run: |

          echo "OPENSSL_LIB_DIR=/usr/lib/x86_64-linux-gnu" >> $GITHUB_ENV

      - run: cargo test --workspace --features openssl-static --target=${{matrix.target}}

    strategy:
      fail-fast: false
      matrix:
        build: [linux, linux32]
        include:
          - build: linux
            target: x86_64-unknown-linux-gnu
          - build: linux32
            target: i686-unknown-linux-gnu

  test-windows:
    name: Test ${{matrix.build}}
    runs-on: windows-latest

    steps:
      - uses: actions/checkout@v3
        with:
          submodules: true

      - name: Install OpenSSL on windows
        uses: lukka/run-vcpkg@v10
        id: runvcpkg
        env:
          VCPKG_DEFAULT_TRIPLET: ${{matrix.vcpkg_triplet}}
          VCPKG_INSTALLED_DIR: '${{ runner.workspace }}/vcpkg/installed'
        with:
          appendedCacheKey: ${{matrix.vcpkg_triplet}}
          vcpkgDirectory: '${{ runner.workspace }}/vcpkg'
          vcpkgGitCommitId: '4cac260c4b7331538d31886f57739fea0bffa27e'
          runVcpkgInstall: true

      - name: Export OPENSSL_DIR env var
        shell: bash
        run: echo "OPENSSL_DIR=${{ runner.workspace }}\\vcpkg\\installed\\${{ matrix.vcpkg_triplet }}" >> $GITHUB_ENV

      - uses: dtolnay/rust-toolchain@stable
        with:
          target: ${{matrix.target}}

      - run: cargo test --workspace --target=${{matrix.target}}
      - run: cargo test --workspace --features bindgen --target=${{matrix.target}}
      - run: cargo test --workspace --features openssl-static --target=${{matrix.target}}

    strategy:
      fail-fast: false
      matrix:
        build: [windows, windows32]
        include:
          - build: windows
            vcpkg_triplet: x64-windows-static
            target: x86_64-pc-windows-msvc
          - build: windows32
            vcpkg_triplet: x86-windows-static
            target: i686-pc-windows-msvc


  clippy:
    name: Clippy
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
        with:
          submodules: true
      - uses: dtolnay/rust-toolchain@stable
        with:
          components: clippy
      - run: cargo clippy --workspace --tests
      - run: cargo clippy --workspace --tests --features bindgen

  rustfmt:
    name: Rustfmt
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
        with:
          submodules: true
      - uses: dtolnay/rust-toolchain@stable
        with:
          components: rustfmt
      - run: cargo fmt --all --check

  msrv:
    name: Rust 1.65.0
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
        with:
          submodules: true
      - uses: dtolnay/rust-toolchain@1.65.0
      - run: cargo check --workspace
      - run: cargo check --workspace --features bindgen