name: CI

on:
  push:
    branches:
      - "**"
  pull_request:
    branches:
      - "**"
  schedule:
    - cron:  '0 0 * * 1' # weekly

jobs:
  build:
    strategy:
      matrix:
        toolchain: [ stable, nightly ]

    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2
      - run: rustup default ${{ matrix.toolchain }}
      - run: rustup update
      - run: cargo build
      - run: cargo test

  style:
    strategy:
      matrix:
        toolchain: [stable, nightly]

    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v1
      - run: cargo fmt -- --check
      - run: cargo clippy
