Skip to content

Commit b2836b8

Browse files
authored
feat(dev): Build/test CI improvements (#4739)
This makes a few changes to our "Build and Test" GHA workflow: - For mysterious reasons, occasionally pushing to a PR fails to trigger CI. On the PR it says "queued," but on the Actions page, nothing ever appears. There are also times when you might want to run CI before creating a PR. This introduces the ability to run the "Build and Test" GHA on demand. As long as a branch is pushed, it can be chosen from the dropdown and its `HEAD` will be run against CI. If for whatever reason the commit you want to test has been pushed but _isn't_ the head of a branch, its SHA can be filled in instead, and it will be used instead of the branch showing in the dropdown. - The titles of the browser and tracing playwright tests are currently long enough that they are truncated in the GH UI, which obscures some of the information they contain, namely the ways in which each one differs from the others. This changes the naming scheme to be more space efficient. Also, since it helps the naming and doesn't change the test behavior, the excluded tests have been switched from `tracing_only: true` to `tracing_only: false`. (Because the `tracing_only` value doesn't influence the `cjs` and `esm` tests, we exclude one `tracing_only` value just so as not to run the same tests twice, which means changing which one is excluded doesn't change the actual tests.) - The artifacts job has been moved above all of the test-related jobs, so that all non-test-related jobs come before all test-related ones. - The original browser integration tests, the ones which existed before we adopted the playwright framework, have been renamed the "Old" tests, so it's easier to distinguish them from the new ones.
1 parent 58b3ddb commit b2836b8

File tree

1 file changed

+61
-52
lines changed

1 file changed

+61
-52
lines changed

.github/workflows/build.yml

Lines changed: 61 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,15 @@ on:
55
- master
66
- release/**
77
pull_request:
8+
workflow_dispatch:
9+
inputs:
10+
commit:
11+
description: If the commit you want to test isn't the head of a branch, provide its SHA here
12+
required: false
813

914
env:
15+
HEAD_COMMIT: ${{ github.event.inputs.commit || github.sha }}
16+
1017
CACHED_DEPENDENCY_PATHS: |
1118
${{ github.workspace }}/node_modules
1219
${{ github.workspace }}/packages/**/node_modules
@@ -22,15 +29,15 @@ env:
2229
${{ github.workspace }}/packages/ember/instance-initializers
2330
${{ github.workspace }}/packages/serverless/dist-awslambda-layer/*.zip
2431
25-
BUILD_CACHE_KEY: ${{ github.sha }}
32+
BUILD_CACHE_KEY: ${{ github.event.inputs.commit || github.sha }}
2633

2734
jobs:
2835
job_install_deps:
2936
name: Install Dependencies
3037
runs-on: ubuntu-latest
3138
timeout-minutes: 15
3239
steps:
33-
- name: Check out current commit (${{ github.sha }})
40+
- name: Check out current commit (${{ env.HEAD_COMMIT }})
3441
uses: actions/checkout@v2
3542
- name: Set up Node
3643
uses: actions/setup-node@v1
@@ -57,7 +64,7 @@ jobs:
5764
runs-on: ubuntu-latest
5865
timeout-minutes: 15
5966
steps:
60-
- name: Check out current commit (${{ github.sha }})
67+
- name: Check out current commit (${{ env.HEAD_COMMIT }})
6168
uses: actions/checkout@v2
6269
- name: Set up Node
6370
uses: actions/setup-node@v1
@@ -98,7 +105,7 @@ jobs:
98105
timeout-minutes: 15
99106
runs-on: ubuntu-latest
100107
steps:
101-
- name: Check out current commit (${{ github.sha }})
108+
- name: Check out current commit (${{ env.HEAD_COMMIT }})
102109
uses: actions/checkout@v2
103110
- name: Set up Node
104111
uses: actions/setup-node@v1
@@ -116,8 +123,8 @@ jobs:
116123
key: ${{ env.BUILD_CACHE_KEY }}
117124
- name: Check bundle sizes
118125
uses: getsentry/size-limit-action@v4
119-
# Only run size check on master or pull requests
120-
if: github.ref == 'refs/heads/master' || github.event_name == 'pull_request'
126+
# Don't run size check on release branches - at that point, we're already committed
127+
if: ${{ !startsWith(github.ref, 'release') }}
121128
with:
122129
github_token: ${{ secrets.GITHUB_TOKEN }}
123130
skip_step: build
@@ -128,7 +135,7 @@ jobs:
128135
timeout-minutes: 10
129136
runs-on: ubuntu-latest
130137
steps:
131-
- name: Check out current commit (${{ github.sha }})
138+
- name: Check out current commit (${{ env.HEAD_COMMIT }})
132139
uses: actions/checkout@v2
133140
- name: Set up Node
134141
uses: actions/setup-node@v1
@@ -151,7 +158,7 @@ jobs:
151158
timeout-minutes: 10
152159
runs-on: ubuntu-latest
153160
steps:
154-
- name: Check out current commit (${{ github.sha }})
161+
- name: Check out current commit (${{ env.HEAD_COMMIT }})
155162
uses: actions/checkout@v2
156163
- name: Set up Node
157164
uses: actions/setup-node@v1
@@ -168,6 +175,40 @@ jobs:
168175
- name: Run madge
169176
run: yarn circularDepCheck
170177

178+
job_artifacts:
179+
name: Upload Artifacts
180+
needs: job_build
181+
runs-on: ubuntu-latest
182+
# Build artifacts are only needed for releasing workflow.
183+
if: startsWith(github.ref, 'refs/heads/release/')
184+
steps:
185+
- name: Check out current commit (${{ github.sha }})
186+
uses: actions/checkout@v2
187+
- name: Set up Node
188+
uses: actions/setup-node@v1
189+
- name: Check dependency cache
190+
uses: actions/cache@v2
191+
with:
192+
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
193+
key: ${{ needs.job_build.outputs.dependency_cache_key }}
194+
- name: Check build cache
195+
uses: actions/cache@v2
196+
with:
197+
path: ${{ env.CACHED_BUILD_PATHS }}
198+
key: ${{ env.BUILD_CACHE_KEY }}
199+
- name: Pack
200+
run: yarn build:npm
201+
- name: Archive artifacts
202+
uses: actions/upload-artifact@v2
203+
with:
204+
name: ${{ github.sha }}
205+
path: |
206+
${{ github.workspace }}/packages/browser/build/bundles/**
207+
${{ github.workspace }}/packages/integrations/build/**
208+
${{ github.workspace }}/packages/tracing/build/**
209+
${{ github.workspace }}/packages/**/*.tgz
210+
${{ github.workspace }}/packages/serverless/dist-awslambda-layer/*.zip
211+
171212
job_unit_test:
172213
name: Test (Node ${{ matrix.node }})
173214
needs: job_build
@@ -178,7 +219,7 @@ jobs:
178219
matrix:
179220
node: [6, 8, 10, 12, 14, 16]
180221
steps:
181-
- name: Check out current commit (${{ github.sha }})
222+
- name: Check out current commit (${{ env.HEAD_COMMIT }})
182223
uses: actions/checkout@v2
183224
- name: Set up Node
184225
uses: actions/setup-node@v1
@@ -211,7 +252,7 @@ jobs:
211252
matrix:
212253
node: [10, 12, 14, 16]
213254
steps:
214-
- name: Check out current commit (${{ github.sha }})
255+
- name: Check out current commit (${{ env.HEAD_COMMIT }})
215256
uses: actions/checkout@v2
216257
- name: Set up Node
217258
uses: actions/setup-node@v1
@@ -243,7 +284,7 @@ jobs:
243284
timeout-minutes: 30
244285
runs-on: ubuntu-latest
245286
steps:
246-
- name: Check out current commit (${{ github.sha }})
287+
- name: Check out current commit (${{ env.HEAD_COMMIT }})
247288
uses: actions/checkout@v2
248289
# TODO: removing `fetch-depth` below seems to have no effect, and the commit which added it had no description,
249290
# so it's not clear why it's necessary. That said, right now ember tests are xfail, so it's a little hard to
@@ -274,42 +315,8 @@ jobs:
274315
- name: Compute test coverage
275316
uses: codecov/codecov-action@v1
276317

277-
job_artifacts:
278-
name: Upload Artifacts
279-
needs: job_build
280-
runs-on: ubuntu-latest
281-
# Build artifacts are only needed for releasing workflow.
282-
if: startsWith(github.ref, 'refs/heads/release/')
283-
steps:
284-
- name: Check out current commit (${{ github.sha }})
285-
uses: actions/checkout@v2
286-
- name: Set up Node
287-
uses: actions/setup-node@v1
288-
- name: Check dependency cache
289-
uses: actions/cache@v2
290-
with:
291-
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
292-
key: ${{ needs.job_build.outputs.dependency_cache_key }}
293-
- name: Check build cache
294-
uses: actions/cache@v2
295-
with:
296-
path: ${{ env.CACHED_BUILD_PATHS }}
297-
key: ${{ env.BUILD_CACHE_KEY }}
298-
- name: Pack
299-
run: yarn build:npm
300-
- name: Archive artifacts
301-
uses: actions/upload-artifact@v2
302-
with:
303-
name: ${{ github.sha }}
304-
path: |
305-
${{ github.workspace }}/packages/browser/build/bundles/**
306-
${{ github.workspace }}/packages/integrations/build/**
307-
${{ github.workspace }}/packages/tracing/build/**
308-
${{ github.workspace }}/packages/**/*.tgz
309-
${{ github.workspace }}/packages/serverless/dist-awslambda-layer/*.zip
310-
311318
job_browser_playwright_tests:
312-
name: Browser Playwright Tests (${{ matrix.bundle }} - tracing_only = ${{ matrix.tracing_only }})
319+
name: Playwright - ${{ (matrix.tracing_only && 'Browser + Tracing') || 'Browser' }} (${{ matrix.bundle }})
313320
needs: job_build
314321
runs-on: ubuntu-latest
315322
strategy:
@@ -325,12 +332,14 @@ jobs:
325332
- true
326333
- false
327334
exclude:
335+
# `tracing_only` only makes a difference for bundles - tests of the esm and cjs builds always include the
336+
# tracing tests
328337
- bundle: esm
329-
tracing_only: true
338+
tracing_only: false
330339
- bundle: cjs
331-
tracing_only: true
340+
tracing_only: false
332341
steps:
333-
- name: Check out current commit (${{ github.sha }})
342+
- name: Check out current commit (${{ env.HEAD_COMMIT }})
334343
uses: actions/checkout@v2
335344
- name: Set up Node
336345
uses: actions/setup-node@v1
@@ -356,7 +365,7 @@ jobs:
356365
yarn test:ci
357366
358367
job_browser_integration_tests:
359-
name: Browser Integration Tests (${{ matrix.browser }})
368+
name: Old Browser Integration Tests (${{ matrix.browser }})
360369
needs: job_build
361370
runs-on: ubuntu-latest
362371
timeout-minutes: 10
@@ -368,7 +377,7 @@ jobs:
368377
- FirefoxHeadless
369378
- WebkitHeadless
370379
steps:
371-
- name: Check out current commit (${{ github.sha }})
380+
- name: Check out current commit (${{ env.HEAD_COMMIT }})
372381
uses: actions/checkout@v2
373382
- name: Set up Node
374383
uses: actions/setup-node@v1
@@ -397,7 +406,7 @@ jobs:
397406
timeout-minutes: 5
398407
continue-on-error: true
399408
steps:
400-
- name: Check out current commit (${{ github.sha }})
409+
- name: Check out current commit (${ env.HEAD_COMMIT }})
401410
uses: actions/checkout@v2
402411
- name: Set up Node
403412
uses: actions/setup-node@v1

0 commit comments

Comments
 (0)