Skip to content

Commit 32918e9

Browse files
committed
import
1 parent cbbd354 commit 32918e9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+1977
-84
lines changed

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

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ 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
17+
MARKETING_BASE_URL:
18+
description: "The base URL for the marketing application. Defaults to http://localhost:3001"
1419
STAGE:
1520
description: "local, pr, test, or production"
1621
required: true
@@ -28,18 +33,8 @@ runs:
2833
shell: bash
2934
working-directory: ./frontend/apps/marketing
3035
run: |
31-
echo "CONTENTFUL_SPACE_ID=${{ inputs.CONTENTFUL_SPACE_ID }}
32-
CONTENTFUL_ENV_ID=master
33-
CONTENTFUL_API_HOST=cdn.contentful.com
34-
CONTENTFUL_TOKEN=${{ inputs.CONTENTFUL_TOKEN }}
35-
CONTENTFUL_EXPERIENCE_CONTENT_TYPE_ID=experience
36-
APPLITOOLS_API_KEY=${{ inputs.APPLITOOLS_API_KEY }}
37-
" > .env
38-
39-
- name: Build
40-
shell: bash
41-
run: yarn build --filter @code-dot-org/marketing
42-
working-directory: ./frontend
36+
echo "APPLITOOLS_API_KEY=${{ inputs.APPLITOOLS_API_KEY }}
37+
APPLITOOLS_BATCH_ID=${{ inputs.APPLITOOLS_BATCH_ID }}" >> .env
4338
4439
- name: UI Tests
4540
shell: bash
@@ -48,10 +43,18 @@ runs:
4843
run: yarn workspace @code-dot-org/marketing test:ui:ci
4944
working-directory: ./frontend
5045

51-
- name: Upload reports
46+
- name: Upload Playwright reports
5247
if: failure()
5348
id: deployment
5449
uses: actions/upload-pages-artifact@v3
5550
with:
5651
path: frontend/apps/marketing/playwright-report
5752
name: playwright-report
53+
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/actions/frontend/setup/action.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@ runs:
88
shell: bash
99
run: corepack enable
1010

11+
- name: Cache turborepo
12+
uses: actions/cache@v4
13+
with:
14+
path: frontend/.turbo
15+
key: "${{ runner.os }}-turbo-${{ github.sha }}"
16+
restore-keys: |
17+
${{ runner.os }}-turbo-
18+
1119
- uses: actions/setup-node@v4
1220
with:
1321
node-version-file: ".nvmrc"

.github/dependabot.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,6 @@ updates:
6565
codemirror:
6666
patterns:
6767
- "@codemirror/*"
68-
- "codemirror"
69-
- "codemirror-*"
7068
dnd-kit:
7169
patterns:
7270
- "@dnd-kit/*"
Binary file not shown.

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,11 @@ name: Component-Library-CI
22

33
on:
44
workflow_call:
5-
pull_request:
6-
branches:
7-
- staging
8-
- staging-next
9-
paths:
10-
- 'frontend/packages/component-library/**'
11-
- 'frontend/packages/component-library-styles/**'
12-
- 'shared/**'
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
1310

1411
jobs:
1512
build:
@@ -22,6 +19,7 @@ jobs:
2219
frontend
2320
shared/fonts
2421
.github
22+
lfs: true
2523

2624
- name: Setup Frontend
2725
uses: ./.github/actions/frontend/setup
@@ -30,14 +28,14 @@ jobs:
3028
run: npx playwright install --with-deps
3129
working-directory: ./frontend/apps/design-system-storybook
3230

33-
- name: Lint
34-
run: yarn lint --filter @code-dot-org/component-library --filter @code-dot-org/design-system-storybook
35-
working-directory: ./frontend
36-
3731
- name: Build
3832
run: yarn build --filter @code-dot-org/component-library --filter @code-dot-org/design-system-storybook
3933
working-directory: ./frontend
4034

35+
- name: Lint
36+
run: yarn lint --filter @code-dot-org/component-library --filter @code-dot-org/design-system-storybook
37+
working-directory: ./frontend
38+
4139
- name: Unit Tests
4240
run: yarn test --filter @code-dot-org/component-library --filter @code-dot-org/design-system-storybook
4341
working-directory: ./frontend
@@ -67,6 +65,7 @@ jobs:
6765
sparse-checkout: |
6866
frontend
6967
.github
68+
lfs: true
7069

