| 1 | image: rust |
| 2 | |
| 3 | stages: |
| 4 | - check |
| 5 | - test |
| 6 | - deploy |
| 7 | |
| 8 | variables: |
| 9 | CARGO_HOME: $CI_PROJECT_DIR/.cargo_cache |
| 10 | |
| 11 | .cargo: |
| 12 | before_script: |
| 13 | - rustc --version && cargo --version |
| 14 | cache: |
| 15 | paths: |
| 16 | - $CARGO_HOME |
| 17 | - target/ |
| 18 | |
| 19 | check: |
| 20 | extends: .cargo |
| 21 | stage: check |
| 22 | script: |
| 23 | - rustup component add clippy |
| 24 | - rustup component add rustfmt |
| 25 | - cargo clippy -- -D warnings |
| 26 | - cargo fmt --all --check |
| 27 | |
| 28 | test: |
| 29 | extends: .cargo |
| 30 | stage: test |
| 31 | script: |
| 32 | - cargo test |
| 33 | |
| 34 | pages: |
| 35 | extends: .cargo |
| 36 | stage: deploy |
| 37 | only: |
| 38 | - master |
| 39 | script: |
| 40 | - cargo doc --no-deps |
| 41 | - rm -rf public |
| 42 | - mv target/doc/ public |
| 43 | artifacts: |
| 44 | paths: |
| 45 | - public |