forked from Substra/substra-backend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
47 lines (38 loc) · 1.94 KB
/
.travis.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
language: python
python:
- '3.7'
cache: pip
branches:
only:
- master
- dev
env:
- DJANGO_SETTINGS_MODULE=backend.settings.test
addons:
snaps:
- name: helm
confinement: classic
channel: stable
before_script:
- helm init
install: pip install -r backend/requirements.txt
script:
- helm lint charts/substra-backend
- cd backend
- pip install flake8
- flake8
- coverage run manage.py test
- cd ..
after_script:
- 'if ! git diff --quiet --exit-code $TRAVIS_COMMIT_RANGE charts; then CHART_CHANGED="true"; else CHART_CHANGED="false"; fi'
- 'if [ "$CHART_CHANGED" == "true" -a "$TRAVIS_PULL_REQUEST" == "false" ]; then helm dep update charts/substra-backend; fi'
- 'if [ "$CHART_CHANGED" == "true" -a "$TRAVIS_PULL_REQUEST" == "false" ]; then helm package charts/substra-backend; fi'
- 'if [ "$CHART_CHANGED" == "true" -a "$TRAVIS_PULL_REQUEST" == "false" ]; then git config --global user.email "[email protected]"; fi'
- 'if [ "$CHART_CHANGED" == "true" -a "$TRAVIS_PULL_REQUEST" == "false" ]; then git config --global user.name "Travis CI"; fi'
- 'if [ "$CHART_CHANGED" == "true" -a "$TRAVIS_PULL_REQUEST" == "false" ]; then git clone https://${GH_TOKEN}@github.com/SubstraFoundation/charts.git substra-charts; fi'
- 'if [ "$CHART_CHANGED" == "true" -a "$TRAVIS_PULL_REQUEST" == "false" ]; then mv substra-backend-* substra-charts/; fi'
- 'if [ "$CHART_CHANGED" == "true" -a "$TRAVIS_PULL_REQUEST" == "false" ]; then cd substra-charts; fi'
- 'if [ "$CHART_CHANGED" == "true" -a "$TRAVIS_PULL_REQUEST" == "false" ]; then helm repo index .; fi'
- 'if [ "$CHART_CHANGED" == "true" -a "$TRAVIS_PULL_REQUEST" == "false" ]; then git add .; fi'
- 'if [ "$CHART_CHANGED" == "true" -a "$TRAVIS_PULL_REQUEST" == "false" ]; then git commit --message "Travis build: $TRAVIS_BUILD_NUMBER"; fi'
- 'if [ "$CHART_CHANGED" == "true" -a "$TRAVIS_PULL_REQUEST" == "false" ]; then git push --quiet --set-upstream origin master; fi'