bake 0.3.0

A containerized build system.
image: ubuntu:18.04
tasks:
  packages:
    command: |
      apt-get update
      apt-get install --yes build-essential curl

  tagref:
    dependencies:
      - packages
    command: |
      set -o pipefail
      curl https://raw.githubusercontent.com/stepchowfun/tagref/master/install.sh -LSfs | VERSION=0.0.8 sh

  user:
    command: adduser --disabled-password --gecos '' user

  rust:
    dependencies:
      - packages
      - user
    user: user
    command: |
      set -o pipefail
      curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain stable-2019-04-25-x86_64-unknown-linux-gnu
      . $HOME/.cargo/env
      rustup component add clippy
      rustup component add rustfmt
      rm -rf "$(dirname "$(rustup which rustc)")/../share"

  tools:
    dependencies:
      - rust
      - tagref

  build:
    dependencies:
      - tools
    paths:
      - Cargo.lock
      - Cargo.toml
      - src
    user: user
    command: |
      . $HOME/.cargo/env
      cargo build

  test:
    dependencies:
      - tools
    user: user
    command:
      . $HOME/.cargo/env
      cargo test

  lint:
    dependencies:
      - tools
    paths:
      - rustfmt.toml
    user: user
    command: |
      . $HOME/.cargo/env
      cargo fmt --all -- --check
      cargo clippy -- --deny clippy::pedantic
      tagref