-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
88 lines (82 loc) · 4.02 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
stages:
- test
- coverage
- build
- deploy
jest:
stage: test
image: node:12-alpine
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- node_modules/
script:
- npm install
- npm run test
coverage: '/All files[^|]*\|[^|]*\s([\d.]+)/'
artifacts:
paths:
- coverage/
reports:
junit: 'coverage/junit.xml'
expire_in: 1 week
only:
- master
pages:
stage: coverage
image: alpine
cache: {}
script:
- ls -al coverage/
- test -f coverage/lcov-report/index.html && rm -rf public/* && mv coverage/lcov-report/ public/
- ls -al public/
artifacts:
paths:
- public/
expire_in: 1 hour
only:
- master
build:
image: google/cloud-sdk:alpine
before_script:
- gcloud config set project $GOOGLE_CLOUD_PROJECT
- gcloud auth activate-service-account --key-file $GOOGLE_CLOUD_CREDENTIALS
- gcloud config set app/cloud_build_timeout 4800
stage: build
script:
- gcloud builds submit --tag gcr.io/$GOOGLE_CLOUD_PROJECT/gcs-radio
only:
- master
deploy:
image: google/cloud-sdk:alpine
before_script:
- gcloud config set project $GOOGLE_CLOUD_PROJECT
- gcloud auth activate-service-account --key-file $GOOGLE_CLOUD_CREDENTIALS
- gcloud config set app/cloud_build_timeout 4800
stage: deploy
script:
- gcloud run deploy gcs-radio --image gcr.io/$GOOGLE_CLOUD_PROJECT/gcs-radio --platform managed --region us-west1 --allow-unauthenticated --concurrency 8 --cpu 2 --memory 256M --set-env-vars="DB_CONNECTION=$DB_CONNECTION" --set-env-vars="SPOTIFY_ID=$SPOTIFY_ID" --set-env-vars="SPOTIFY_SECRET=$SPOTIFY_SECRET" --set-env-vars="VERBOSE=false" --set-env-vars="YTDL_COOKIE=$YTDL_COOKIE" --set-env-vars="TOKEN_SECRET=$TOKEN_SECRET" --set-env-vars="GOOGLE_CLIENT_ID=$GOOGLE_CLIENT_ID" --set-env-vars="GOOGLE_CLIENT_SECRET=$GOOGLE_CLIENT_SECRET" --set-env-vars="GOOGLE_CLOUD_PROJECT=$GOOGLE_CLOUD_PROJECT" --set-env-vars="SENDGRID_API_KEY=$SENDGRID_API_KEY" --set-env-vars="MATCH_WITH_YOUTUBE=$MATCH_WITH_YOUTUBE" --set-env-vars="DEFAULT_AUDIO_ID=$DEFAULT_AUDIO_ID" --set-env-vars="MATCH_WITH_MUSICKIT=$MATCH_WITH_MUSICKIT" --set-env-vars="MUSIC_KIT_SECRET=$MUSIC_KIT_SECRET" --set-env-vars="MUSIC_KIT_KEY_ID=$MUSIC_KIT_KEY_ID" --set-env-vars="MUSIC_KIT_TEAM_ID=$MUSIC_KIT_TEAM_ID" --timeout=899s
only:
- master
build-beta:
image: google/cloud-sdk:alpine
before_script:
- gcloud config set project $GOOGLE_CLOUD_PROJECT
- gcloud auth activate-service-account --key-file $GOOGLE_CLOUD_CREDENTIALS
- gcloud config set app/cloud_build_timeout 4800
stage: build
script:
- gcloud builds submit --tag gcr.io/$GOOGLE_CLOUD_PROJECT/gcs-radio-beta
only:
- beta
deploy-beta:
image: google/cloud-sdk:alpine
before_script:
- gcloud config set project $GOOGLE_CLOUD_PROJECT
- gcloud auth activate-service-account --key-file $GOOGLE_CLOUD_CREDENTIALS
- gcloud config set app/cloud_build_timeout 4800
stage: deploy
script:
- gcloud run deploy gcs-radio-beta --image gcr.io/$GOOGLE_CLOUD_PROJECT/gcs-radio-beta --platform managed --region us-west1 --allow-unauthenticated --concurrency 1 --cpu 1 --memory 256M --max-instances 4 --set-env-vars="DB_CONNECTION=$DB_CONNECTION" --set-env-vars="SPOTIFY_ID=$SPOTIFY_ID" --set-env-vars="SPOTIFY_SECRET=$SPOTIFY_SECRET" --set-env-vars="VERBOSE=true" --set-env-vars="YTDL_COOKIE=$YTDL_COOKIE" --set-env-vars="TOKEN_SECRET=$TOKEN_SECRET" --set-env-vars="GOOGLE_CLIENT_ID=$GOOGLE_CLIENT_ID" --set-env-vars="GOOGLE_CLIENT_SECRET=$GOOGLE_CLIENT_SECRET" --set-env-vars="GOOGLE_CLOUD_PROJECT=$GOOGLE_CLOUD_PROJECT" --set-env-vars="SENDGRID_API_KEY=$SENDGRID_API_KEY" --set-env-vars="MATCH_WITH_YOUTUBE=$MATCH_WITH_YOUTUBE" --set-env-vars="DEFAULT_AUDIO_ID=$DEFAULT_AUDIO_ID"--set-env-vars="MATCH_WITH_MUSICKIT=$MATCH_WITH_MUSICKIT" --set-env-vars="MUSIC_KIT_SECRET=$MUSIC_KIT_SECRET" --set-env-vars="MUSIC_KIT_KEY_ID=$MUSIC_KIT_KEY_ID" --set-env-vars="MUSIC_KIT_TEAM_ID=$MUSIC_KIT_TEAM_ID"
only:
- beta