Skip to content

Commit e36b348

Browse files
committed
ci: production workflow fixes (#2440)
- Move from yarn cache:clean to yarn nx reset for clarity and to prevent unexpected regressions when changes made to package.json - Additional comment blocks in production workflow - Add size change reporting - should add details to the build console if we want to see changes to main - Remove built asset download for publish site as it's duplicative & add the storybook fallback task to after the site build so it isn't overwritten by the site clean
1 parent d6de839 commit e36b348

File tree

4 files changed

+42
-23
lines changed

4 files changed

+42
-23
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ jobs:
105105

106106
- name: Reset nx cache to prevent cross-machine errors
107107
shell: bash
108-
run: yarn cache:clean
108+
run: yarn nx reset
109109

110110
## --- BUILD --- ##
111111
- name: Build components

.github/workflows/production.yml

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
name: Build and verify production
2+
# -------------------------------------------------------------
3+
# This workflow will build and verify pull requests. It will:
4+
# - Build the main branch
5+
# - Report on the compiled output
6+
# - Run visual regression tests
7+
# - Publish the PR branch to Netlify
8+
# -------------------------------------------------------------
9+
210

311
on:
412
push:
@@ -16,32 +24,53 @@ defaults:
1624
run:
1725
shell: bash
1826

19-
# todo: this could add deploy steps as well
2027
jobs:
28+
# -------------------------------------------------------------
29+
# Validate build for various environments
30+
# -------------------------------------------------------------
2131
build:
32+
name: Build
2233
strategy:
2334
fail-fast: false
2435
matrix:
2536
system:
2637
- macos-latest
2738
- ubuntu-latest
39+
# - windows-latest
2840
node-version:
2941
- 18
30-
name: Build
3142
uses: ./.github/workflows/build.yml
3243
with:
33-
ref: ${{ github.sha }}
3444
system: ${{ matrix.system }}
3545
node-version: ${{ matrix.node-version }}
3646
secrets: inherit
3747

38-
# Run VRT on ALL pushes to main
48+
# -------------------------------------------------------------
49+
# Report on the compiled assets
50+
# -------------------------------------------------------------
51+
report:
52+
name: Report
53+
needs: [build]
54+
uses: ./.github/workflows/compare-results.yml
55+
with:
56+
head-sha: ${{ needs.build.outputs.head-sha }}
57+
secrets: inherit
58+
59+
# -------------------------------------------------------------
60+
# RUN VISUAL REGRESSION TESTS --- #
61+
# Run VRT on all pushes to main
62+
# -------------------------------------------------------------
63+
3964
vrt:
4065
name: Testing
4166
needs: [build]
4267
uses: ./.github/workflows/vrt.yml
4368
secrets: inherit
4469

70+
# -------------------------------------------------------------
71+
# PUBLISH TO NETLIFY --- #
72+
# Publish to netlify by leveraging the previous build and then building the site as well
73+
# -------------------------------------------------------------
4574
publish_site:
4675
name: Publish
4776
# The build step ensures we are leveraging the cache for the build
@@ -52,6 +81,7 @@ jobs:
5281
secrets: inherit
5382

5483
todo_to_issue:
84+
name: Add issues for new TODOs
5585
runs-on: ubuntu-latest
5686
timeout-minutes: 5
5787
steps:

.github/workflows/publish-site.yml

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -75,31 +75,20 @@ jobs:
7575

7676
- name: Reset nx cache to prevent cross-machine errors
7777
shell: bash
78-
run: yarn cache:clean
78+
run: yarn nx reset
7979

8080
## --- BUILD --- ##
81-
- name: Check for built assets
82-
continue-on-error: true
83-
id: download
84-
uses: actions/download-artifact@v4
85-
with:
86-
path: |
87-
components/*/dist/**
88-
tokens/dist/**
89-
ui-icons/dist/**
90-
name: ubuntu-latest-node18-compiled-assets-${{ steps.set-SHAs.outputs.head }}
91-
92-
- name: Build storybook site
93-
if: ${{ inputs.storybook-url == '' }}
94-
shell: bash
95-
run: yarn ci:storybook --output-dir ../dist/preview
96-
9781
- name: Build docs site
9882
shell: bash
9983
run: yarn build:site
10084
env:
10185
CHROMATIC_URL: ${{ inputs.storybook-url }}
10286

87+
- name: Build storybook site
88+
if: ${{ inputs.storybook-url == '' }}
89+
shell: bash
90+
run: yarn ci:storybook --output-dir ../dist/preview
91+
10392
## --- DEPLOY WEBSITE TO NETLIFY --- ##
10493
- name: Deploy
10594
uses: nwtgck/actions-netlify@v2

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ yarn start
331331

332332
This will spin up the local development environment ([Storybook](https://storybook.js.org/docs/web-components/get-started/introduction)). Editing any of the `.css` or the `.stories.js` files in `components/*` will live reload in your browser.
333333

334-
This project is leveraging caching from [Nx](https://nx.dev/) to speed up the build process. If you are seeing unexpected results, you can clear the cache by running `yarn cache:clean`.
334+
This project is leveraging caching from [Nx](https://nx.dev/) to speed up the build process. If you are seeing unexpected results, you can clear the cache by running `yarn nx reset`.
335335

336336
### Tasks
337337

0 commit comments

Comments
 (0)