Skip to content

Commit b306aee

Browse files
committed
chore(ci): Streamline tarball packaging & e2e test matrix generation
1 parent fa9fea2 commit b306aee

2 files changed

Lines changed: 52 additions & 53 deletions

File tree

.github/workflows/build.yml

Lines changed: 30 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ env:
4848
${{ github.workspace }}/packages/ember/*.d.ts
4949
${{ github.workspace }}/packages/gatsby/*.d.ts
5050
51-
BUILD_CACHE_TARBALL_KEY: tarball-${{ github.event.inputs.commit || github.sha }}
51+
BUILD_TARBALL_PATH: ${{ github.workspace }}/packages/*/*.tgz
5252

5353
# GH will use the first restore-key it finds that matches
5454
# So it will start by looking for one from the same branch, else take the newest one it can find elsewhere
@@ -298,7 +298,7 @@ jobs:
298298

299299
job_artifacts:
300300
name: Upload Artifacts
301-
needs: [job_get_metadata, job_build]
301+
needs: [job_get_metadata, job_build, job_build_tarballs]
302302
runs-on: ubuntu-24.04
303303
# Build artifacts are only needed for releasing workflow.
304304
if: needs.job_get_metadata.outputs.is_release == 'true'
@@ -316,8 +316,10 @@ jobs:
316316
with:
317317
dependency_cache_key: ${{ needs.job_build.outputs.dependency_cache_key }}
318318

319-
- name: Pack tarballs
320-
run: yarn build:tarball
319+
- name: Restore tarball artifacts
320+
uses: actions/download-artifact@v7
321+
with:
322+
name: tarball-output
321323

322324
- name: Archive artifacts
323325
uses: actions/upload-artifact@v7
@@ -834,19 +836,16 @@ jobs:
834836
cd packages/remix
835837
yarn test:integration:ci
836838
837-
job_e2e_prepare:
838-
name: Prepare E2E tests
839+
job_build_tarballs:
840+
name: Build tarballs
839841
# We want to run this if:
840842
# - The build job was successful, not skipped
841843
if: |
842844
always() &&
843845
needs.job_build.result == 'success'
844846
needs: [job_get_metadata, job_build]
845-
runs-on: ubuntu-24.04-large-js
847+
runs-on: ubuntu-24.04
846848
timeout-minutes: 15
847-
outputs:
848-
matrix: ${{ steps.matrix.outputs.matrix }}
849-
matrix-optional: ${{ steps.matrix-optional.outputs.matrix }}
850849
steps:
851850
- name: Check out base commit (${{ github.event.pull_request.base.sha }})
852851
uses: actions/checkout@v6
@@ -876,33 +875,23 @@ jobs:
876875
- name: Build tarballs
877876
run: yarn build:tarball
878877

879-
- name: Stores tarballs in cache
880-
uses: actions/cache/save@v5
878+
- name: Upload tarball artifacts
879+
uses: actions/upload-artifact@v7
881880
with:
882-
path: ${{ github.workspace }}/packages/*/*.tgz
883-
key: ${{ env.BUILD_CACHE_TARBALL_KEY }}
884-
885-
- name: Determine which E2E test applications should be run
886-
id: matrix
887-
run:
888-
yarn --silent ci:build-matrix --base=${{ (github.event_name == 'pull_request' &&
889-
github.event.pull_request.base.sha) || '' }} >> $GITHUB_OUTPUT
890-
working-directory: dev-packages/e2e-tests
891-
892-
- name: Determine which optional E2E test applications should be run
893-
id: matrix-optional
894-
run:
895-
yarn --silent ci:build-matrix-optional --base=${{ (github.event_name == 'pull_request' &&
896-
github.event.pull_request.base.sha) || '' }} >> $GITHUB_OUTPUT
897-
working-directory: dev-packages/e2e-tests
881+
name: tarball-output
882+
path: ${{ env.BUILD_TARBALL_PATH }}
883+
retention-days: 4
884+
compression-level: 6
885+
overwrite: true
898886

899887
job_e2e_tests:
900888
name: E2E ${{ matrix.label || matrix.test-application }} Test
901889
# We need to add the `always()` check here because the previous step has this as well :(
902890
# See: https://github.com/actions/runner/issues/2205
903891
if:
904-
always() && needs.job_e2e_prepare.result == 'success' && needs.job_e2e_prepare.outputs.matrix != '{"include":[]}'
905-
needs: [job_get_metadata, job_build, job_e2e_prepare]
892+
always() && needs.job_build_tarballs.result == 'success' && needs.job_get_metadata.outputs.e2e-matrix
893+
!='{"include":[]}'
894+
needs: [job_get_metadata, job_build, job_build_tarballs]
906895
runs-on: ubuntu-24.04
907896
timeout-minutes: 15
908897
env:
@@ -916,7 +905,7 @@ jobs:
916905
E2E_TEST_SENTRY_PROJECT: 'sentry-javascript-e2e-tests'
917906
strategy:
918907
fail-fast: false
919-
matrix: ${{ fromJson(needs.job_e2e_prepare.outputs.matrix) }}
908+
matrix: ${{ fromJson(needs.job_get_metadata.outputs.e2e-matrix) }}
920909
steps:
921910
- name: Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }})
922911
uses: actions/checkout@v6
@@ -948,16 +937,10 @@ jobs:
948937
with:
949938
dependency_cache_key: ${{ needs.job_build.outputs.dependency_cache_key }}
950939

951-
- name: Restore tarball cache
952-
uses: actions/cache/restore@v5
953-
id: restore-tarball-cache
940+
- name: Restore tarball artifacts
941+
uses: actions/download-artifact@v7
954942
with:
955-
path: ${{ github.workspace }}/packages/*/*.tgz
956-
key: ${{ env.BUILD_CACHE_TARBALL_KEY }}
957-
958-
- name: Build tarballs if not cached
959-
if: steps.restore-tarball-cache.outputs.cache-hit != 'true'
960-
run: yarn build:tarball
943+
name: tarball-output
961944

