test-stable:
  image: 'rust:latest'
  script:
  - rustc --version && cargo --version      # Print version info for debugging
  - cargo test --tests --verbose --jobs 1
  - cargo test --tests --verbose --jobs 1 --release
  - cargo test --features doctest --doc --verbose --jobs 1
  - cargo test --features doctest --doc --verbose --jobs 1 --release

  - cargo test --no-default-features --tests --verbose --jobs 1
  - cargo test --no-default-features --tests --verbose --jobs 1 --release

  # Disabled, we use some std utilites to enable doctests
  #- cargo test --no-default-features --features doctest --doc --verbose --jobs 1
  #- cargo test --no-default-features --features doctest --doc --verbose --jobs 1 --release
  cache:
    key: stable-build-cache

test-coverage:
  image: 'rust:latest'
  script:
  - cargo install cargo-tarpaulin -f
  - cargo tarpaulin --verbose
  cache:
    key: stable-build-cache

test-nightly:
  image: 'rustlang/rust:nightly'
  script:
  - rustc +nightly --version && cargo +nightly --version      # Print version info for debugging
  - cargo +nightly test --tests --verbose --jobs 1
  - cargo +nightly test --tests --verbose --jobs 1 --release
  - cargo +nightly test --features doctest --doc --verbose --jobs 1
  - cargo +nightly test --features doctest --doc --verbose --jobs 1 --release

  - cargo +nightly test --no-default-features --tests --verbose --jobs 1
  - cargo +nightly test --no-default-features --tests --verbose --jobs 1 --release
  # Disabled, we use some std utilites to enable doctests
  #- cargo +nightly test --no-default-features --features doctest --doc --verbose --jobs 1
  #- cargo +nightly test --no-default-features --features doctest --doc --verbose --jobs 1 --release

  cache:
    key: nightly-build-cache
    paths:
    - target/

docs:
  image: 'rust:latest'
  script:
  - rustc --version && cargo --version
  - cargo doc --no-deps
  cache:
    key: stable-build-cache

clippy:
  image: 'rust:latest'
  before_script:
  - rustup component add clippy
  script:
  - cargo clippy -- -D warnings
  - cargo clippy --no-default-features -- -D warnings
  cache:
    key: stable-build-cache

cache:
  key: stable-build-cache
  paths:
    - target/
