name: Rust

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  linux:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2

    - name: Install deps
      run: wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh && sudo ./llvm.sh 13 && sudo ln -sf /usr/bin/llvm-config-13 /usr/bin/llvm-config

    - name: Run tests
      run: cargo test --verbose
  macos:
    runs-on: macos-latest
    steps:
    - uses: actions/checkout@v2

    - name: Install deps
      run: brew update && brew install llvm@13 && brew upgrade llvm && ln -sf /usr/local/opt/llvm/bin/llvm-config /usr/local/bin/llvm-config

    - name: Run tests
      run: cargo test --verbose
  all_linux_nightly:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2

    - name: Install deps
      run: wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh && sudo ./llvm.sh 13 && sudo ln -sf /usr/bin/llvm-config-13 /usr/bin/llvm-config

    - name: Nightly
      run: rustup toolchain install nightly

    - name: Run tests
      run: cargo +nightly test --verbose --all
  all_macos_nightly:
    runs-on: macos-latest
    steps:
    - uses: actions/checkout@v2

    - name: Install deps
      run: brew update && brew install llvm@13 && brew upgrade llvm && ln -sf /usr/local/opt/llvm/bin/llvm-config /usr/local/bin/llvm-config

    - name: Nightly
      run: rustup toolchain install nightly

    - name: Run tests
      run: cargo +nightly test --verbose --all
  clippy:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2

    - name: Install deps
      run: wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh && sudo ./llvm.sh 13 && sudo ln -sf /usr/bin/llvm-config-13 /usr/bin/llvm-config

    - name: Nightly
      run: rustup toolchain install nightly --profile=default

    - name: Run tests
      run: cargo +nightly clippy --all


