-
Notifications
You must be signed in to change notification settings - Fork 129
/
.gitlab-ci.yml
105 lines (96 loc) · 3.61 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
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
image: python:3.6-stretch
stages:
- lint
- test
- staging
- verify_staging
- deploy
- verify
lint:
stage: lint
script:
- pip install --upgrade .[test]
- black --check server/
cache:
paths:
- ~/.cache/pip # Cache dir according to https://pip.pypa.io/en/stable/reference/pip_install/#caching
- /root/.cache/pip/ # Cache dir from an example pipeline run https://gitlab.com/glitzdev/glitz_hub/-/jobs/145930238
test:
stage: test
script:
- pip install --upgrade .[test]
- pytest --cov-config=./setup.cfg
cache:
paths:
- ~/.cache/pip # Cache dir according to https://pip.pypa.io/en/stable/reference/pip_install/#caching
- /root/.cache/pip/ # Cache dir from an example pipeline run https://gitlab.com/glitzdev/glitz_hub/-/jobs/145930238
staging:
stage: staging
script:
- git push -f -q https://heroku:[email protected]/$STAGING_HEROKU_APP_NAME.git HEAD:master
- >-
curl -n -s -X PATCH https://api.heroku.com/apps/$STAGING_HEROKU_APP_NAME/config-vars
-d '{
"STAGING_DATABASE_URL": "'"$STAGING_DATABASE_URL"'",
"CLOUDINARY_URL": "'"$CLOUDINARY_URL"'",
"FLASK_ENV": "'"$STAGING_FLASK_ENV"'",
"FACEBOOK_CLIENT_ID": "'"$FACEBOOK_CLIENT_ID"'",
"FACEBOOK_CLIENT_SECRET": "'"$FACEBOOK_CLIENT_SECRET"'",
"FACEBOOK_TOKEN": "'"$FACEBOOK_TOKEN"'",
"FLASK_APP": "'"$FLASK_APP"'",
"SECRET_JWT": "'"$SECRET_JWT"'",
"FIREBASE_JSON": "'"$FIREBASE_JSON"'",
"RECEIPTS_API_KEY": "'"$STAGING_RECEIPTS_API_KEY"'",
"GOOGLE_MAPS_API_KEY": "'"$GOOGLE_MAPS_API_KEY"'",
"RECEIPT_URL": "'"$STAGING_RECEIPT_URL"'"
}'
-H "Content-Type: application/json"
-H "Accept: application/vnd.heroku+json; version=3"
-H "Authorization: Bearer $HEROKU_API_KEY" > /dev/null
when: on_success
environment:
name: staging
only:
- staging
verify_staging:
stage: verify_staging
script:
- curl --fail https://staging-dryvo.herokuapp.com || exit 1
when: on_success
only:
- staging
deploy:
stage: deploy
script:
- git push -f -q https://heroku:[email protected]/$PRODUCTION_HEROKU_APP_NAME.git HEAD:master
- >-
curl -n -s -X PATCH https://api.heroku.com/apps/$PRODUCTION_HEROKU_APP_NAME/config-vars
-d '{
"PRODUCTION_DATABASE_URL": "'"$PRODUCTION_DATABASE_URL"'",
"CLOUDINARY_URL": "'"$CLOUDINARY_URL"'",
"FLASK_ENV": "'"$PRODUCTION_FLASK_ENV"'",
"FACEBOOK_CLIENT_ID": "'"$FACEBOOK_CLIENT_ID"'",
"FACEBOOK_CLIENT_SECRET": "'"$FACEBOOK_CLIENT_SECRET"'",
"FACEBOOK_TOKEN": "'"$FACEBOOK_TOKEN"'",
"FLASK_APP": "'"$FLASK_APP"'",
"SECRET_JWT": "'"$SECRET_JWT"'",
"FIREBASE_JSON": "'"$FIREBASE_JSON"'",
"RECEIPTS_API_KEY": "'"$PRODUCTION_RECEIPTS_API_KEY"'",
"GOOGLE_MAPS_API_KEY": "'"$GOOGLE_MAPS_API_KEY"'",
"RECEIPT_URL": "'"$PRODUCTION_RECEIPT_URL"'"
}'
-H "Content-Type: application/json"
-H "Accept: application/vnd.heroku+json; version=3"
-H "Authorization: Bearer $HEROKU_API_KEY" > /dev/null
when: on_success
environment:
name: production
only:
- production
verify:
stage: verify
script:
- curl --fail https://dryvo.herokuapp.com || exit 1
when: on_success
only:
- production