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
    - cargo build --features integration-test,nightly --all-targets --release
    - 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
    - cargo build --features integration-test --all-targets --release
    - mkdir /sys/fs/cgroup/{cpuacct,memory,pids}/ia-sandbox
    - cargo test -v
    - cargo fmt -- --write-mode check

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
    - cargo build --features integration-test,nightly --all-targets --release
    - 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
    - cargo build --features integration-test --all-targets --release
    - mkdir /sys/fs/cgroup/{cpuacct,memory,pids}/ia-sandbox
    - cargo test -v
    - cargo fmt -- --write-mode 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
    - cargo build --features integration-test --all-targets --release
    - mkdir /sys/fs/cgroup/{cpuacct,memory,pids}/ia-sandbox
    - cargo test -v

Test on beta as well
Test on beta as well
