on:
  pull_request:
  push:
    branches:
      - master
    tags:
      - '*'

name: Continuous integration

jobs:
  check:
    name: Rustfmt
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - uses: actions-rs/toolchain@v1
        with:
          toolchain: stable
          override: true
      - run: rustup component add rustfmt
      - uses: actions-rs/cargo@v1
        with:
          command: fmt
          args: --all -- --check

  test:
    name: Test Suite
    runs-on: macOS-10.14
    steps:
      - uses: actions/checkout@v1

      - name: install cairo
        run: brew install cairo

      - uses: actions-rs/toolchain@v1
        with:
          toolchain: stable
          override: true

      - run: git submodule update --init --recursive

      - uses: actions-rs/cargo@v1
        with:
          command: test
          args: --all-features

  doc:
    name: Docs
    runs-on: macOS-10.14
    steps:
      - uses: actions/checkout@v1

      - name: install cairo
        run: brew install cairo

      - uses: actions-rs/toolchain@v1
        with:
          toolchain: nightly
          override: true
      - uses: actions-rs/cargo@v1
        with:
          command: doc
          args: --document-private-items
