Skip to content

Commit 9a137b0

Browse files
committed
import
1 parent 32918e9 commit 9a137b0

File tree

6 files changed

+164
-165
lines changed

6 files changed

+164
-165
lines changed

.github/actions/frontend/marketing/ui-tests/action.yml

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ inputs:
1111
APPLITOOLS_API_KEY:
1212
description: "Applitools API Key"
1313
required: true
14-
APPLITOOLS_BATCH_ID:
15-
description: "Applitools Batch ID"
16-
required: true
1714
MARKETING_BASE_URL:
1815
description: "The base URL for the marketing application. Defaults to http://localhost:3001"
1916
STAGE:
@@ -33,8 +30,7 @@ runs:
3330
shell: bash
3431
working-directory: ./frontend/apps/marketing
3532
run: |
36-
echo "APPLITOOLS_API_KEY=${{ inputs.APPLITOOLS_API_KEY }}
37-
APPLITOOLS_BATCH_ID=${{ inputs.APPLITOOLS_BATCH_ID }}" >> .env
33+
echo "APPLITOOLS_API_KEY=${{ inputs.APPLITOOLS_API_KEY }}" >> .env
3834
3935
- name: UI Tests
4036
shell: bash
@@ -51,10 +47,3 @@ runs:
5147
path: frontend/apps/marketing/playwright-report
5248
name: playwright-report
5349

54-
- name: Run Google Lighthouse Audits
55-
uses: treosh/lighthouse-ci-action@2f8dda6cf4de7d73b29853c3f29e73a01e297bd8
56-
with:
57-
urls: ${{ inputs.MARKETING_BASE_URL || 'http://localhost:3001' }}/en-US/all-the-things
58-
uploadArtifacts: true
59-
temporaryPublicStorage: true
60-
configPath: './frontend/apps/marketing/.lighthouserc.js'

.github/workflows/component-library-ci.yml

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@ name: Component-Library-CI
22

33
on:
44
workflow_call:
5-
inputs:
6-
eyes-batch-id:
7-
description: "The consistent batch id for Eyes to use to reference all eyes tests for this PR"
8-
required: true
9-
type: string
105

116
jobs:
127
build:
@@ -79,12 +74,10 @@ jobs:
7974
run: |
8075
EYES_REPORT=$(COREPACK_ENABLE_DOWNLOAD_PROMPT=0 yarn eyes-storybook)
8176
echo "$EYES_REPORT"
82-
8377
# Send multiline report to environment var
8478
echo "EYES_REPORT<<EOF" >> $GITHUB_OUTPUT
8579
echo "$EYES_REPORT" >> $GITHUB_OUTPUT
8680
echo "EOF" >> $GITHUB_OUTPUT
87-
8881
# Check if the report was successful, failing if not.
8982
if echo "$EYES_REPORT" | grep -q "✅"; then
9083
echo "✅ Eyes report was successful, exiting with 0"
@@ -93,12 +86,10 @@ jobs:
9386
echo "❌ Eyes report unsuccessful, exiting with 1"
9487
exit 1
9588
fi
96-
9789
working-directory: ./frontend/apps/design-system-storybook
9890
continue-on-error: ${{ github.event_name == 'pull_request' }}
9991
env:
10092
APPLITOOLS_API_KEY: ${{ secrets.APPLITOOLS_API_KEY }}
101-
APPLITOOLS_BATCH_ID: ${{ inputs.eyes-batch-id }}
10293

10394
- name: Find Report Comment
10495
if: github.event.pull_request.number
@@ -122,4 +113,4 @@ jobs:
122113
with:
123114
comment-id: ${{ steps.eyes-report-comment.outputs.comment-id }}
124115
edit-mode: replace
125-
body: ${{ steps.eyes.outputs.EYES_REPORT }}
116+
body: ${{ steps.eyes.outputs.EYES_REPORT }}

