
name: CI

on:
  push:
    branches:
        - master
        - develop
  pull_request:
    branches:
        - master
        - develop

env:
  CARGO_TERM_COLOR: always

jobs:
  test:
    name: Test

    strategy:
      fail-fast: false

      matrix:
        platform:
          - { target: x86_64-pc-windows-msvc, os: windows-latest }
          - { target: x86_64-unknown-linux-gnu, os: ubuntu-latest }
          - { target: x86_64-apple-darwin, os: macos-latest }
          - { target: x86_64-pc-windows-gnu, os: windows-latest, host: -x86_64-pc-windows-gnu }

    runs-on: ${{ matrix.platform.os }}

    steps:
      - uses: actions/checkout@v2

      - name: Build sqlite
        run: cargo build --features sqlite --all-targets

      - name: Run tests sqlite
        run: cargo test --features sqlite --all-targets

      - name: Document tests sqlite
        run: cargo test --features sqlite --doc

  clippy:
    name: Clippy

    strategy:
      fail-fast: false

    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2

      - name: prepare
        run: rustup component add clippy

      - name: clippy sqlite
        run: cargo clippy --all-targets --features sqlite -- -D clippy::dbg_macro -D warnings

      - name: clippy mysql
        run: cargo clippy --all-targets --features mysql -- -D clippy::dbg_macro -D warnings

      - name: clippy postgres
        run: cargo clippy --all-targets --features postgres -- -D clippy::dbg_macro -D warnings

      - name: clippy all features
        run: cargo clippy --all-targets --all-features -- -D clippy::dbg_macro -D warnings

