Skip to content

Commit deaffa7

Browse files
authored
Merge branch 'develop' into bendvc/make-mcp-independent
2 parents 7bc13d4 + 2259b4f commit deaffa7

File tree

25 files changed

+491
-82
lines changed

25 files changed

+491
-82
lines changed

.github/actions/e2e_generate_app/action.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,24 @@ inputs:
1010
required: false
1111
type: string
1212

13+
outputs:
14+
project_path:
15+
description: Path to the generated project directory
16+
value: ${{ steps.generate_project.outputs.project_path }}
17+
1318
runs:
1419
using: composite
1520
steps:
1621
- name: Generate new project based on project-key
22+
id: generate_project
1723
run: |
1824
COMMAND="node e2e/scripts/generate-project.js --project-key ${{ inputs.PROJECT_KEY }}"
1925
if [[ -n "${{ inputs.TEMPLATE_VERSION }}" ]]; then
2026
COMMAND="$COMMAND --templateVersion ${{ inputs.TEMPLATE_VERSION }}"
2127
fi
2228
$COMMAND
29+
30+
# Return path to the generated project
31+
GENERATED_PROJECTS_DIR=$(node -e "console.log(require('./e2e/config.js').GENERATED_PROJECTS_DIR)")
32+
echo "project_path=$GENERATED_PROJECTS_DIR/${{ inputs.PROJECT_KEY }}" >> $GITHUB_OUTPUT
2333
shell: bash

.github/actions/generate_app/action.yml

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ inputs:
2222
project_dir:
2323
description: Project Directory
2424

25+
outputs:
26+
project_path:
27+
description: Path to the generated project directory
28+
value: ${{ steps.generate_project.outputs.project_path }}
29+
2530
runs:
2631
using: composite
2732
steps:
@@ -31,20 +36,20 @@ runs:
3136
run: |
3237
use_extensibility_input="${{ inputs.use_extensibility }}"
3338
if [ "use_extensibility_input" = "true" ]; then
34-
use_extensibility_value=2
35-
else
3639
use_extensibility_value=1
40+
else
41+
use_extensibility_value=2
3742
fi
38-
echo "USE_EXTENSIBILITY_VALUE=$use_extensibility_value" >> $GITHUB_ENV
39-
43+
echo "USE_EXTENSIBILITY_VALUE=$use_extensibility_value" >> $GITHUB_ENV
44+
4045
is_private_client_input="${{ inputs.is_private_client }}"
4146
if [ "$is_private_client_input" = "true" ]; then
4247
is_private_client_value=1
4348
else
4449
is_private_client_value=2
4550
fi
4651
echo "IS_PRIVATE_CLIENT_VALUE=$is_private_client_value" >> $GITHUB_ENV
47-
52+
4853
setup_hybrid_input="${{ inputs.setup_hybrid }}"
4954
if [ "$setup_hybrid_input" = "true" ]; then
5055
setup_hybrid_value=2
@@ -53,6 +58,8 @@ runs:
5358
fi
5459
echo "SETUP_HYBRID_VALUE=$setup_hybrid_value" >> $GITHUB_ENV
5560
61+
# TODO: update this to use the standard input feature that Ben created recently
62+
# TODO: this action does not finish successfully because of a dirty-workspace error, due to creating this generator-responses.json
5663
- name: Build project generator inputs
5764
id: build_generator_inputs
5865
shell: bash
@@ -107,11 +114,16 @@ runs:
107114
run: |
108115
cat generator-responses.json
109116
node e2e/scripts/generate-project.js --project-config "$(jq -c . generator-responses.json)"
117+
118+
# Return path to the generated project
119+
GENERATED_PROJECTS_DIR=$(node -e "console.log(require('./e2e/config.js').GENERATED_PROJECTS_DIR)")
120+
echo "project_path=$GENERATED_PROJECTS_DIR/${{ inputs.project_dir }}" >> $GITHUB_OUTPUT
110121
shell: bash
111122

