.gitlab-ci.yml 1.4 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
    - cargo test --features "strict" --verbose
30
31
    - make clippy
    - cargo +nightly fmt -- --check
Robert Czechowski's avatar
Robert Czechowski committed
32
33
34
35
36

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

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