|
3 | 3 | # |
4 | 4 | # For technical details, see http://travis-ci.org/ |
5 | 5 | # |
6 | | -branches: |
7 | | - except: |
8 | | - - docs |
9 | | - |
10 | 6 | dist: bionic |
11 | | -addons: |
12 | | - apt: |
13 | | - sources: |
14 | | - - ppa:ubuntugis/ppa |
15 | | - update: true |
16 | | - packages: |
17 | | - - gdal-bin |
18 | | - - python-gdal |
19 | | - - python3-gdal |
20 | | - - libgdal-dev |
21 | | - |
22 | 7 | language: python |
23 | 8 | python: |
24 | 9 | - "3.6" |
25 | | -virtualenv: |
26 | | - system_site_packages: true |
27 | | - |
28 | 10 | services: |
29 | 11 | - docker |
| 12 | +addons: |
| 13 | + ssh_known_hosts: |
| 14 | + - 35.190.148.87 # Development server |
| 15 | +env: |
| 16 | + - ANSIBLE_CONFIG=ansible/ansible.cfg |
30 | 17 |
|
31 | 18 | before_install: |
32 | | - - echo "$SERVICE_ACCOUNT_KEY" > mapswipe_workers/serviceAccountKey.json |
33 | | - - echo "MOCK_SERVICE_ACCOUNT_KEY" > postgres/serviceAccountKey.json |
| 19 | + - openssl aes-256-cbc -K $encrypted_444bb228fd3f_key -iv $encrypted_444bb228fd3f_iv -in travis/ci-mapswipe-firebase-adminsdk-80fzw-21ddcd1649.json.enc -out mapswipe_workers/serviceAccountKey.json -d |
| 20 | + # Create a mock file for wal-g setup |
| 21 | + - touch postgres/serviceAccountKey.json |
34 | 22 |
|
35 | 23 | install: |
36 | 24 | - pip install --upgrade pip setuptools |
37 | | - - pip install flake8 black |
| 25 | + - pip install black==19.10b0 flake8==3.8.3 isort==5.5.2 |
| 26 | + # Install ansible for automated deployment |
| 27 | + - sudo apt-get --quiet update |
| 28 | + - sudo apt-get --yes install software-properties-common |
| 29 | + - sudo apt-add-repository --yes --update ppa:ansible/ansible |
| 30 | + - sudo apt-get --yes install ansible |
38 | 31 |
|
39 | 32 | script: |
| 33 | + - black --check mapswipe_workers |
| 34 | + - flake8 --count --config mapswipe_workers/setup.cfg mapswipe_workers |
| 35 | + - isort --check --settings-file mapswipe_workers/setup.cfg mapswipe_workers |
40 | 36 | - docker-compose up --build --detach firebase_deploy |
| 37 | + - docker-compose up --build --detach postgres |
41 | 38 | - docker-compose run mapswipe_workers python -m unittest discover --verbose --start-directory tests/unittests/ |
42 | | - #- docker-compose run mapswipe_workers python -m unittest discover --verbose --start-directory tests/integration/ |
43 | | - # - TODO: Run black and flake8 |
44 | | - |
45 | | -# before_deploy: |
46 | | -# # SSH setup to deploy to server after build. |
47 | | -# - apk add openssh-client |
48 | | -# - mkdir -p ~/.ssh |
49 | | -# - chmod 700 ~/.ssh |
50 | | -# - eval "$(ssh-agent -s)" |
51 | | -# - export KEY_FILE=~/.ssh/api_server_ssh_key |
52 | | -# - echo "$DEPLOYMENT_SERVER_PRIVATE_KEY" | tr -d '\r' > $KEY_FILE |
53 | | -# - chmod 600 $KEY_FILE |
54 | | -# - ssh-add $KEY_FILE > /dev/null |
55 | | -# - ssh-keyscan -H "$DEPLOYMENT_SERVER_IP" >> ~/.ssh/known_hosts |
56 | | -# - chmod 644 ~/.ssh/known_hosts |
57 | | -# - ssh -i $KEY_FILE -o StrictHostKeyChecking=no "mapswipe@$DEPLOYMENT_SERVER_IP" |
58 | | - |
59 | | -# deploy: |
60 | | -# provider: script |
61 | | -# script: bash scripts/deploy.sh |
62 | | -# on: |
63 | | -# branch: dev |
64 | | - |
| 39 | + - docker-compose run mapswipe_workers python -m unittest discover --verbose --start-directory tests/integration/ |
| 40 | + |
| 41 | +after_success: |
| 42 | + # Deploy to development server using Ansible |
| 43 | + # SSH setup to deploy to server after build. |
| 44 | + - apk add openssh-client |
| 45 | + - eval "$(ssh-agent -s)" #start the ssh agent |
| 46 | + - mkdir -p $HOME/.ssh |
| 47 | + # - chmod 700 $HOME/.ssh |
| 48 | + - cp travis/ssh_config $HOME/.ssh/config |
| 49 | + - openssl aes-256-cbc -K $encrypted_c17fa81e6490_key -iv $encrypted_c17fa81e6490_iv -in travis/ssh-private-key.enc -out $HOME/.ssh/private-key -d |
| 50 | + - chmod 600 $HOME/.ssh/private-key |
| 51 | + - ssh-add $HOME/.ssh/private-key |
| 52 | + - chmod +x deploy.sh |
| 53 | + |
| 54 | +deploy: |
| 55 | + provider: script |
| 56 | + script: bash deploy.sh |
| 57 | + on: |
| 58 | + branch: dev |
0 commit comments