7170
- name: Setup Frontend
7271
uses: ./.github/actions/frontend/setup
@@ -99,6 +98,7 @@ jobs:
9998
continue-on-error: ${{ github.event_name == 'pull_request' }}
10099
env:
101100
APPLITOOLS_API_KEY: ${{ secrets.APPLITOOLS_API_KEY }}
101+
APPLITOOLS_BATCH_ID: ${{ inputs.eyes-batch-id }}
102102

103103
- name: Find Report Comment
104104
if: github.event.pull_request.number
Lines changed: 35 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,44 @@
1-
name: Marketing-CI
1+
name: Frontend-CI
22

33
on:
44
pull_request:
55
branches:
66
- staging
77
- staging-next
88
paths:
9-
- 'frontend/**'
10-
11-
defaults:
12-
run:
13-
shell: bash
14-
working-directory: ./frontend
9+
- 'frontend/**'
1510

1611
jobs:
17-
build:
18-
runs-on: ubuntu-24.04
19-
20-
steps:
21-
- uses: actions/checkout@v4
22-
with:
23-
lfs: true
24-
sparse-checkout: |
25-
frontend
26-
.github
27-
28-
- name: Setup Frontend
29-
uses: ./.github/actions/frontend/setup
30-
31-
- name: Lint
32-
run: yarn lint --filter @code-dot-org/marketing
33-
34-
- name: Build
35-
run: yarn build --filter @code-dot-org/marketing
36-
37-
- name: Unit Tests
38-
run: yarn test --filter @code-dot-org/marketing
39-
40-
ui-tests:
41-
runs-on: ubuntu-24.04
42-
43-
steps:
44-
- uses: actions/checkout@v4
45-
with:
46-
lfs: true
47-
sparse-checkout: |
48-
frontend
49-
.github
50-
51-
- name: Setup Frontend
52-
uses: ./.github/actions/frontend/setup
53-
54-
- name: Build
55-
run: yarn build --filter @code-dot-org/marketing
56-
working-directory: ./frontend
57-
58-
- name: UI Tests
59-
uses: ./.github/actions/frontend/marketing/ui-tests
60-
with:
61-
STAGE: pr
62-
CONTENTFUL_SPACE_ID: ${{ vars.CONTENTFUL_SPACE_ID }}
63-
CONTENTFUL_TOKEN: ${{ secrets.CONTENTFUL_TOKEN}}
64-
APPLITOOLS_API_KEY: ${{ secrets.APPLITOOLS_API_KEY}}
65-
12+
# Generate a UUID that will be used in all eyes tests
13+
eyes-uuid:
14+
runs-on: ubuntu-24.04
15+
outputs:
16+
eyes-batch-id: ${{ steps.generate-uuid.outputs.uuid }}
17+
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]
39+
runs-on: ubuntu-24.04
40+
steps:
41+
- name: Update Applitools batch status
42+
shell: bash
43+
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 }}"

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

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,15 @@ concurrency:
2929

3030
# There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu.
3131
jobs:
32+
ci:
33+
uses: ./.github/workflows/marketing-app-ci.yml
34+
secrets: inherit
35+
3236
# Job: build-and-push-image
3337
# This job builds a docker image for the frontend repository and pushes the docker image to Github Packages.
3438
# More information: https://docs.github.com/en/actions/use-cases-and-examples/publishing-packages/publishing-docker-images
3539
build-and-push-image:
40+
needs: ci
3641
runs-on: ubuntu-24.04
3742

3843
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
@@ -50,9 +55,14 @@ jobs:
5055
steps:
5156
- uses: actions/checkout@v4
5257
with:
53-
sparse-checkout: 'frontend'
58+
sparse-checkout: |
59+
frontend
60+
.github
5461
lfs: true
5562

63+
- name: Setup Frontend
64+
uses: ./.github/actions/frontend/setup
65+
5666
# Uses the `docker/login-action` action to log in to the Container registry registry using the account and password that will publish the packages. Once published, the packages are scoped to the account defined here.
5767
- name: Log in to the Container registry
5868
uses: docker/login-action@v3.3.0
@@ -146,10 +156,15 @@ jobs:
146156
- name: Setup Frontend
147157
uses: ./.github/actions/frontend/setup
148158

