-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
69 lines (66 loc) · 4.45 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
language: javascript
node_js: 12
git:
depth: false
branches:
only:
- master
- develop
- /^feature.*/
env:
global:
- VERSION=${TRAVIS_COMMIT:0:8}
- BRANCH=$TRAVIS_BRANCH
- PROJECT_NAME=opensiddur-client
- INSTANCE_BASE=${PROJECT_NAME}-compiler-${BRANCH//\//-}
- INSTANCE_NAME=${INSTANCE_BASE}-${VERSION}
- ZONE=us-west2-a
- MACHINE_TYPE=g1-small
- IMAGE_PROJECT=ubuntu-os-cloud
- IMAGE_VERSION=ubuntu-2004
- BOOT_DISK_SIZE_GB=20
- SERVICE_ACCOUNT=opensiddur-deploy-1@opensiddur-client.iam.gserviceaccount.com
# DYN_EMAIL
- secure: "ZUN56scxYuPmpoRkmbcv1+kiZPPX3CT4RkL6hmkA3GEIMaNtRvvEHfbxX+xT+f1Yqrqn+mcpB+Y+4BV/YWDi5bGbFDrwY59BWghktcO7iIGNPBbJZc4U+Wx6LMgGy92BT3+I9+hFgNHa8hEBcHZ7s6QTW8Mv/8ngSVfbJjd5fxN8a1fEzhdD1H+3x8FAliv01DFa51z0jOR5ej8SLmT2c+B7UVwEQrwGheGs67YO57jhvJAegMQfMoVT7UFDurNuRXbJ2Jckl6HsHFWYWfN0sywudps0rtUTdAbmxdCxHj5xx9ZC1kN4PS2EUZGaAigrqU0gaRXGWFgJNQn08x9EaU8rQ0UTgeEUI9TxCukjP9uSs+pTgGD0uFZZvK7TvRkXBoK38ZsEQGEsFn6eoyiZHXYAPS9GaPAg6CtCQyQ+Wc3rg4cTE667NmJBSF02AtG1Bs3diRXfTFhWQeI/ENwOYmM651B1jCYttXp0qm45WM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hcEOTGilkT74WPBN1IbGw0c50pyuYk0AeeuVk9Lfv7XbF/2kOMfF/Z2AZIbKeGH0bonBhJQbkNm45S+d+0YcfAbzUTZeRCQ56qXf4gNbkkZv1KVU7nHnv0UnBhbVJ9kRwH51WtZ05k9DG6cl7lel4Waiy3cseSLdZMepamFMD1KbE6Auz2yo427zl9CYKY++QNKE6iemywFw9lqmpjId6aYZSuGCNSc85IdqOoRTV1YZk9JAQ9QIJMNVGTOeilfsVrRjSTIdg8nhvYTn35FNd+Cm9rxYozrjK3vMy0N2nf0APYn2CQQRyFEdoXt2NTj4B5UrF/SWlF8Dz2hwsAFZlZrzxzAWo8iKMPXA4Vb8Rst8Dn730TuIGzcS+n7/LGOipBwh+E1K0ZZp+/XPVs/6HYrzWXu9eK9AHiB3F/WTUXLUyMgwP/SLwoAL/DHEfsXx/QjFo7vhl5KM8i+e9dRvT5wSbWvl5WHIzqKCmYXhdKwYNs9SAahElLmHBfi0Z8GjFLger1gCLqrIKUdrocM="
before_install:
- echo -e "machine github.com\n login $GITHUB_TOKEN" > ~/.netrc
- git lfs pull
- export CLOUD_SDK_REPO="cloud-sdk-$(lsb_release -c -s)"
- echo "deb http://packages.cloud.google.com/apt $CLOUD_SDK_REPO main" | sudo tee
-a /etc/apt/sources.list.d/google-cloud-sdk.list
- curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add
- sudo apt-get update -y
- sudo apt-get install -y google-cloud-sdk
- openssl aes-256-cbc -K $encrypted_33f4d3c408f1_key -iv $encrypted_33f4d3c408f1_iv
-in credentials.tar.gz.enc -out credentials.tar.gz -d
- tar zxvf credentials.tar.gz
- gcloud auth activate-service-account --key-file=client-secret.json
- gcloud config set project ${PROJECT_NAME}
- ssh-keygen -q -N "" -f ~/.ssh/google_compute_engine
- npm install
# CI defaults to true and treats warnings as errors
script:
- CI=false npm run build
- |
npm test &&
gcloud compute \
--project=${PROJECT_NAME} instances create ${INSTANCE_NAME} \
--zone=${ZONE} \
--machine-type=${MACHINE_TYPE} \
--network=default \
--network-tier=PREMIUM \
--maintenance-policy=MIGRATE \
--scopes=https://www.googleapis.com/auth/cloud-platform \
--tags=http-server,https-server \
--image=$(gcloud compute images list --filter=${IMAGE_PROJECT} --filter=${IMAGE_VERSION} | tail -n 1 | cut -f 1 -d " ") \
--image-project=${IMAGE_PROJECT} \
--boot-disk-size=${BOOT_DISK_SIZE_GB}GB \
--boot-disk-type=pd-standard \
--boot-disk-device-name=${INSTANCE_NAME} \
--service-account=${SERVICE_ACCOUNT} \
--metadata-from-file startup-script=setup/gcloud-startup-script.sh \
--metadata BRANCH=${BRANCH},DYN_USERNAME=${DYN_USERNAME},DYN_PASSWORD=${DYN_PASSWORD},DYN_EMAIL=${DYN_EMAIL},enable-oslogin=true