stages:
  - build
  - test
  - publish

build:
  tags:
    - linux
  stage: build
  image: rust:latest
  script:
    - cargo build

rustdoc:
  tags:
    - linux
  stage: build
  image: rust:latest
  script:
    - cargo doc
  artifacts:
    paths:
      - target/doc

unit-test:
  tags:
    - linux
  stage: test  
  image: rust:latest
  script:
    - cargo test --lib

lint-test:  
  tags:
    - linux
  stage: test
  image: rust:latest
  script:
    - rustup component add clippy
    - cargo clippy

docs:
  tags:
    - linux
  stage: publish
  image: alpine
  dependencies:
    - rustdoc
  script:
    - mkdir -p public
    - mv target/doc public/doc
  artifacts:
    paths:
      - public
  only:
    - master