123+
# TODO: I think we can safely delete this step. We already install the dependencies in the previous step.
112124
- name: Build generated project
113125
id: build_generated_project
114-
working-directory: ../generated-projects/${{ inputs.project_dir }}
126+
working-directory: ${{ steps.generate_project.outputs.project_path }}
115127
run: |-
116128
npm ci
117129
npm run build

.github/workflows/bundle-size.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# WARNING! Conditionals are set as variables to minimize repetitive checks.
2+
# However, this results in the variables being the *string* values "true" or "false".
3+
# As a result, you must always explicitly check for those strings. For example,
4+
# ${{ env.DEVELOP }} will ALWAYS evaluate as true; to achieve the expected result
5+
# you must check ${{ env.DEVELOP == 'true' }}. There's probably a better way to DRY,
6+
# but this is what we have for now.
7+
8+
name: SalesforceCommerceCloud/pwa-kit/bundle-size
9+
on:
10+
pull_request: # Default: opened, reopened, synchronize (head branch updated)
11+
merge_group: # Trigger GA workflow when a pull request is added to a merge queue.
12+
push:
13+
branches:
14+
- develop
15+
- 'release-*'
16+
17+
jobs:
18+
pwa-kit-bundle-size:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
24+
- name: Setup Node
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: 22 # Use latest LTS version for bundle size check
28+
cache: npm
29+
30+
- name: Setup Ubuntu Machine
31+
uses: "./.github/actions/setup_ubuntu"
32+
33+
- name: Run bundlesize test
34+
uses: "./.github/actions/bundle_size_test"
35+

.github/workflows/deploy_latest_release.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ jobs:
7070
node ./scripts/gtime.js monorepo_install npm ci
7171
7272
- name: Generate Retail App Demo
73+
id: generate_app
7374
uses: ./.github/actions/e2e_generate_app
7475
with:
7576
PROJECT_KEY: ${{ matrix.environment.project_key }}
@@ -94,7 +95,7 @@ jobs:
9495
- name: Push Bundle to MRT (${{matrix.environment.name}})
9596
uses: "./.github/actions/push_to_mrt"
9697
with:
97-
CWD: "../generated-projects/${{ matrix.environment.project_key }}"
98+
CWD: ${{ steps.generate_app.outputs.project_path }}
9899
TARGET: ${{ matrix.environment.target }}
99100
PROJECT: ${{ matrix.environment.project }}
100101
MESSAGE: ${{ env.BUNDLE_NAME }})

.github/workflows/e2e-pr.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ jobs:
6464
echo "retail_app_template_version=$version" >> "$GITHUB_ENV"
6565
6666
- name: Generate Retail App Private Client
67+
id: generate_app
6768
if: ${{ env.SKIP_WORKFLOW != 'true' }}
6869
uses: ./.github/actions/e2e_generate_app
6970
with:
@@ -89,7 +90,7 @@ jobs:
8990
if: ${{ env.SKIP_WORKFLOW != 'true' }}
9091
uses: './.github/actions/push_to_mrt'
9192
with:
92-
CWD: '../generated-projects/retail-app-no-ext'
93+
CWD: ${{ steps.generate_app.outputs.project_path }}
9394
# TODO: Use the MRT target ID from the target lock step above.
9495
TARGET: e2e-tests-pwa-kit
9596
FLAGS: --wait

.github/workflows/e2e.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ jobs:
114114
echo "retail_app_template_version=$version" >> "$GITHUB_ENV"
115115
116116
- name: Generate Retail App Without Extensibility
117+
id: generate_app_no_ext
117118
uses: ./.github/actions/e2e_generate_app
118119
with:
119120
PROJECT_KEY: "retail-app-no-ext"
@@ -134,7 +135,7 @@ jobs:
134135
- name: Push Bundle to MRT (E2E Test PWA Kit)
135136
uses: "./.github/actions/push_to_mrt"
136137
with:
137-
CWD: "../generated-projects/retail-app-no-ext"
138+
CWD: ${{ steps.generate_app_no_ext.outputs.project_path }}
138139
TARGET: e2e-tests-pwa-kit
139140
FLAGS: --wait
140141

