image: rust:latest

services:
- name: minio/minio
  command: ['server', '/minio']
  alias: minio

variables:
  RUST_BACKTRACE: '1'
  QUICKCHECK_GENERATOR_SIZE: 1572864
  S3_ENDPOINT: http://minio:9000

  # used by minio service
  MINIO_SECRET_KEY: TtnuieannGt2rGuie2t8Tt7urarg5nauedRndrur
  MINIO_ACCESS_KEY: ANTN35UAENTS5UIAEATD
  MINIO_DOMAIN: localhost

.job_template: &template
  script:
  - rustc --version && cargo --version
  - cargo rustc -- -D warnings
  - cargo test --all --verbose

rustfmt:
  services: []
  before_script:
  - rustup component add rustfmt
  script:
  - cargo fmt --all -- --check

test:stable:
  <<: *template

test:native-tls:
  script:
  - rustc --version && cargo --version
  - cargo test --all --verbose --no-default-features --features native-tls

test:beta:
  <<: *template
  before_script:
  - rustup toolchain install beta
  - rustup default beta

test:nightly:
  <<: *template
  image: rustlang/rust:nightly
  services:
  - name: minio/minio:edge
    command: ['server', '/minio']
    alias: minio
  allow_failure: true

clippy:
  services: []
  script:
  - rustc --version && cargo --version
  - rustup component add clippy
  - cargo clippy -- -D clippy::all -D clippy::pedantic -D warnings
