emulsion 10.0.0

A fast and minimalistic image viewer
name: Test

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:

  rustfmt-clippy:
    runs-on: ubuntu-20.04
    steps:
      - uses: actions-rs/toolchain@v1
        with:
          toolchain: stable
          override: true
          components: rustfmt, clippy
      - uses: actions/checkout@v2
      - name: Run `cargo fmt`
        uses: actions-rs/cargo@v1
        with:
          command: fmt
          args: --all -- --check
      - name: Run `cargo clippy`
        uses: actions-rs/cargo@v1
        with:
          command: clippy
          args: --all-targets --features=networking -- -D warnings -A clippy::type_complexity -A clippy::needless_late_init -A clippy::question_mark

  build:
    needs: rustfmt-clippy
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-20.04, macos-latest, windows-latest]
    steps:
      - uses: actions-rs/toolchain@v1
        with:
          toolchain: stable
          override: true
      - name: Checkout
        uses: actions/checkout@v2
      - name: Install avif build dependencies (linux)
        if: matrix.os == 'ubuntu-20.04'
        run: |

          DEBIAN_FRONTEND=noninteractive sudo apt-get update
          DEBIAN_FRONTEND=noninteractive sudo apt-get install -y ninja-build nasm meson

      - name: Install avif build dependencies (macOS)
        if: matrix.os == 'macOS-latest'
        run: |

          brew install ninja nasm meson

      - name: Install avif build dependencies (Windows)
        if: matrix.os == 'windows-latest'
        run: |

          choco install -y ninja
          pip install meson
          $NASM_VERSION="2.15.02"
          $LINK="https://www.nasm.us/pub/nasm/releasebuilds/$NASM_VERSION/win64"
          curl -LO "$LINK/nasm-$NASM_VERSION-win64.zip"
          7z e -y "nasm-$NASM_VERSION-win64.zip" -o"C:\nasm"
          echo "C:\nasm" >> $env:GITHUB_PATH

      # According to https://github.com/actions-rs/cargo
      # it's okay to simply just run `cargo` once the toolchain is set up
      # so there's no need to use actions-rs/cargo@v1
      - name: Build and run tests (linux/macOS)
        if: matrix.os != 'windows-latest'
        run: |

          env RUSTFLAGS="-C opt-level=0" cargo test --verbose --all-features

      - name: Build and run tests (windows)
        if: matrix.os == 'windows-latest'
        shell: cmd
        run: |

          call "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat"
          env RUSTFLAGS="-C opt-level=0" cargo test --verbose --all-features