@@ -231,6 +232,7 @@ jobs:
231232
echo "retail_app_template_version=$version" >> "$GITHUB_ENV"
232233
233234
- name: Generate Retail App With Extensibility
235+
id: generate_app_ext
234236
uses: ./.github/actions/e2e_generate_app
235237
with:
236238
PROJECT_KEY: "retail-app-ext"
@@ -251,7 +253,7 @@ jobs:
251253
- name: Push Bundle to MRT (E2E Test PWA Kit)
252254
uses: "./.github/actions/push_to_mrt"
253255
with:
254-
CWD: "../generated-projects/retail-app-ext"
256+
CWD: ${{ steps.generate_app_ext.outputs.project_path }}
255257
TARGET: e2e-tests-pwa-kit
256258
FLAGS: --wait
257259

@@ -346,6 +348,7 @@ jobs:
346348
echo "retail_app_template_version=$version" >> "$GITHUB_ENV"
347349
348350
- name: Generate Retail App Private Client
351+
id: generate_app_private_client
349352
uses: ./.github/actions/e2e_generate_app
350353
with:
351354
PROJECT_KEY: "retail-app-private-client"
@@ -366,7 +369,7 @@ jobs:
366369
- name: Push Bundle to MRT
367370
uses: "./.github/actions/push_to_mrt"
368371
with:
369-
CWD: "../generated-projects/retail-app-private-client"
372+
CWD: ${{ steps.generate_app_private_client.outputs.project_path }}
370373
TARGET: e2e-pwa-kit-private
371374
FLAGS: --wait
372375

