-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
35 lines (31 loc) · 1.13 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
image: gruunday/opencv-python3:latest
before_script:
# Setup SSH deploy keys
- 'which ssh-agent || ( apt-get install -qq openssh-client )'
- eval $(ssh-agent -s)
- ssh-add <(echo "$PROD_SSH_KEY")
- mkdir -p ~/.ssh
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
test:
stage: build
script:
- pip3 install -r requirements.txt
- python3 -V
- cd src/ && mv default_config.py config.py
- mkdir tmp/
- coverage run --source=. -m unittest discover -v
- coverage report -m
deploy:
stage: test
script:
- cd src/
- rsync -r -v -e ssh . [email protected]:/home/greenday/prod/
- chmod +x deployment_tools/deploy.sh
- ssh [email protected] DBNAME=$DBNAME DBPASSWORD=$DBPASSWORD DBHOST=$DBHOST DBUSER=$DBUSER DBPORT=$DBPORT 'bash -s' < deployment_tools/deploy.sh
test_deployment:
stage: deploy
script:
- cd src/
- pip3 install requests
- chmod +x configen.sh && ./configen.sh && mv config.py deployment_tools/
- python3 deployment_tools/deploy_test.py