.github/workflows/frontend-ci.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Common workflow for execution of continuous integration for the `frontend` code base.
2+
# This workflow handles setup and teardown for parallel workflow execution for the various apps and packages in `frontend`.
3+
name: Frontend-CI
4+
5+
on:
6+
pull_request:
7+
branches:
8+
- staging
9+
- staging-next
10+
paths:
11+
- 'frontend/**'
12+
13+
env:
14+
APPLITOOLS_BATCH_ID: ${{ github.event.pull_request.head.sha || github.sha }}
15+
16+
jobs:
17+
# Initializes common variables and environment prior to executing other jobs
18+
setup:
19+
runs-on: ubuntu-24.04
20+
outputs:
21+
component-library-changed: ${{ steps.changes.outputs.component-library }}
22+
steps:
23+
# Determine what changed to later skip workflows
24+
# Github Actions does not offer conditional runtime path filtering, thus use this action to calculate the
25+
# changes. Root level applications (such as marketing) are not skipped as its dependency tree always changes
26+
- name: Get Change Sets
27+
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
28+
id: changes
29+
with:
30+
filters: |
31+
component-library:
32+
- 'frontend/apps/design-system-storybook/**'
33+
- 'frontend/packages/component-library/**'
34+
- 'frontend/packages/component-library-styles/**'
35+
- 'frontend/packages/fonts/**'
36+
- 'frontend/*'
37+
38+
# Start the marketing app CI workflow
39+
marketing:
40+
needs: setup
41+
uses: ./.github/workflows/marketing-app-ci.yml
42+
secrets: inherit
43+
44+
# Start the component library CI workflow
45+
component-library:
46+
if: ${{ needs.setup.outputs.component-library-changed == 'true' }}
47+
needs: setup
48+
uses: ./.github/workflows/component-library-ci.yml
49+
secrets: inherit
50+
51+
# Common teardown actions that must occur after _all_ workflows have completed.
52+
# For example, closing the Applitools batch after its completion.
53+
teardown:
54+
needs: [setup, marketing, component-library]
55+
if: always()
56+
runs-on: ubuntu-24.04
57+
steps:
58+
# Close the eyes batch after all distributed eyes tests have completed
59+
- name: Update Applitools batch status
60+
shell: bash
61+
run: |
62+
curl -X POST "https://eyesapi.applitools.com/api/externals/github/servers/github.com/commit/${{ env.APPLITOOLS_BATCH_ID }}/${{ github.run_id }}/complete?apiKey=${{secrets.APPLITOOLS_API_KEY}}"
Lines changed: 99 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,109 @@
1-
name: Frontend-CI
1+
name: Marketing-CI
22

33
on:
4-
pull_request:
5-
branches:
6-
- staging
7-
- staging-next
8-
paths:
9-
- 'frontend/**'
4+
workflow_call:
5+
6+
defaults:
7+
run:
8+
shell: bash
9+
working-directory: ./frontend
1010

