-
Notifications
You must be signed in to change notification settings - Fork 286
341 lines (328 loc) · 11.2 KB
/
build.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
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
name: Build and Publish
on:
pull_request: {}
push:
branches:
- main
- stable
- ember-2.7.0-3.4.0
- ember-0.0.0-2.7.0
tags:
- v*
schedule:
- cron: '0 0 * * *'
jobs:
test:
name: Test
runs-on: ubuntu-latest
env:
CI: 'true'
steps:
- name: Checkout
uses: actions/checkout@v3
# Code Climate expects these variables to be set
- name: Set up commit metadata
if: github.event_name == 'push'
env:
GIT_COMMIT_SHA: ${{ github.sha }}
GIT_BRANCH: ${{ github.ref }}
run: |
echo "GIT_COMMIT_SHA=${GIT_COMMIT_SHA}" >> $GITHUB_ENV
echo "GIT_BRANCH=${GIT_BRANCH/refs\/heads\//}" >> $GITHUB_ENV
- name: Set up commit metadata
if: github.event_name == 'pull_request'
env:
GIT_COMMIT_SHA: ${{ github.event.pull_request.head.sha }}
GIT_BRANCH: ${{ github.event.pull_request.head.ref }}
run: |
echo "GIT_COMMIT_SHA=${GIT_COMMIT_SHA}" >> $GITHUB_ENV
echo "GIT_BRANCH=${GIT_BRANCH}" >> $GITHUB_ENV
- name: setup pnpm & node
uses: wyvox/action-setup-pnpm@v3
- name: Install dependencies (pnpm)
run: pnpm install
- name: Lint (hbs)
run: pnpm lint:hbs
- name: Lint (js)
run: pnpm lint:js
- name: Run test
run: pnpm test
env:
COVERAGE: 'true'
# Ideally, we would split up the test task into separate build and run
# steps to get better CI log output (folding and timing information).
# However, this is not currently possible with ember-cli-code-coverage.
#
# See https://github.com/kategengler/ember-cli-code-coverage/issues/210
#
# - name: Build
# run: pnpm ember build --environment test
# env:
# COVERAGE: 'true'
# - name: Run test
# run: COVERAGE pnpm ember test --path dist
# env:
# # Due to a bug in ember-cli, running `ember test` with `--path` doesn't set `EMBER_ENV=test`
# # See https://github.com/ember-cli/ember-cli/issues/8922
# EMBER_ENV: test
# COVERAGE: 'true'
- name: Report coverage
if: github.event_name != 'schedule'
run: pnpm codeclimate-test-reporter < coverage/lcov.info
env:
CODECLIMATE_REPO_TOKEN: 59edcfd1ffc778791af49ca594b503e7179f6bbe1991b2cc0c0a6987d103253d
ember-try:
name: ember-try (${{ matrix.scenario }})
needs: test
runs-on: ubuntu-latest
env:
CI: 'true'
strategy:
fail-fast: false
matrix:
scenario:
- ember-lts-3.16
- ember-lts-3.20
- ember-lts-3.24
- ember-lts-3.28
- ember-lts-4.8
- ember-lts-4.12
- ember-release
- ember-beta
- ember-canary
- ember-default-no-prototype-extensions
steps:
- name: Checkout
uses: actions/checkout@v3
- name: setup pnpm & node
uses: wyvox/action-setup-pnpm@v3
- name: Install dependencies (pnpm)
run: pnpm install
- name: Set NO_EXTEND_PROTOTYPES
if: matrix.scenario == 'ember-default-no-prototype-extensions'
run: echo "NO_EXTEND_PROTOTYPES==true" >> .GITHUB_ENV
- name: Setup ember-try scenario
run: pnpm ember try:one ${{ matrix.scenario }} --skip-cleanup --- cat package.json
- name: Build
run: pnpm ember build --environment test
- name: Run test
# Due to a bug in ember-cli, running `ember test` with `--path` doesn't set `EMBER_ENV=test`
# See https://github.com/ember-cli/ember-cli/issues/8922
run: EMBER_ENV=test pnpm ember test --path dist --filter="Ember Debug"
build:
name: Build extensions
runs-on: ubuntu-latest
env:
CI: 'true'
steps:
- name: Checkout
uses: actions/checkout@v3
- name: setup pnpm & node
uses: wyvox/action-setup-pnpm@v3
- name: Install dependencies (pnpm)
run: pnpm install
- name: Download panes
run: node scripts/download-panes.js
env:
EMBER_ENV: production
- name: Update manifest.json (nightly)
if: github.event_name == 'schedule'
run: |
DATE="$(date +"%Y.%-m.%-d")"
SHA="${GITHUB_SHA:0:7}"
VERSION="$(jq -r '.version' package.json)"
CONTENT="$(cat "$FILE")"
echo "$CONTENT" | jq --arg date "$DATE" --arg sha "$SHA" --arg version "$VERSION" "$FILTER" > $FILE
cat "$FILE"
env:
FILE: skeletons/web-extension/manifest.json
FILTER: >-
.name += " (Nightly)" |
.version = $date |
.version_name = "\($version) (nightly build \($date) / \($sha))"
- name: Update manifest.json (pull request)
if: github.event_name == 'pull_request'
run: |
SHA="${SHA:0:7}"
CONTENT="$(cat "$FILE")"
echo "$CONTENT" | jq --arg pr "$PR" --arg sha "$SHA" "$FILTER" > $FILE
cat "$FILE"
env:
FILE: skeletons/web-extension/manifest.json
FILTER: >-
.name += " (PR #\($pr))" |
.version = $pr |
.version_name = $sha
PR: ${{ github.event.pull_request.number }}
SHA: ${{ github.event.pull_request.head.sha }}
- name: Update package.json (nightly)
if: github.event_name == 'schedule'
run: |
DATE="$(date +"%Y.%-m.%-d")"
SHA="${GITHUB_SHA:0:7}"
CONTENT="$(cat "$FILE")"
echo "$CONTENT" | jq --arg date "$DATE" --arg sha "$SHA" "$FILTER" > $FILE
cat "$FILE"
env:
FILE: package.json
FILTER: .version += "-alpha.\($date)+\($sha)"
- name: Update package.json (pull request)
if: github.event_name == 'pull_request'
run: |
SHA="${SHA:0:7}"
CONTENT="$(cat "$FILE")"
echo "$CONTENT" | jq --arg pr "$PR" --arg sha "$SHA" "$FILTER" > $FILE
cat "$FILE"
env:
FILE: package.json
FILTER: .version += "-alpha.0.\($pr)+\($sha)"
PR: ${{ github.event.pull_request.number }}
SHA: ${{ github.event.pull_request.head.sha }}
- name: Set EMBER_INSPECTOR_TAB (nightly)
if: github.event_name == 'schedule'
run: echo "EMBER_INSPECTOR_TAB=Nightly" >> $GITHUB_ENV
- name: Set EMBER_INSPECTOR_TAB (pull request)
if: github.event_name == 'pull_request'
run: echo "EMBER_INSPECTOR_TAB=PR \#$PR" >> $GITHUB_ENV
env:
PR: ${{ github.event.pull_request.number }}
- name: Build
run: pnpm ember build --environment production
- name: Pack
run: |
VERSION="$(jq -r '.version' package.json)"
pnpm pack
mkdir -p dist/npm
tar xvzf "ember-inspector-$VERSION.tgz" -C dist/npm --strip-components 1
- name: Upload artifacts (bookmarklet)
uses: actions/upload-artifact@v4
with:
name: bookmarklet
path: dist/bookmarklet
- name: Upload artifacts (Chrome)
uses: actions/upload-artifact@v4
with:
name: chrome
path: dist/chrome
- name: Upload artifacts (Firefox)
uses: actions/upload-artifact@v4
with:
name: firefox
path: dist/firefox
- name: Upload artifacts (npm)
uses: actions/upload-artifact@v4
with:
name: npm
path: dist/npm
publish-bookmarklet:
name: Publish bookmarklet
needs:
- test
- ember-try
- build
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- name: Download artifacts (bookmarklet)
uses: actions/download-artifact@v4
with:
name: bookmarklet
path: bookmarklet
- name: Upload to S3
uses: jakejarvis/[email protected]
with:
args: --acl public-read --cache-control "max-age=86400000,public"
env:
AWS_S3_BUCKET: ember-extension
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
SOURCE_DIR: bookmarklet
DEST_DIR: dist_bookmarklet
publish-chrome:
name: Publish Chrome extension
needs:
- test
- ember-try
- build
runs-on: ubuntu-latest
steps:
- name: Set up node
uses: actions/setup-node@v4
- name: Install dependencies (chrome-webstore-upload-cli)
run: npm install -g chrome-webstore-upload-cli
- name: Download artifacts (Chrome)
uses: actions/download-artifact@v4
with:
name: chrome
path: chrome
- name: Set Environment Variables
run: |
if [[ "$GITHUB_EVENT_NAME" == "schedule" ]]; then
echo "EXTENSION_ID=ibdbkmdgflhglikhjdbogjjflkialpfi" >> $GITHUB_ENV
echo "CLIENT_ID=${{ secrets.GOOGLE_NIGHTLY_CLIENT_ID }}" >> $GITHUB_ENV
echo "REFRESH_TOKEN=${{ secrets.GOOGLE_NIGHTLY_REFRESH_TOKEN }}" >> $GITHUB_ENV
else
echo "EXTENSION_ID=bmdblncegkenkacieihfhpjfppoconhi" >> $GITHUB_ENV
echo "CLIENT_ID=${{ secrets.GOOGLE_NIGHTLY_CLIENT_ID }}" >> $GITHUB_ENV
echo "REFRESH_TOKEN=${{ secrets.GOOGLE_NIGHTLY_REFRESH_TOKEN }}" >> $GITHUB_ENV
fi
- name: Upload to Chrome Web Store
if: >-
github.event_name == 'schedule' ||
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v'))
run: chrome-webstore-upload upload --source chrome --auto-publish
publish-firefox:
name: Publish Firefox extension
needs:
- test
- ember-try
- build
runs-on: ubuntu-latest
steps:
- name: Set up nod
uses: actions/setup-node@v4
- name: Install dependencies (web-ext)
run: |
npm install -g web-ext
# https://github.com/mozilla/web-ext/issues/804
npm install -g web-ext-submit
- name: Download artifacts (Firefox)
uses: actions/download-artifact@v4
with:
name: firefox
path: firefox
- name: Upload to AMO
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
working-directory: firefox
run: web-ext-submit --channel=listed
env:
WEB_EXT_API_KEY: ${{ secrets.FIREFOX_API_KEY }}
WEB_EXT_API_SECRET: ${{ secrets.FIREFOX_API_SECRET }}
publish-npm:
name: Publish npm package
needs:
- test
- ember-try
- build
runs-on: ubuntu-latest
steps:
- name: Set up node
uses: actions/setup-node@v4
- name: Download artifacts (npm)
uses: actions/download-artifact@v4
with:
name: npm
path: npm
- name: Publish to npm
if: >-
github.event_name == 'schedule' ||
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v'))
env:
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
working-directory: npm
run: |
echo "//registry.npmjs.org/:_authToken=${NPM_AUTH_TOKEN}"> ~/.npmrc
npm whoami
if [[ "$GITHUB_EVENT_NAME" == "schedule" ]]; then
npm publish --tag alpha
fi