1111 branches :
1212 - master
1313 workflow_dispatch :
14- inputs :
15- debug-enabled :
16- type : boolean
17- description : ' Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
18- required : false
19- default : false
2014
2115concurrency :
2216 group : ${{ github.workflow }}-${{ github.event.number || github.ref }}
@@ -27,25 +21,18 @@ jobs:
2721 runs-on : ${{ matrix.os }}
2822 strategy :
2923 matrix :
30- os :
31- - ubuntu-latest
32- - windows-latest
33- node_version :
34- - 20
35- - 18
36- exclude :
37- - os : windows-latest
38- node_version : 18
24+ os : [ubuntu-latest, macos-latest, windows-latest]
25+ node : [20]
3926
40- name : Cache install (${{ matrix.os }}, node v${{ matrix.node_version }})
27+ name : Cache install (${{ matrix.os }}, node v${{ matrix.node }})
4128 steps :
4229 - name : Checkout
4330 uses : actions/checkout@v4
4431
4532 - name : Set node
4633 uses : actions/setup-node@v4
4734 with :
48- node-version : ${{ matrix.node_version }}
35+ node-version : ${{ matrix.node }}
4936 cache : ' yarn'
5037
5138 - name : Cache node_modules
5441 with :
5542 lookup-only : true
5643 path : ' **/node_modules'
57- key : ${{ runner .os }}-modules-${{ matrix.node_version }}-${{ github.run_id }}
44+ key : ${{ matrix .os }}-modules-${{ matrix.node }}-${{ github.run_id }}
5845
5946 - name : Install packages
6047 if : steps.cache-modules.outputs.cache-hit != 'true'
@@ -68,91 +55,141 @@ jobs:
6855 timeout-minutes : 90
6956 strategy :
7057 matrix :
71- os :
72- - ubuntu-latest
73- - windows-latest
74- node_version :
75- - 20
76- - 18
77- package_manager :
78- - npm
79- # - yarn
80- # - pnpm
81- project :
82- - nx-payload-e2e
58+ os : [ubuntu-latest, macos-latest, windows-latest]
59+ node : [20]
60+ pm : [npm, pnpm, yarn]
61+ project : [nx-payload-e2e]
8362 include :
84- # os short names
85- - os : ubuntu-latest
86- os_name : ' Linux'
87- - os : windows-latest
88- os_name : ' Windows'
89- # test timeouts
90- - os : ubuntu-latest
91- os_timeout : 60
92- - os : windows-latest
93- os_timeout : 60
94- # configurations
9563 - os : ubuntu-latest
96- configuration : ' '
64+ name : Linux
65+ timeout : 30
66+ configuration : ' skip-docker'
67+ verdaccio : localhost
68+ - os : macos-latest
69+ name : macOS
70+ timeout : 30
71+ configuration : skip-docker
9772 - os : windows-latest
98- # will skip docker build test since node image doesn't exist running inside a windows container
99- configuration : ' windows'
73+ name : Windows
74+ timeout : 60
75+ configuration : skip-docker
10076 exclude :
101- # windows: only npm 20
102- - os : windows-latest
103- package_manager : yarn
77+ - os : macos-latest
78+ pm : pnpm
79+ - os : macos-latest
80+ pm : yarn
10481 - os : windows-latest
105- package_manager : pnpm
82+ pm : pnpm
10683 - os : windows-latest
107- node_version : 18
84+ pm : yarn
10885 fail-fast : false
10986
110- name : E2E ${{ matrix.os_name }}/${{ matrix.package_manager }}/${{ matrix.node_version }} ${{ join(matrix.project) }}
87+ name : E2E ${{ matrix.os }}/${{ matrix.pm }}/${{ matrix.node }} ${{ join(matrix.project) }}
11188 steps :
11289 - name : Checkout
11390 uses : actions/checkout@v4
11491
115- - name : Use Node.js ${{ matrix.node_version }}
92+ - name : Install PNPM
93+ run : npm install -g @pnpm/exe@8
94+
95+ - name : Use Node.js ${{ matrix.node }}
11696 uses : actions/setup-node@v4
11797 with :
118- node-version : ${{ matrix.node_version }}
98+ node-version : ${{ matrix.node }}
11999 cache : ' yarn'
120100
121101 - name : Cache node_modules
122102 id : cache-modules
123103 uses : actions/cache@v4
124104 with :
125105 path : ' **/node_modules'
126- key : ${{ runner.os }}-modules-${{ matrix.node_version }}-${{ github.run_id }}
106+ key : ${{ runner.os }}-modules-${{ matrix.node }}-${{ github.run_id }}
127107
128108 - name : Install packages
129109 run : yarn install --immutable
130110
131- - name : Set starting timestamp
132- id : before-e2e
133- run : |
134- echo "timestamp=$(date +%s)" >> $GITHUB_OUTPUT
135-
136111 - name : Run e2e tests
137112 id : e2e-run
138113 run : yarn nx e2e ${{ matrix.project }} -c ${{ matrix.configuration }}
139- timeout-minutes : ${{ matrix.os_timeout }}
114+ timeout-minutes : ${{ matrix.timeout }}
140115 env :
116+ CDWR_E2E_PACKAGE_MANAGER : ${{ matrix.pm }}
117+ CDWR_E2E_VERDACCIO_HOST : ${{ matrix.verdaccio }}
118+ CDWR_DEBUG_LOGGING : ' true'
141119 NX_CACHE_DIRECTORY : ' tmp'
142120 NX_PERF_LOGGING : ' false'
143- NX_NO_CLOUD : ${{ contains(github.head_ref || github.ref_name, 'renovate') }}
121+ NX_NO_CLOUD : ${{ contains(github.head_ref || github.ref_name, 'renovate') || vars.NX_NO_CLOUD == 'true' }}
144122 # NX_DAEMON defaults to 'true' unless explicitly set to 'false'
145123 NX_DAEMON : ${{ env.NX_DAEMON == 'false' && 'false' || 'true' }}
146124 # NX_VERBOSE_LOGGING defaults to 'false' unless explicitly set to 'true'
147- NX_VERBOSE_LOGGING : ${{ env.NX_VERBOSE_LOGGING == 'true' && 'true' || 'false' }}
148- E2E_PACKAGE_MANAGER : ${{ env.E2E_PACKAGE_MANAGER }}
125+ NX_VERBOSE_LOGGING : ${{ vars.NX_VERBOSE_LOGGING == 'true' && 'true' || 'false' }}
126+ # Yarn workarounds
127+ YARN_ENABLE_HARDENED_MODE : ${{ vars.YARN_ENABLE_HARDENED_MODE == 'true' && 1 || 0 }}
128+ # TODO: fix flaky yarn lock issues when running `create-nx-workspace`
129+ YARN_ENABLE_IMMUTABLE_INSTALLS : ${{ vars.YARN_ENABLE_IMMUTABLE_INSTALLS }}
130+ - name : Save test result
131+ if : always()
132+ run : |
133+ echo '{"os": "${{ matrix.os }}", "pm": "${{ matrix.pm }}", "node": "${{ matrix.node }}", "configuration": "${{ matrix.configuration }}", "status": "${{ job.status }}"}' > results-${{ matrix.os }}-${{ matrix.pm }}-${{ matrix.node }}.json
134+ shell : bash
149135
150- - name : Setup tmate session
151- if : ${{ github.event_name == 'workflow_dispatch' && inputs.debug-enabled && failure() }}
152- uses : mxschmitt/action-tmate@v3.18
153- timeout-minutes : 15
154- env :
155- # disable sudo for windows debugging
156- sudo : ${{ matrix.os != 'windows-latest' }}
136+ - name : Upload test results
137+ if : always()
138+ uses : actions/upload-artifact@v4
139+ with :
140+ name : results-${{ matrix.os }}-${{ matrix.pm }}-${{ matrix.node }}
141+ path : results-${{ matrix.os }}-${{ matrix.pm }}-${{ matrix.node }}.json
142+
143+ summary :
144+ name : E2E Test Summary
145+ needs : e2e
146+ runs-on : ubuntu-latest
147+ if : always()
148+ steps :
149+ - name : Download all workflow run artifacts
150+ uses : actions/download-artifact@v4
157151 with :
158- sudo : ${{ env.sudo }}
152+ path : artifacts
153+ pattern : results-*
154+ merge-multiple : true
155+ - name : Create summary
156+ run : |
157+ echo "# E2E Test Results Summary" > summary.md
158+ echo "" >> summary.md
159+ echo "| OS | Package Manager | Node Version | Configuration | Status |" >> summary.md
160+ echo "|----|-----------------|--------------| ------------ | ------ |" >> summary.md
161+ for artifact in artifacts/*.json; do
162+ if [ -f "$artifact" ]; then
163+ os=$(jq -r '.os' "$artifact")
164+ pm=$(jq -r '.pm' "$artifact")
165+ configuration=$(jq -r '.configuration' "$artifact")
166+ node=$(jq -r '.node' "$artifact")
167+ status=$(jq -r '.status' "$artifact")
168+ echo "| $os | $pm | $node | $configuration | $status |" >> summary.md
169+ fi
170+ done
171+
172+ echo "" >> summary.md
173+ echo "## Detailed Results" >> summary.md
174+ echo "" >> summary.md
175+ echo "<details><summary>Click to expand</summary>" >> summary.md
176+ for artifact in artifacts/*.json; do
177+ echo "$(basename $artifact)" >> summary.md
178+ echo "" >> summary.md
179+ echo '```json' >> summary.md
180+ echo "" >> summary.md
181+ jq -s '.' $artifact >> summary.md
182+ echo "" >> summary.md
183+ echo '```' >> summary.md
184+ echo "" >> summary.md
185+ done
186+ echo "</details>" >> summary.md
187+
188+ - name : Upload summary artifact
189+ uses : actions/upload-artifact@v4
190+ with :
191+ name : e2e-test-summary
192+ path : summary.md
193+
194+ - name : Output summary
195+ run : cat summary.md >> $GITHUB_STEP_SUMMARY
0 commit comments