name: CI

on:
  push:
    branches:
      - master
  pull_request:

jobs:
  lint:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Format
        run: cargo fmt && git diff --exit-code
      - name: Lint
        run: |
          rustup update
          rustup component add clippy
          cargo clippy -- \
            -D warnings -D clippy::expect_used -D clippy::unwrap_used -D clippy::panic
  test:
    strategy:
      matrix:
        platform: ["ubuntu-latest", "macos-latest"]
    runs-on: ${{ matrix.platform }}
    steps:
    - uses: actions/checkout@v2

    - name: deps
      if: matrix.platform == 'ubuntu-latest'
      run: |
        sudo apt install -y libxcb-shape0-dev libxcb-xfixes0-dev

    - name: Build
      run: cargo build

    - name: Test
      run: cargo test