1111
jobs:
12-
# Generate a UUID that will be used in all eyes tests
13-
eyes-uuid:
12+
build:
13+
runs-on: ubuntu-24.04
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
with:
18+
lfs: true
19+
sparse-checkout: |
20+
frontend
21+
.github
22+
23+
- name: Setup Frontend
24+
uses: ./.github/actions/frontend/setup
25+
26+
- name: Build
27+
run: yarn build --filter @code-dot-org/marketing
28+
29+
dryrun-release:
1430
runs-on: ubuntu-24.04
15-
outputs:
16-
eyes-batch-id: ${{ steps.generate-uuid.outputs.uuid }}
31+
needs: build
32+
1733
steps:
18-
- name: Generate Eyes Batch ID
19-
id: generate-uuid
20-
run: echo "uuid=$(uuidgen)" >> $GITHUB_OUTPUT
21-
22-
marketing:
23-
needs: eyes-uuid
24-
uses: ./.github/workflows/orig-marketing-app-ci.yml
25-
secrets: inherit
26-
with:
27-
eyes-batch-id: ${{ needs.eyes-uuid.outputs.eyes-batch-id }}
28-
29-
component-library:
30-
needs: eyes-uuid
31-
uses: ./.github/workflows/component-library-ci.yml
32-
secrets: inherit
33-
with:
34-
eyes-batch-id: ${{ needs.eyes-uuid.outputs.eyes-batch-id }}
35-
36-
eyes-close-batch:
37-
# Close the eyes batch after all distributed eyes tests have completed
38-
needs: [eyes-uuid, marketing, component-library]
34+
- uses: actions/checkout@v4
35+
with:
36+
lfs: true
37+
sparse-checkout: |
38+
frontend
39+
.github
40+
41+
- name: Setup Frontend
42+
uses: ./.github/actions/frontend/setup
43+
44+
- name: Dryrun Release
45+
run: yarn release:dryrun --filter @code-dot-org/marketing
46+
47+
ui-tests:
48+
if: ${{ github.event_name == 'pull_request' }}
3949
runs-on: ubuntu-24.04
50+
needs: build
51+
4052
steps:
41-
- name: Update Applitools batch status
53+
- uses: actions/checkout@v4
54+
with:
55+
lfs: true
56+
sparse-checkout: |
57+
frontend
58+
.github
59+
60+
- name: Setup Frontend
61+
uses: ./.github/actions/frontend/setup
62+
63+
- name: Build
64+
run: yarn build --filter @code-dot-org/marketing
65+
66+
- name: Build Docker image
67+
id: build-docker-image
68+
uses: docker/build-push-action@v6.10.0
69+
with:
70+
context: frontend
71+
file: frontend/apps/marketing/Dockerfile
72+
tags: marketing:test
73+
push: false
74+
75+
- name: Prepare Test Environment
4276
shell: bash
4377
run: |
44-
curl -v -X DELETE "https://eyesapi.applitools.com/api/sessions/batches/${{ needs.eyes-uuid.outputs.eyes-batch-id }}/close/bypointerid?apiKey=${{ secrets.APPLITOOLS_API_KEY }}"
78+
echo "CONTENTFUL_SPACE_ID=${{ vars.CONTENTFUL_SPACE_ID }}
79+
CONTENTFUL_ENV_ID=master
80+
CONTENTFUL_API_HOST=cdn.contentful.com
81+
CONTENTFUL_TOKEN=${{ secrets.CONTENTFUL_TOKEN }}
82+
CONTENTFUL_EXPERIENCE_CONTENT_TYPE_ID=experience
83+
HOSTNAME=0.0.0.0
84+
" > .env
85+
86+
- name: Run Docker Container
87+
run: |
88+
docker run -d --env-file .env --rm --name marketing \
89+
-p 3001:3000 \
90+
marketing:test
91+
92+
# Tail the docker logs
93+
docker logs -f marketing &
94+
95+
- name: UI Tests
96+
uses: ./.github/actions/frontend/marketing/ui-tests
97+
with:
98+
STAGE: pr
99+
CONTENTFUL_SPACE_ID: ${{ vars.CONTENTFUL_SPACE_ID }}
100+
CONTENTFUL_TOKEN: ${{ secrets.CONTENTFUL_TOKEN}}
101+
APPLITOOLS_API_KEY: ${{ secrets.APPLITOOLS_API_KEY}}
102+
103+
- name: Run Google Lighthouse Audits
104+
uses: treosh/lighthouse-ci-action@2f8dda6cf4de7d73b29853c3f29e73a01e297bd8
105+
with:
106+
urls: ${{ inputs.MARKETING_BASE_URL || 'http://localhost:3001' }}/en-US/all-the-things
107+
uploadArtifacts: true
108+
temporaryPublicStorage: true
109+
configPath: './frontend/apps/marketing/.lighthouserc.js'

.github/workflows/marketing-app-cicd.yml renamed to .github/workflows/marketing-app-deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Future iterations of this workflow will include a matrix strategy to build and publish Docker images for all apps that have Dockerfiles.
33

44
# The name does not use spaces due to https://github.com/integrations/slack/issues/1790
5-
name: Marketing-App-CICD
5+
name: Marketing-App-Deploy
66

77
# Configures this workflow to run every time a change is pushed to `frontend`
88
on:

0 commit comments

Comments
 (0)