name: CI

on:
  pull_request:
    branches:
      - main
  release:
    types: [ created ]
  push:
    branches:
      - main
  workflow_dispatch:
  #schedule:
  #  - cron: "20 23 * * 4"

jobs:
  lint:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - name: Install GDAL
        run: |
          sudo apt-get update
          sudo apt-get install libgdal-dev

      - name: Install latest stable
        uses: dtolnay/rust-toolchain@master
        with:
          toolchain: stable
          components: rustfmt, clippy

      - name: Lint with rustfmt
        run: cargo fmt

      - name: Lint with clippy
        run: cargo clippy --all-targets --all-features

      - name: Test with cargo  - default features
        run: cargo test --workspace --all-targets

      - name: Test with cargo - all features
        run: cargo test --workspace --all-features --all-targets
