.gitlab-ci.yml 1.58 KB
Newer Older
Robert Czechowski's avatar
Robert Czechowski committed
1
2
3
4
5
6
image: 'rust:latest'

stages:
  - test
  - doc
  - build
7
  - deploy
Robert Czechowski's avatar
Robert Czechowski committed
8
9
10
11
12
13
14

variables:
  CARGO_HOME: $CI_PROJECT_DIR/cargo
  APT_CACHE_DIR: $CI_PROJECT_DIR/apt

before_script:
  - apt-get update -yq
15
16
  - rustup component add clippy
  - rustup component add rustfmt
17
18
19
  # Setup SSH deploy keys
  - 'which ssh-agent || ( apt-get install -qq openssh-client )'
  - eval $(ssh-agent -s)
20
  - ssh-add <(echo "$SSH_PRIVATE_KEY" | base64 -d)
21
22
  - mkdir -p ~/.ssh
  - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
Robert Czechowski's avatar
Robert Czechowski committed
23
24
25
26
27
28

test:
  stage: test
  script:
    - rustc --version
    - cargo --version
29
30
    - cargo test --features "strict" --verbose
    - cargo clippy --all-targets --all-features -- -D warnings -A clippy::redundant_field_names -A clippy::useless_format -A clippy::let_and_return -A clippy::type_complexity -A clippy::option_map_unit_fn -A clippy::too_many_arguments
Robert Czechowski's avatar
Robert Czechowski committed
31
32
33
34
35

pages:
  stage: doc
  script:
    - cargo doc --no-deps
36
    - echo '<meta http-equiv="refresh" content="0; url=medal">' > target/doc/index.html
Robert Czechowski's avatar
Robert Czechowski committed
37
38
  only:
    - master
39
    
40
41
42
43
44
45
46
47
48
build:
  stage: build
  script:
    - cargo build --release
  only:
    - master
    
deploy:
  stage: deploy
49
  script:
50
51
    - ssh medald@jim.test.bwinf.de "sudo /bin/systemctl stop medal && exit"
    - "scp target/release/medal medald@jim.test.bwinf.de:medal/"
52
53
    - "scp -r migrations static templates medald@jim.test.bwinf.de:medal/"
    - "scp -r target/doc medald@jim.test.bwinf.de:medal/"
54
    - ssh medald@jim.test.bwinf.de "sudo /bin/systemctl start medal && exit"
55
56
  only:
    - master
Robert Czechowski's avatar
Robert Czechowski committed
57
58
59
60
61
62
63

cache:
  paths:
    - apt/
    - cargo/
    - target/