forked from serverless/serverless
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
227 lines (207 loc) · 12.4 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
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
language: node_js
git:
# Minimize git history, but ensure to not break things:
# - Merging multiple PR's around same time may introduce a case where it's not
# the last merge commit that is to be tested
depth: 30
cache:
# Not relying on 'npm' shortcut, as per Travis docs it's the only 'node_modules' that it'll cache
directories:
- $HOME/.npm
- node_modules
# Ensure to install dependencies at their latest versions
install:
# Note: `npm update` has issues which we need to workaround:
# - There seems no way to update all project dependency groups in one run
# Hence different calls for prod and dev dependencies
# - We were relying on "--depth 3", but depth setting makes optional dependencies not optional
# and adding "--no-optional" proven to not be a reliable workaround (worked just in some cases)
# - npm documents --dev option for dev dependencies update, but it's only --save-dev that works
- npm update --no-save
- npm update --save-dev --no-save
branches:
only: # Do not build PR branches
# Release branches
- master
- release-fast-track
# Release tags
- /^v\d+\.\d+\.\d+$/
env:
global:
- SLS_IGNORE_WARNING=*
- FORCE_COLOR=1 # Ensure colored output (color support is not detected in some cases)
stages:
- name: Test
if: tag IS NOT present
- name: Integration Test
if: branch IN (master, release-fast-track) AND type = push
- name: Deploy
if: tag =~ ^v\d+\.\d+\.\d+$
- name: Publish to Chocolatey
if: tag =~ ^v\d+\.\d+\.\d+$
before_script:
# Fail build right after first script fails. Travis doesn't ensure that: https://github.com/travis-ci/travis-ci/issues/1066
# More info on below line: https://www.davidpashley.com/articles/writing-robust-shell-scripts/#idm5413512
- set -e
- git config --global user.email "[email protected]"
- git config --global user.name "Serverless CI"
script:
- npm test -- -b # Bail after first fail
jobs:
include:
# In most cases it's best to configure one job per Platform & Node.js version combination
# (job boot & setup takes ca 1 minute, one task run usually lasts seconds)
# PR's from branches
# Ensure commit messages follow CC, and confirm on changelog in case of release PR's
- name: 'Prettier check updated, Lint updated, Commitlint, Changelog confirm (on release), Unit Tests - Node.js v12'
if: type = pull_request AND fork = false
node_js: 12
script:
- npm run prettier-check:updated
- npm run lint:updated
- npm run commitlint:pull-request
- npm test -- -b
# If a release PR, confirm we have a changelog
- |
tagName=`git diff master package.json | grep '"version": "' | tail -n 1 | grep -oE "[0-9]+\.[0-9]+\.[0-9]+"` || :
if [ -n "$tagName" ];
then
npx dump-release-notes-from-cc-changelog $tagName
fi
# PR's from forks
# Do not validate commit messages,
# (if user didn't ensure CC, PR should be squash merged with a valid CC commit message)
- name: 'Prettier check updated, Lint updated, Unit Tests - Node.js v12'
if: type = pull_request AND fork = true
node_js: 12
script:
- npm run prettier-check:updated
- npm run lint:updated
- npm test -- -b
# master or release-fast-track branch
- name: 'Unit Tests - Node.js v12'
if: type != pull_request
node_js: 12
env:
# GITHUB_TOKEN
- secure: tKC+34Pvwvzs1ZNC1d7WfBoYlT9nYzMIhwhfG9/J6PBCpuDITQ5+VNDTVh3Lo1JxR6ZuERPauQCnHcrvEHJhEi/fp1qb550V5uYXhn/7X8h+rW8IZ7tJl333UBIACW0jh2JOBeB2ubpIwITv/l7sn6NFothIQE2r1ogLHyBdcipImDKx2RY7R20xCRq7nbg6LWZg11kMaHkdNWi6odXzrhO1FwIcVtWYWmeuJQDdjQuusehNh8/qcZFFXTEDzj+xSAecxSLSeZcDO7x/J5jNuG3khhdkHMAIFuKviFsgNUcGmNuXIB9TEPKhf4YBY00Cle/KNvHori8RplbWqxeyQbtpWMWF5v988qPvSeOqLH60PBeQRqSbYGumXooCClCRn73tYr14WZfUmf2fOTDHe7y5Rnk9jnGW/aPu+Py1hWBkTakn0/hoI3IRqFEGkC2YTtwroyLK8GSUC7W2yexoNfEykvMFlo9h8kiMSCd91mA6MFHruN+bhA4iwGpTWU2CQgq3gUq4aLwO/NXvmisn7Cf7NI3u3zj9e/e9i/qAFEP81mkTowjPgCR5vS8eI2TCvKFjNcANvMq+YHw9E5CGcKon42X6aUKnmdQSpzswKFSratmo7K+TWmbUCg5LL2sbvecm4wbsdJn9VcRZLQRZ6ZvRfjt4oymVvJdI0qrWmQ4=
script:
- |
if [ $TRAVIS_BRANCH = master ]
then
# Ensure `sfe-next` branch points latest release
git checkout -b sfe-next
node scripts/update-sfe-dep.js
git add package.json
git commit -m "chore: Update for sfe-next"
git push -f https://[email protected]/serverless/serverless sfe-next:sfe-next
fi
- npm test -- -b
- name: 'Unit Tests - Node.js v12'
os: windows
node_js: 12
before_install:
# Ensure Python 2 in Windows environment (Ruby is already preinstalled)
- |
# Ignore eventual fail on choco side
if choco install python2
then
export PATH="/c/Python27:/c/Python27/Scripts:$PATH"
fi
- name: 'Isolated Unit Tests, Package Integration Tests - Node.js v13'
node_js: 13
script:
- npm run test:isolated
- npm run integration-test-run-package
- name: 'Unit Tests, Coverage - Node.js v10'
node_js: 10
before_install:
- npm install -g codecov
script: npm run coverage
after_success:
- codecov
- rm -rf ./coverage
- name: 'Unit Tests - Node.js v8'
node_js: 8
- name: 'Unit Tests - Node.js v6'
node_js: 6
- stage: Integration Test
name: 'Integration Tests, Tag on version bump - Node.js v12'
node_js: 12
env:
# GITHUB_TOKEN
- secure: tKC+34Pvwvzs1ZNC1d7WfBoYlT9nYzMIhwhfG9/J6PBCpuDITQ5+VNDTVh3Lo1JxR6ZuERP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MhLZEzQMORXDGjJlgwLaZfYVqjlsGe5p5etFBUTd0WbFgSwOKLoA2U/fm7WzqItkjs3UWaHuvFVvwYixGxjEVmVczS6wa2cdGpHtVD9H7km4fPEzljHqQ26v0P5e8eylgqLF2IB6mL7UqGFrAtrMvAgN/M3gnq4dTs/wq1AJIOxEP7YW7kc0NAldk8vUz6t5GzCPNcuukxAku91Awnh0twxgUywatgJLZPY=
# AWS_SECRET_ACCESS_KEY
- secure: Dgaa5XIsA5Vbw/CYQLUAuVVsDX26C8+f1XYGwsbNmFQKbKvM8iy9lGrHlfrT3jftJkJH6re8tP1RjyZjjzLe25KPk4Tps7grNteCyiIIEDsC2aHhiXHD6zNHsItpxYusaFfyQinFWnK4CAYKWb9ZNIwHIDUIB4vq807QGAhYsnoj1Lg/ajWvtEKBwYjEzDz9OjB91lw7lpCnHtmKKw5A+TNIVGpDDZ/jRBqETsPaePtiXC9UTHZQyM3gFoeVXiJw9KSU/gjIx9REihCaWWPbnuQSeIONGGlVWY9V4DTZIsJr9/uwDcbioeXDD3G1ezGtNPPRSNTtq08QlUtE4mEtKea/+ObpllKZCeZGn6AJhMn+uqMIP95FFlqBB55YzRcLZY+Igi/qm/9LJ9RinAhxRVXiwzeQ+BdVA6jshAAzr+7wklux6lZAa0xGw9pgTv7MI4RP2LJ/LMP1ppFsnv9n/qt93Ax1VEwEu3xHZe3VTYL9tbXOPTZutf6fKjUrW7wSSuy637queESjYnnPKSb1vZcPxjSFlyh+GJvxu/3PurF9aqfiBdiorIBre+pQS4lakLtoft5nsbA+4iYUwrXR58qUPVUqQ7a0A0hedOWlp6g9ixLa6nugUP5aobJzR71T8l/IjqpnY2EEd/iINEb0XfUiZtB5zHaqFWejBtmWwCI=
script:
- npm run integration-test-run-basic || { npm run integration-test-cleanup; exit 1; }
- npm run integration-test-run-all || { npm run integration-test-cleanup; exit 1; }
- npm run integration-test-cleanup
- |
tagName=`git diff HEAD^ package.json | grep '"version": "' | tail -n 1 | grep -oE "[0-9]+\.[0-9]+\.[0-9]+"` || :
if [ -n "$tagName" ]
then
if git tag v$tagName && git push https://[email protected]/serverless/serverless --tags
then
if [ $TRAVIS_BRANCH = master ]
then
# Ensure `release-fast-track` branch points latest release
git push -f https://[email protected]/serverless/serverless master:release-fast-track
elif [ $TRAVIS_BRANCH = release-fast-track ]
then
# Fast forward to `master`
git fetch --unshallow
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
git fetch origin master
git checkout -b rebase-target
git rebase origin/master
git checkout master
git merge rebase-target
git push https://[email protected]/serverless/serverless
fi
fi
fi
- stage: Deploy
node_js: 12
env:
# GITHUB_TOKEN
- secure: tKC+34Pvwvzs1ZNC1d7WfBoYlT9nYzMIhwhfG9/J6PBCpuDITQ5+VNDTVh3Lo1JxR6ZuERPauQCnHcrvEHJhEi/fp1qb550V5uYXhn/7X8h+rW8IZ7tJl333UBIACW0jh2JOBeB2ubpIwITv/l7sn6NFothIQE2r1ogLHyBdcipImDKx2RY7R20xCRq7nbg6LWZg11kMaHkdNWi6odXzrhO1FwIcVtWYWmeuJQDdjQuusehNh8/qcZFFXTEDzj+xSAecxSLSeZcDO7x/J5jNuG3khhdkHMAIFuKviFsgNUcGmNuXIB9TEPKhf4YBY00Cle/KNvHori8RplbWqxeyQbtpWMWF5v988qPvSeOqLH60PBeQRqSbYGumXooCClCRn73tYr14WZfUmf2fOTDHe7y5Rnk9jnGW/aPu+Py1hWBkTakn0/hoI3IRqFEGkC2YTtwroyLK8GSUC7W2yexoNfEykvMFlo9h8kiMSCd91mA6MFHruN+bhA4iwGpTWU2CQgq3gUq4aLwO/NXvmisn7Cf7NI3u3zj9e/e9i/qAFEP81mkTowjPgCR5vS8eI2TCvKFjNcANvMq+YHw9E5CGcKon42X6aUKnmdQSpzswKFSratmo7K+TWmbUCg5LL2sbvecm4wbsdJn9VcRZLQRZ6ZvRfjt4oymVvJdI0qrWmQ4=
script: skip
# Ensure to fail build if deploy fails, Travis doesn't ensure that: https://github.com/travis-ci/travis-ci/issues/921
before_deploy:
- set -e
- # Prepare binaries
- npm run pkg:build
# Remove eventual old npm logs
- rm -rf ~/.npm/_logs
after_deploy:
- |
# npm creates log only on failure
if [ -d ~/.npm/_logs ]
then
# Undocumented way to force Travis build to fail
travis_terminate 1
fi
- npx github-release-from-cc-changelog $TRAVIS_TAG
- npm run pkg:upload -- $TRAVIS_TAG
deploy:
edge: true # Workaround Travis regression: https://travis-ci.community/t/missing-api-key-when-deploying-to-github-releases/5761
provider: npm
email: [email protected]
on:
tags: true
api_key:
secure: EgoetjrRlGfvGnmVp8A0btr1CzB0hl7owVIpbfk4zXJzhGEbHoVu0CG0IdmyLN+JlaZa7EDJTjkDCd6g3fVAh9TT7ZCeaq8YwbZDrql7mAJj7xYQAyM4eSkc95BRzcFJBx7Mxr6H90IDLxKr6ZtB+HEdiHN+59XbepKYYJeb1jHfnKn5xzOqk4BdnZo6pKfudfeO+7/BwJJ0FwlFA40bY2HS/Lp+NG/2IedNR7k3m/5W83/XH5qlWP8jhBKlxrAzks27aNo+42xHkRCVyPViJKq0mfz1hl2bfswChWHgaCuajp+0amNL39pgIX9eXxFc3bNX9Iftox5t31elEhsw06vvuAaVkKEd+VEMaDySbQ9M+irKZeREg+NFYZLnc2WiEE3Sexo6hm9eM2q2KEZ7bleN9B0CQAut1XXLRQEts80rzss4Z2Q7AZb9cOYBQlj9Wf1X0Y74UqvnDn83a4Y38a+lhx7J2q691ZeM1UFSCdO0QfeJRkB55bSyHqUqrLAqUN7eNsKGdBH0kvYIGFREgGgReEpBRAuNqWuJ/5qexp63Kbf+09raG5IvfxSIM5fJ5KE5VxSduBdRnSH0GNKfjuq296/Rg4fmm/bygZ3Yk5L6Wd41SUU8uHzlZFBwtcvxAKDTQe6s+5JU24ilqxOx6J4Ut34X3dIbLLAmoB1ogdM=
- stage: Publish to Chocolatey
os: windows
node_js: 12
env:
# CHOCO_API_KEY
- secure: jKn6s5DvS0o2tepSVNC2KRm9GyT1GbAAg6t7O4AcuOTIm/0eYnXdsGHUQ1gZooqOvpkzujrhg4Cq0IFLdZfxkd1HPn9u1ggkZwMCPt27Dlm3EsQtGgWm6AZPnXfATWHafCINMVaqGlXBJYXTh2iZtqYyTkPiOa0V3RZCkQ2k+4ppbBt5hqYO/VOpl07lNoWiVaaEUc/M+OStXseqJZxVLINOXthbLVZrFW2S78qVO9EB1w9MR0Csqf9lYLtSsA8OMIGJGjar1XUvV4+kjUFUPcbZ7tcWjsxktfGn9umVo2PsZuHcJW1XTmAO4bJFKB4zYSMMmZRZl+4AYCNCF9So0ufk6z9qClTVqGi6wuTNhACHJli3tzqPyycU3Rb2E3GxNRV5zIe9F5QvVP3HBxTwegK/fYBUGSS2aaXO3obQTzf5auwcnPH/dj2V60ulJ34Ug2KNg1dkvN68+uIk7y+Tleu8iLqQK4dcbtfhF+MfAukLNMKM2W5hTzvAAmKJagO/jsnA3V8hA9skFUXNFzDkeRbVmBiPBsRfBCBhNfsu70NBc07i+asC8NH0b7qUJNgd3BujPD5uiLe5W9Gl1hvUYAtQRqh2+resqiG/BkWNZ5hkyPEu6gtF2z5aI3o9zNehYvBmM/fFYbry5TsLG1g7rwvOawz6J12kMc8IwefpLm4=
script:
- cd `npm run pkg:generate-choco-package $TRAVIS_TAG | tail -1`
- choco apikey --key $CHOCO_API_KEY --source https://push.chocolatey.org/
- choco pack
- choco push serverless.${TRAVIS_TAG:1}.nupkg