Skip to content

Commit 0c88d28

Browse files
committed
Add setupNode YML
1 parent 0bbd8fa commit 0c88d28

2 files changed

Lines changed: 54 additions & 18 deletions

File tree

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Set up Node
2+
description: Set up Node
3+
4+
inputs:
5+
IS_HYBRID_BUILD:
6+
description: "Indicates if node is set up for hybrid app"
7+
required: false
8+
default: 'false'
9+
10+
outputs:
11+
cache-hit:
12+
description: Was there a cache hit on the main node_modules?
13+
value: ${{ steps.cache-node-modules.outputs.cache-hit }}
14+
15+
runs:
16+
using: composite
17+
steps:
18+
- name: Remove E/App version from package-lock.json
19+
shell: bash
20+
run: jq 'del(.version, .packages[""].version)' package-lock.json > normalized-package-lock.json
21+
22+
- uses: actions/setup-node@v4
23+
with:
24+
node-version-file: '.nvmrc'
25+
cache: npm
26+
cache-dependency-path: |
27+
normalized-package-lock.json
28+
29+
- id: cache-node-modules
30+
# v4
31+
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57
32+
with:
33+
path: node_modules
34+
key: ${{format('{0}-node-modules-{1}', runner.os, hashFiles('package-lock.json', 'patches/**'))}}
35+
36+
- name: Install root project node packages
37+
if: steps.cache-node-modules.outputs.cache-hit != 'true'
38+
uses: nick-fields/retry@3f757583fb1b1f940bc8ef4bf4734c8dc02a5847
39+
with:
40+
timeout_minutes: 30
41+
max_attempts: 3
42+
command: npm ci

.github/workflows/reassurePerfTests.yml

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,27 +20,21 @@ jobs:
2020

2121
# v4
2222
- name: Setup Node
23-
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e
24-
with:
25-
node-version-file: '.nvmrc'
23+
uses: ./.github/actions/composite/setupNode
2624

27-
- name: Run Reassure baseline tests
28-
shell: bash
29-
run: |
30-
BASELINE_BRANCH=${BASELINE_BRANCH:="main"}
31-
git fetch origin "$BASELINE_BRANCH" --no-tags --depth=1
32-
git switch "$BASELINE_BRANCH"
33-
npm install --force || (rm -rf node_modules && npm install --force)
34-
NODE_OPTIONS=--experimental-vm-modules npx reassure --baseline
25+
- name: Run reassure baseline tests
26+
run: npx reassure --baseline
3527

36-
- name: Run Reassure delta tests
37-
shell: bash
28+
- name: Checkout PR head ref
3829
run: |
39-
git switch --force --detach -
40-
git merge --no-commit --allow-unrelated-histories "$BASELINE_BRANCH" -X ours
41-
git checkout --ours .
42-
npm install --force || (rm -rf node_modules && npm install --force)
43-
NODE_OPTIONS=--experimental-vm-modules npx reassure --branch
30+
git fetch origin ${{ github.event.pull_request.head.ref }} --no-tags --depth=1
31+
git switch --force --detach ${{ github.event.pull_request.head.ref }}
32+
33+
- name: Reinstall node_modules
34+
run: npm install --force
35+
36+
- name: Run reassure delta tests
37+
run: npx reassure --branch
4438

4539
- name: Validate output.json
4640
id: validateReassureOutput

0 commit comments

Comments
 (0)