.github/workflows/lint.yml

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
# WARNING! Conditionals are set as variables to minimize repetitive checks.
2+
# However, this results in the variables being the *string* values "true" or "false".
3+
# As a result, you must always explicitly check for those strings. For example,
4+
# ${{ env.DEVELOP }} will ALWAYS evaluate as true; to achieve the expected result
5+
# you must check ${{ env.DEVELOP == 'true' }}. There's probably a better way to DRY,
6+
# but this is what we have for now.
7+
8+
name: SalesforceCommerceCloud/pwa-kit/lint
9+
on:
10+
pull_request: # Default: opened, reopened, synchronize (head branch updated)
11+
merge_group: # Trigger GA workflow when a pull request is added to a merge queue.
12+
push:
13+
branches:
14+
- develop
15+
- 'release-*'
16+
17+
jobs:
18+
pwa-kit-lint:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
24+
- name: Setup Node
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: 22 # Use latest LTS version for linting
28+
cache: npm
29+
30+
- name: Setup Ubuntu Machine
31+
uses: "./.github/actions/setup_ubuntu"
32+
33+
- name: Run linting
34+
uses: "./.github/actions/linting"
35+
36+
generated-project-lint:
37+
strategy:
38+
fail-fast: false
39+
matrix:
40+
template: [retail-react-app-test-project, retail-react-app-demo]
41+
runs-on: ubuntu-latest
42+
env:
43+
PROJECT_DIR: generated-${{ matrix.template }}
44+
steps:
45+
- name: Checkout
46+
uses: actions/checkout@v4
47+
48+
- name: Setup Node
49+
uses: actions/setup-node@v4
50+
with:
51+
node-version: 22
52+
cache: npm
53+
54+
- name: Setup Ubuntu Machine
55+
uses: "./.github/actions/setup_ubuntu"
56+
57+
- name: Generate ${{ matrix.template }} project
58+
run: |-
59+
node packages/pwa-kit-create-app/scripts/create-mobify-app-dev.js --outputDir ${{ env.PROJECT_DIR }}
60+
env:
61+
GENERATOR_PRESET: ${{ matrix.template }}
62+
timeout-minutes: 8
63+
64+
- name: Lint the generated project
65+
uses: "./.github/actions/linting"
66+
with:
67+
cwd: ${{ env.PROJECT_DIR }}
68+
69+
- name: Store Verdaccio logfile artifact
70+
uses: actions/upload-artifact@v4
71+
with:
72+
name: verdaccio-log-lint-${{ matrix.template }}
73+
path: packages/pwa-kit-create-app/local-npm-repo/verdaccio-${{ matrix.template }}.log
74+
75+
generated-project-lint-windows:
76+
strategy:
77+
fail-fast: false
78+
matrix:
79+
template: [retail-react-app-test-project, retail-react-app-demo]
80+
runs-on: windows-latest
81+
env:
82+
PROJECT_DIR: generated-${{ matrix.template }}
83+
steps:
84+
- name: Checkout
85+
uses: actions/checkout@v4
86+
87+
- name: Setup Node
88+
uses: actions/setup-node@v4
89+
with:
90+
node-version: 22
91+
cache: npm
92+
93+
- name: Setup Windows Machine
94+
uses: "./.github/actions/setup_windows"
95+
96+
- name: Generate ${{ matrix.template }} project
97+
run: |-
98+
node packages/pwa-kit-create-app/scripts/create-mobify-app-dev.js --outputDir ${{ env.PROJECT_DIR }}
99+
env:
100+
GENERATOR_PRESET: ${{ matrix.template }}
101+
timeout-minutes: 7
102+
103+
- name: Lint the generated project
104+
uses: "./.github/actions/linting"
105+
with:
106+
cwd: ${{ env.PROJECT_DIR }}
107+
108+
- name: Store Verdaccio logfile artifact
109+
uses: actions/upload-artifact@v4
110+
with:
111+
name: verdaccio-log-lint-windows-${{ matrix.template }}
112+
path: packages/pwa-kit-create-app/local-npm-repo/verdaccio-windows-${{ matrix.template }}.log
113+
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: SalesforceCommerceCloud/pwa-kit/performance-metrics
2+
3+
on:
4+
workflow_dispatch: # Allows you to manually run the workflow on any branch.
5+
schedule:
6+
# Run every day at 7pm (PST) - cron uses UTC times.
7+
# We want to run it before the performance tests are scheduled to run.
8+
# Runs on the default branch.
9+
- cron: '0 3 * * *'
10+
11+
jobs:
12+
run-performance-metrics:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
18+
- name: Setup Node
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: 22
22+
cache: npm
23+
24+
- name: Install Monorepo Dependencies
25+
run: |-
26+
npm ci
27+
28+
- name: Generate App
29+
id: generate_app
30+
uses: ./.github/actions/e2e_generate_app
31+
with:
32+
PROJECT_KEY: "retail-react-app-performance-tests"
33+
34+
- name: Create MRT credentials file
35+
uses: './.github/actions/create_mrt'
36+
with:
37+
mobify_user: ${{ secrets.MOBIFY_STG_CLIENT_USER }}
38+
mobify_api_key: ${{ secrets.MOBIFY_STG_CLIENT_API_KEY }}
39+
40+
- name: Push Bundle to MRT
41+
uses: './.github/actions/push_to_mrt'
42+
with:
43+
CWD: '${{ steps.generate_app.outputs.project_path }}'
44+
PROJECT: q4-pwa-perf-develop
45+
TARGET: production
46+
FLAGS: --wait --cloud-origin https://cloud-testing.mobify-staging.com

.github/workflows/setup_pwa_manual.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,6 @@ jobs:
8989
with:
9090
project_id: ${{ github.event.inputs.project_id }}
9191
target_id: ${{ github.event.inputs.mrt_target_id }}
92-
project_dir: "../generated-projects/${{ env.PROJECT_DIR }}"
92+
project_dir: "${{ steps.generate_app.outputs.project_path }}"
9393
mobify_user: ${{ secrets.MOBIFY_CLIENT_USER }}
9494
mobify_api_key: ${{ secrets.MOBIFY_CLIENT_API_KEY }}

0 commit comments

Comments
 (0)