stages:
  - build_and_test

build:nightly:
  stage: build_and_test
  script:
    - curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain nightly
    - source $HOME/.cargo/env
    - rustup component add clippy-preview
    - cargo build --features integration-test,nightly --all-targets
    - mkdir /sys/fs/cgroup/{cpuacct,memory,pids}/ia-sandbox
    - cargo test --features nightly -v
    - cargo clippy --features nightly --all-targets

build:stable:
  stage: build_and_test
  script:
    - curl https://sh.rustup.rs -sSf | sh -s -- -y
    - source $HOME/.cargo/env
    - rustup component add rustfmt-preview
    - cargo build --features integration-test --all-targets
    - mkdir /sys/fs/cgroup/{cpuacct,memory,pids}/ia-sandbox
    - cargo test -v
    - cargo fmt -- --check

build:beta:
  stage: build_and_test
  script:
    - curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain beta
    - source $HOME/.cargo/env
    - cargo build --features integration-test --all-targets
    - mkdir /sys/fs/cgroup/{cpuacct,memory,pids}/ia-sandbox
    - cargo test -v

build:nightly:minimal:
  stage: build_and_test
  script:
    - curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain nightly
    - source $HOME/.cargo/env
    - cargo build --features integration-test,nightly --all-targets -Z minimal-versions
    - mkdir /sys/fs/cgroup/{cpuacct,memory,pids}/ia-sandbox
    - cargo test --features nightly -v
