name: CI

on:
  push:
  pull_request:
  schedule: [cron: "40 1 * * *"]

jobs:
  test:
    name: Test
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: dtolnay/rust-toolchain@nightly
        with:
          components: rustfmt
      - run: cargo run -- expand --manifest-path tests/Cargo.toml > expand.rs
      - run: diff tests/lib.expand.rs expand.rs

  build:
    name: Rust ${{matrix.rust}}
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        rust: [nightly, beta, stable, 1.51.0]
    steps:
      - uses: actions/checkout@v2
      - uses: dtolnay/rust-toolchain@master
        with:
          toolchain: ${{matrix.rust}}
      - run: cargo check
      - run: cargo update && cargo check

  clippy:
    name: Clippy
    runs-on: ubuntu-latest
    if: github.event_name != 'pull_request'
    steps:
      - uses: actions/checkout@v2
      - uses: dtolnay/rust-toolchain@clippy
      - run: cargo clippy --tests -- -Dclippy::all -Dclippy::pedantic

  outdated:
    name: Outdated
    runs-on: ubuntu-latest
    if: github.event_name != 'pull_request'
    steps:
      - uses: actions/checkout@v2
      - run: cargo update
      - run: cargo outdated --exit-code 1

name: CI

on:
  push:
  pull_request:
  schedule: [cron: "40 1 * * *"]

jobs:
  test:
    name: Test
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: dtolnay/rust-toolchain@nightly
        with:
          components: rustfmt
      - run: cargo run -- expand --manifest-path tests/Cargo.toml > expand.rs
      - run: diff tests/lib.expand.rs expand.rs

  build:
    name: Rust ${{matrix.rust}}
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        rust: [nightly, beta, stable, 1.51.0]
    steps:
      - uses: actions/checkout@v2
      - uses: dtolnay/rust-toolchain@master
        with:
          toolchain: ${{matrix.rust}}
      - run: cargo check
      - run: cargo update && cargo check

  clippy:
    name: Clippy
    runs-on: ubuntu-latest
    if: github.event_name != 'pull_request'
    steps:
      - uses: actions/checkout@v2
      - uses: dtolnay/rust-toolchain@clippy
      - run: cargo clippy --tests -- -Dclippy::all -Dclippy::pedantic

  outdated:
    name: Outdated
    runs-on: ubuntu-latest
    if: github.event_name != 'pull_request'
    steps:
      - uses: actions/checkout@v2
      - uses: dtolnay/install@cargo-outdated
      - run: cargo update
      - run: cargo outdated --exit-code 1

Install newest build of cargo-outdated
Install newest build of cargo-outdated

The old version available by default in the GitHub Actions image fails
with:

    thread 'main' panicked at 'package cache lock is not currently held, Cargo forgot to call `acquire_package_cache_lock` before we got to this stack frame', /usr/share/rust/.cargo/registry/src/github.com-1ecc6299db9ec823/cargo-0.57.0/src/cargo/util/config/mod.rs:1542:9
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