159+
- name: Build
160+
run: yarn build --filter @code-dot-org/marketing
161+
working-directory: ./frontend
162+
149163
- name: UI Tests
150164
uses: ./.github/actions/frontend/marketing/ui-tests
151165
with:
152166
STAGE: test
153167
CONTENTFUL_SPACE_ID: ${{ vars.CONTENTFUL_SPACE_ID }}
154168
CONTENTFUL_TOKEN: ${{ secrets.CONTENTFUL_TOKEN}}
155169
APPLITOOLS_API_KEY: ${{ secrets.APPLITOOLS_API_KEY}}
170+
MARKETING_BASE_URL: ${{ vars.MARKETING_BASE_URL }}
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
name: Marketing-CI
2+
3+
on:
4+
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
10+
11+
defaults:
12+
run:
13+
shell: bash
14+
working-directory: ./frontend
15+
16+
jobs:
17+
build:
18+
runs-on: ubuntu-24.04
19+
20+
steps:
21+
- uses: actions/checkout@v4
22+
with:
23+
lfs: true
24+
sparse-checkout: |
25+
frontend
26+
.github
27+
28+
- name: Setup Frontend
29+
uses: ./.github/actions/frontend/setup
30+
31+
- name: Build
32+
run: yarn build --filter @code-dot-org/marketing
33+
34+
dryrun-release:
35+
runs-on: ubuntu-24.04
36+
needs: build
37+
38+
steps:
39+
- uses: actions/checkout@v4
40+
with:
41+
lfs: true
42+
sparse-checkout: |
43+
frontend
44+
.github
45+
46+
- name: Setup Frontend
47+
uses: ./.github/actions/frontend/setup
48+
49+
- name: Dryrun Release
50+
run: yarn release:dryrun --filter @code-dot-org/marketing
51+
52+
ui-tests:
53+
if: ${{ github.event_name == 'pull_request' }}
54+
runs-on: ubuntu-24.04
55+
needs: build
56+
57+
steps:
58+
- uses: actions/checkout@v4
59+
with:
60+
lfs: true
61+
sparse-checkout: |
62+
frontend
63+
.github
64+
65+
- name: Setup Frontend
66+
uses: ./.github/actions/frontend/setup
67+
68+
- name: Build
69+
run: yarn build --filter @code-dot-org/marketing
70+
71+
- name: Build Docker image
72+
id: build-docker-image
73+
uses: docker/build-push-action@v6.10.0
74+
with:
75+
context: frontend
76+
file: frontend/apps/marketing/Dockerfile
77+
tags: marketing:test
78+
push: false
79+
80+
- name: Prepare Test Environment
81+
shell: bash
82+
run: |
83+
echo "CONTENTFUL_SPACE_ID=${{ vars.CONTENTFUL_SPACE_ID }}
84+
CONTENTFUL_ENV_ID=master
85+
CONTENTFUL_API_HOST=cdn.contentful.com
86+
CONTENTFUL_TOKEN=${{ secrets.CONTENTFUL_TOKEN }}
87+
CONTENTFUL_EXPERIENCE_CONTENT_TYPE_ID=experience
88+
HOSTNAME=0.0.0.0
89+
" > .env
90+
91+
- name: Run Docker Container
92+
run: |
93+
docker run -d --env-file .env --rm --name marketing \
94+
-p 3001:3000 \
95+
marketing:test
96+
97+
# Tail the docker logs
98+
docker logs -f marketing &
99+
100+
- name: UI Tests
101+
uses: ./.github/actions/frontend/marketing/ui-tests
102+
with:
103+
STAGE: pr
104+
CONTENTFUL_SPACE_ID: ${{ vars.CONTENTFUL_SPACE_ID }}
105+
CONTENTFUL_TOKEN: ${{ secrets.CONTENTFUL_TOKEN}}
106+
APPLITOOLS_API_KEY: ${{ secrets.APPLITOOLS_API_KEY}}
107+
APPLITOOLS_BATCH_ID: ${{ inputs.eyes-batch-id }}
108+
Loading
Loading

0 commit comments

Comments
 (0)