-
Notifications
You must be signed in to change notification settings - Fork 214
[App Extensibility] Bring back recently-commented-out Github actions (@W-18219092@) #2351
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 52 commits
c72e794
b4703b4
d5d5cc1
fc57780
a2683da
32a38ea
651ad64
b6e961b
42ed6d8
cdf9b69
4f982ca
3a50d09
024c0a8
565fefd
8728f09
08a0ff4
6e64b34
e35e4aa
1158ef2
a2c1732
e03a9dd
74116b7
643927b
2e98294
b92ccff
757aaa6
98d9429
d50e055
6803ca5
570222d
227a949
3f43a4b
3c89a66
5e9ca4f
0ed508a
bbb6698
fc852ce
c9d22b2
56f37c6
b3644eb
81b990a
bbd7914
bfe4f06
1be0723
f27c50f
a7d1eab
f096f6f
cfdc725
5711449
a962651
33a8166
8444352
ea6b108
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,39 @@ | ||
| name: bundlesize | ||
| name: bundle_size_test | ||
| inputs: | ||
| cwd: | ||
| required: true | ||
| config: | ||
| required: true | ||
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: Check bundle size | ||
| - name: Analyze build | ||
| working-directory: ${{ inputs.cwd }} | ||
| run: |- | ||
| npm run test:max-file-size | ||
| npm run analyze-build | ||
| shell: bash | ||
|
|
||
| - name: Check bundle sizes | ||
| working-directory: ${{ inputs.cwd }} | ||
| # NOTE: A bug prevented us from running bundlesize with a config file: | ||
| # npx bundlesize --scope ${{ github.action_path }}/bundlesize.config.json | ||
| # For more details, see https://github.com/siddharthkp/bundlesize/issues/326 | ||
| run: |- | ||
| json_string='${{ inputs.config }}' | ||
|
|
||
| if ! echo "$json_string" | jq '.' > /dev/null 2>&1; then | ||
| echo "::error::Invalid JSON input provided: $json_string" | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Parse the given json string and build the command to run | ||
| echo "$json_string" | jq -r 'to_entries[] | "npx bundlesize -f \"" + .key + "\" -s " + .value' | while IFS= read -r command; do | ||
| echo "Executing: $command" | ||
| eval "$command" | ||
| done | ||
| shell: bash | ||
|
|
||
| - name: Report bundle sizes | ||
| run: |- | ||
| node ./scripts/report-bundle-size.js ${{ inputs.cwd }}/build | ||
| shell: bash |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| name: generate_app_with_preset | ||
| inputs: | ||
| preset: | ||
| required: true | ||
| output_dir: | ||
| required: false | ||
| default: generated_pwa | ||
| runs: | ||
| using: composite | ||
| steps: | ||
| - run: |- | ||
| node packages/pwa-kit-create-app/scripts/create-mobify-app-dev.js --outputDir ${{ inputs.output_dir }} | ||
| shell: bash | ||
| env: | ||
| GENERATOR_PRESET: ${{ inputs.preset }} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,18 @@ | ||
| name: lighthouse_ci | ||
| inputs: | ||
| project_dir: | ||
| required: true | ||
| config_filename: | ||
| required: true | ||
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: Run Lighthouse CI on the PWA | ||
| # This test is flaky, so let's try it three times! | ||
| run: npm run test:lighthouse --prefix packages/template-retail-react-app || npm run test:lighthouse --prefix packages/template-retail-react-app || npm run test:lighthouse --prefix packages/template-retail-react-app | ||
| - name: Run Lighthouse CI | ||
| working-directory: ${{ inputs.project_dir }} | ||
| run: |- | ||
| lighthouse_test="npx @lhci/cli autorun --config=${{ github.action_path }}/${{ inputs.config_filename }}" | ||
| # This test is flaky, so let's try it three times! | ||
| $lighthouse_test || $lighthouse_test || $lighthouse_test | ||
| shell: bash | ||
| env: | ||
| NODE_ENV: production |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| /* | ||
| * Copyright (c) 2021, salesforce.com, inc. | ||
| * All rights reserved. | ||
| * SPDX-License-Identifier: BSD-3-Clause | ||
| * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause | ||
| */ | ||
|
|
||
| module.exports = { | ||
| // The different Lighthouse CI configuration options: | ||
| // https://github.com/GoogleChrome/lighthouse-ci/blob/master/docs/configuration.md | ||
| ci: { | ||
| collect: { | ||
| startServerCommand: 'npm run start', | ||
| //NOTE: Adjust the key pages URLs that you find important to your website. | ||
| url: [ | ||
| 'http://localhost:3000/', | ||
| 'http://localhost:3000/global/en-GB/category/womens', | ||
| 'http://localhost:3000/global/en-GB/product/25493613M', | ||
| 'http://localhost:3000/global/en-GB/search?q=suit' | ||
| ], | ||
| startServerReadyPattern: 'First build complete', | ||
| startServerReadyTimeout: 90000 | ||
| }, | ||
| upload: { | ||
| target: 'temporary-public-storage' | ||
| }, | ||
| assert: { | ||
| aggregationMethod: 'median', | ||
| assertions: { | ||
| // NOTE: Adjust the scores accordingly as the performance is improved | ||
| 'categories:performance': ['error', {minScore: 0.3}], | ||
| 'categories:pwa': ['error', {minScore: 0.9}], | ||
| 'categories:seo': ['error', {minScore: 0.85}], | ||
| 'categories:accessibility': ['error', {minScore: 0.88}] | ||
| } | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,12 @@ | ||
| name: smoke_tests | ||
| name: npm_scripts | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Renaming this CI action to be clearer that we're actually smoke testing the npm scripts (and not retail-react-app site). |
||
| inputs: | ||
| dir: | ||
| required: false | ||
| # The path to a project to test | ||
| default: "./packages/template-retail-react-app" | ||
| cwd: | ||
| required: true | ||
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: Smoke test scripts | ||
| - name: Smoke test the npm scripts | ||
| run: |- | ||
| # Basic smoke-tests for uncommonly run scripts in a project | ||
| node ./scripts/smoke-test-npm-scripts.js --dir "${{ inputs.dir }}" | ||
| node ./scripts/smoke-test-npm-scripts.js --dir "${{ inputs.cwd }}" | ||
| shell: bash | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,27 +3,46 @@ inputs: | |
| cwd: | ||
| required: false | ||
| default: ${{ github.workspace }} | ||
| node: | ||
| required: true | ||
| description: Major node version | ||
| npm: | ||
| required: false | ||
| description: Major npm version | ||
| update_npm: | ||
| required: false | ||
| default: false | ||
| description: "Setup Ubuntu Machine" | ||
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: Setup Node | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: ${{ inputs.node }} | ||
| cache: npm | ||
|
|
||
| - name: Update NPM version | ||
| if: inputs.update_npm == 'true' | ||
| run: |- | ||
| npm install -g npm@${{ inputs.npm }} | ||
| shell: bash | ||
|
|
||
| - name: Verify node and npm versions | ||
| uses: ./.github/actions/verify_node_npm_major_versions | ||
| with: | ||
| node: ${{ inputs.node }} | ||
| npm: ${{ inputs.npm }} | ||
|
|
||
| - name: Install Dependencies | ||
| working-directory: ${{ inputs.cwd }} | ||
| run: |- | ||
| # Install node dependencies | ||
| node ./scripts/gtime.js monorepo_install npm ci | ||
|
|
||
| # Build the PWA | ||
| # npm run lerna -- run analyze-build --scope "@salesforce/retail-react-app" | ||
|
|
||
| # Report bundle sizes | ||
| # node ./scripts/report-bundle-size.js | ||
|
Comment on lines
-16
to
-20
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The bundle-related stuffs are moved to their own action file. Focusing this |
||
|
|
||
| # Install Snyk CLI | ||
| # TODO: Ticket W-12425059. Revisit Snyk CLI integration to monitor manifest files on generated projects. | ||
| # TODO: Latest Snyk CLI version is currently failing on npm i. We use the alternative Snyk GitHub integration. | ||
| # sudo npm install -g snyk | ||
|
|
||
| # Install Lighthouse CI CLI | ||
| sudo npm install -g @lhci/cli | ||
| shell: bash | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| name: verify_node_npm_major_versions | ||
| inputs: | ||
| node: | ||
| required: false | ||
| description: Major node version | ||
| npm: | ||
| required: false | ||
| description: Major npm version | ||
| runs: | ||
| using: composite | ||
| steps: | ||
| - run: |- | ||
| EXPECTED_NODE_VERSION="${{ inputs.node }}" | ||
| EXPECTED_NPM_VERSION="${{ inputs.npm }}" | ||
|
|
||
| FULL_NODE_VERSION=$(node -v) | ||
| FULL_NPM_VERSION=$(npm -v) | ||
| # Parse out the _major_ versions | ||
| INSTALLED_NODE_VERSION=$(echo $FULL_NODE_VERSION | sed 's/^v\([0-9]*\).*/\1/') | ||
| INSTALLED_NPM_VERSION=$(echo $FULL_NPM_VERSION | sed 's/^\([0-9]*\).*/\1/') | ||
|
|
||
| if [ -n "$EXPECTED_NODE_VERSION" ]; then | ||
| if [ "$INSTALLED_NODE_VERSION" != "$EXPECTED_NODE_VERSION" ]; then | ||
| echo "The node version is incorrect. Expected: v$EXPECTED_NODE_VERSION, but found: v$INSTALLED_NODE_VERSION" | ||
| exit 1 | ||
| fi | ||
| fi | ||
|
|
||
| if [ -n "$EXPECTED_NPM_VERSION" ]; then | ||
| if [ "$INSTALLED_NPM_VERSION" != "$EXPECTED_NPM_VERSION" ]; then | ||
| echo "The npm version is incorrect. Expected: $EXPECTED_NPM_VERSION, but found: $INSTALLED_NPM_VERSION" | ||
| exit 1 | ||
| fi | ||
| fi | ||
|
|
||
| echo "Node/npm version check completed successfully." | ||
| echo "Installed node version: $FULL_NODE_VERSION" | ||
| echo "Installed npm version: $FULL_NPM_VERSION" | ||
| shell: bash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious: Does the CI fail if these scores aren't met or do we just report the results and continue ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the lines below, we chose to use
error(instead ofwarn), so CI will fail. And it will also report the result and continue because the lighthouse test runs in a separate job.