name: Install crates

on:
  schedule:
    - cron: "* 13 * * 1"

env:
  RUSTFLAGS: -Dwarnings

jobs:
  crates_build:
    strategy:
      matrix:
        os: [ ubuntu-latest ]
        rustalias: [ stable, nightly ]
        feature_flag: [ "--no-default-features", "", "--features video" ]
        include:
          - rustalias: stable
            rust: stable
          - rustalias: nightly
            rust: nightly

    name: 'Build and test ${{ matrix.feature_flag }}: ${{ matrix.os }}, ${{ matrix.rustalias }}'
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v5

      - name: Install Rust
        uses: actions-rs/toolchain@v1
        with:
          toolchain: ${{ matrix.rust }}
          override: true

      - name: Install ffmepg dependencies
        run: sudo apt install -y clang libavcodec-dev libavformat-dev libavutil-dev pkg-config ffmpeg libavutil-dev libavfilter-dev libavdevice-dev

      - name: Install
        uses: actions-rs/cargo@v1
        with:
          command: install
          args: photo_sort ${{ matrix.feature_flag }}
