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

stages:
  - test
  - build
6
  - deploy
Robert Czechowski's avatar
Robert Czechowski committed
7 8 9 10

variables:
  CARGO_HOME: $CI_PROJECT_DIR/cargo
  APT_CACHE_DIR: $CI_PROJECT_DIR/apt
11
  CACHE_COMPRESSION_LEVEL: 0
Robert Czechowski's avatar
Robert Czechowski committed
12 13


Robert Czechowski's avatar
Robert Czechowski committed
14

15
test:
Robert Czechowski's avatar
Robert Czechowski committed
16 17 18 19
  stage: test
  script:
    - rustc --version
    - cargo --version
20
    - make stricttest
21
    - rustup component add clippy
22
    - make clippy
Robert Czechowski's avatar
Robert Czechowski committed
23

Robert Czechowski's avatar
Robert Czechowski committed
24 25


26 27 28
build:
  stage: build
  script:
29
    - make dynrelease
30
    - make doc
Robert Czechowski's avatar
Robert Czechowski committed
31 32 33 34 35 36
    # Setup SSH deploy keys
    - 'which ssh-agent || ( apt-get install -qq openssh-client )'
    - eval $(ssh-agent -s)
    - ssh-add <(echo "$SSH_PRIVATE_KEY" | base64 -d)
    - mkdir -p ~/.ssh
    - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
37
    # Stop server and upload
38
    - ssh medald@jim.test.bwinf.de "sudo /bin/systemctl stop medal && sudo /bin/systemctl stop medalp && sudo /bin/systemctl stop medal-nachtermin"
39
    - "scp target/release/medal medald@jim.test.bwinf.de:medal/"
Robert Czechowski's avatar
Robert Czechowski committed
40
    - "scp -r migrations static templates export target/doc medald@jim.test.bwinf.de:medal/"
41
    - "scp -r tasks/jwinf/wrapper.html medald@jim.test.bwinf.de:medal/tasks/jwinf/"
42
    - "scp -r tasks/jwinf/pythonwrapper.html medald@jim.test.bwinf.de:medal/tasks/jwinf/"
43
    - ssh medald@jim.test.bwinf.de "sudo /bin/systemctl start medal && sudo /bin/systemctl start medalp && sudo /bin/systemctl start medal-nachtermin"
44 45
  only:
    - master
46 47 48 49 50 51 52 53 54 55 56 57 58 59
    - deploy



deploy:
  stage: deploy
  script:   
    # Setup SSH deploy keys
    - 'which ssh-agent || ( apt-get install -qq openssh-client )'
    - eval $(ssh-agent -s)
    - ssh-add <(echo "$SSH_PRIVATE_DEPLOY_KEY" | base64 -d)
    - mkdir -p ~/.ssh
    - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
    # Stop server and upload
60
    - ssh medald@jwinf.de "sudo /bin/systemctl stop medal && sudo /bin/systemctl stop medal1 && sudo /bin/systemctl stop medal2 && sudo /bin/systemctl stop medal3"
61
    - "scp target/release/medal medald@jwinf.de:medal/"
Robert Czechowski's avatar
Robert Czechowski committed
62
    - "scp -r migrations static templates export target/doc medald@jwinf.de:medal/"
63
    - "scp -r tasks/jwinf/wrapper.html medald@jwinf.de:medal/tasks/jwinf/"
64
    - "scp -r tasks/jwinf/pythonwrapper.html medald@jwinf.de:medal/tasks/jwinf/"
65
    - ssh medald@jwinf.de "sudo /bin/systemctl start medal && sudo /bin/systemctl start medal1 && sudo /bin/systemctl start medal2 && sudo /bin/systemctl start medal3"
66 67
  only:
    - deploy
Robert Czechowski's avatar
Robert Czechowski committed
68

Robert Czechowski's avatar
Robert Czechowski committed
69 70


Robert Czechowski's avatar
Robert Czechowski committed
71 72 73 74 75 76
cache:
  paths:
    - apt/
    - cargo/
    - target/