forked from greenelab/connectivity-search-backend
/
config.yml
69 lines (64 loc) · 2.01 KB
/
config.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
version: 2
jobs:
tests:
docker:
# Primary docker container where the tests will be run
- image: ubuntu:18.04
# Secondary docker container for database service
- image: postgres:10.6
environment:
POSTGRES_USER: circleci
working_directory: ~/hetmech-backend
steps:
- checkout
- run:
name: OS update
command: |
apt update && apt upgrade --yes
- run:
name: Set up Postgres
command: |
apt install postgresql-client --yes
createdb --host=localhost --username=circleci circleci_test
cp .circleci/ci_secrets.yml dj_hetmech/secrets.yml
- run:
name: Install miniconda
working_directory: ~/
command: |
apt install git wget --yes
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh --output-document miniconda.sh
bash miniconda.sh -b -p $HOME/miniconda
source $HOME/miniconda/etc/profile.d/conda.sh
# gcc is required for "pip install git+https://..."
apt install gcc --yes
conda env create --quiet --file ~/hetmech-backend/environment.yml
echo "source $HOME/miniconda/etc/profile.d/conda.sh" >> $BASH_ENV
echo "conda activate hetmech-backend" >> $BASH_ENV
- run:
name: Backend tests
command: |
python manage.py makemigrations dj_hetmech_app
python manage.py migrate
python manage.py test
deploy:
machine:
enabled: true
steps:
- add_ssh_keys:
fingerprints:
- "a5:38:b8:18:7c:68:fc:9d:75:82:e7:2c:f4:04:1c:7e"
- run:
name: Deploy Over SSH
command: |
ssh $SSH_USER@$SSH_HOST "bash ~/hetmech-backend/.circleci/deploy.sh"
workflows:
version: 2
test:
jobs:
- tests
- deploy:
requires:
- tests
filters:
branches:
only: master