name: Build Status

on:
  # Build on all pushes
  push:

  # Build for any PRs.
  pull_request:

jobs:
  # Push image to GitHub Packages. No "testing" because this is a heavy image
  # See also https://docs.docker.com/docker-hub/builds/
  build:
    runs-on: ubuntu-latest
    if: github.event_name == 'push'
    strategy:
      matrix:
        operation: ["clippy", "test"]
        featsync: ["", "async"]
    steps:
      - uses: actions/checkout@v2

      - name: ${{matrix.operation}} ${{matrix.featsync}}
        run: docker run -v cargo-cache:/root/.cargo/registry -v $PWD:/volume --rm -t ghcr.io/polyverse/rust-dev-env/rust-dev-env:latest cargo ${{matrix.operation}} --all --features="${{matrix.featsync}}"