962945
- name: Validate Verdaccio
963946
run: yarn test:validate
@@ -1022,10 +1005,10 @@ jobs:
10221005
# We need to add the `always()` check here because the previous step has this as well :(
10231006
# See: https://github.com/actions/runner/issues/2205
10241007
if:
1025-
always() && needs.job_get_metadata.outputs.is_release != 'true' && needs.job_e2e_prepare.result == 'success' &&
1026-
needs.job_e2e_prepare.outputs.matrix-optional != '{"include":[]}' && (github.event_name != 'pull_request' ||
1008+
always() && needs.job_get_metadata.outputs.is_release != 'true' && needs.job_build_tarballs.result == 'success' &&
1009+
needs.job_get_metadata.outputs.e2e-matrix-optional != '{"include":[]}' && (github.event_name != 'pull_request' ||
10271010
github.event.pull_request.head.repo.full_name == github.repository) && github.actor != 'dependabot[bot]'
1028-
needs: [job_get_metadata, job_build, job_e2e_prepare]
1011+
needs: [job_get_metadata, job_build, job_build_tarballs]
10291012
runs-on: ubuntu-24.04
10301013
timeout-minutes: 15
10311014
env:
@@ -1039,7 +1022,7 @@ jobs:
10391022
E2E_TEST_SENTRY_PROJECT: 'sentry-javascript-e2e-tests'
10401023
strategy:
10411024
fail-fast: false
1042-
matrix: ${{ fromJson(needs.job_e2e_prepare.outputs.matrix-optional) }}
1025+
matrix: ${{ fromJson(needs.job_get_metadata.outputs.e2e-matrix-optional) }}
10431026

10441027
steps:
10451028
- name: Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }})
@@ -1058,16 +1041,10 @@ jobs:
10581041
with:
10591042
dependency_cache_key: ${{ needs.job_build.outputs.dependency_cache_key }}
10601043

1061-
- name: Restore tarball cache
1062-
uses: actions/cache/restore@v5
1063-
id: restore-tarball-cache
1044+
- name: Restore tarball artifacts
1045+
uses: actions/download-artifact@v7
10641046
with:
1065-
path: ${{ github.workspace }}/packages/*/*.tgz
1066-
key: ${{ env.BUILD_CACHE_TARBALL_KEY }}
1067-
1068-
- name: Build tarballs if not cached
1069-
if: steps.restore-tarball-cache.outputs.cache-hit != 'true'
1070-
run: yarn build:tarball
1047+
name: tarball-output
10711048

10721049
- name: Validate Verdaccio
10731050
run: yarn test:validate

.github/workflows/ci-metadata.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ on:
3131
force_skip_cache:
3232
description: 'Whether to skip caching (schedule or ci-skip-cache label)'
3333
value: ${{ jobs.get_metadata.outputs.force_skip_cache }}
34+
e2e-matrix:
35+
description: 'The matrix of E2E test applications to run'
36+
value: ${{ jobs.get_metadata.outputs.e2e-matrix }}
37+
e2e-matrix-optional:
38+
description: 'The matrix of optional E2E test applications to run'
39+
value: ${{ jobs.get_metadata.outputs.e2e-matrix-optional }}
3440

3541
jobs:
3642
get_metadata:
@@ -70,6 +76,20 @@ jobs:
7076
any_code:
7177
- '!**/*.md'
7278
79+
- name: Determine which test applications should be run
80+
id: matrix
81+
run:
82+
yarn --silent ci:build-matrix --base=${{ (github.event_name == 'pull_request' &&
83+
github.event.pull_request.base.sha) || '' }} >> $GITHUB_OUTPUT
84+
working-directory: dev-packages/e2e-tests
85+
86+
- name: Determine which optional E2E test applications should be run
87+
id: matrix-optional
88+
run:
89+
yarn --silent ci:build-matrix-optional --base=${{ (github.event_name == 'pull_request' &&
90+
github.event.pull_request.base.sha) || '' }} >> $GITHUB_OUTPUT
91+
working-directory: dev-packages/e2e-tests
92+
7393
outputs:
7494
commit_label: '${{ env.COMMIT_SHA }}: ${{ env.COMMIT_MESSAGE }}'
7595
# Note: These next three have to be checked as strings ('true'/'false')!
@@ -87,3 +107,5 @@ jobs:
87107
force_skip_cache:
88108
${{ github.event_name == 'schedule' || (github.event_name == 'pull_request' &&
89109
contains(toJSON(github.event.pull_request.labels.*.name), 'ci-skip-cache')) }}
110+
e2e-matrix: ${{ steps.matrix.outputs.matrix }}
111+
e2e-matrix-optional: ${{ steps.matrix-optional.outputs.matrix }}

0 commit comments

Comments
 (0)