4040 if : steps.node_modules_cache.outputs.cache-hit != 'true'
4141 run : npm ci
4242
43+ - name : Check if artifact exists
44+ id : check_node_modules_artifact
45+ run : |
46+ ARTIFACT_NAME="modern-node-modules-${{ hashFiles('**/package-lock.json') }}"
47+ ARTIFACT_EXISTS=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
48+ "https://api.github.com/repos/${{ github.repository }}/actions/artifacts" | \
49+ jq --arg name "$ARTIFACT_NAME" '.artifacts[] | select(.name == $name) | .id' | wc -l)
50+
51+ echo "artifact_exists=$ARTIFACT_EXISTS" >> $GITHUB_ENV
52+
53+ if [ "$ARTIFACT_EXISTS" -gt "0" ]; then
54+ echo "artifact_exists=true" >> $GITHUB_OUTPUT
55+ else
56+ echo "artifact_exists=false" >> $GITHUB_OUTPUT
57+ fi
58+
59+ - name : Upload node_modules to artifacts
60+ if : steps.check_node_modules_artifact.outputs.artifact_exists == 'false'
61+ uses : actions/upload-artifact@v4
62+ with :
63+ name : modern-node-modules-${{ hashFiles('**/package-lock.json') }}
64+ path : node_modules
65+
4366 # This job is used to run tests on modern Node.js versions
4467 # 1. Use default Node.js
4568 # 2. Install latest dependencies
@@ -77,6 +100,17 @@ jobs:
77100 umd
78101 key : ${{ runner.os }}-modern-build-output-${{ github.sha }}
79102
103+ - name : Upload build output to artifacts
104+ uses : actions/upload-artifact@v4
105+ with :
106+ name : ${{ runner.os }}-modern-build-output-${{ github.sha }}
107+ path : |
108+ tslib
109+ lib
110+ es
111+ es-legacy
112+ umd
113+
80114 build-legacy-node :
81115 if : ${{ inputs.use-matrix == true }}
82116 runs-on : ubuntu-latest
@@ -203,11 +237,15 @@ jobs:
203237 run-e2e-tests :
204238 if : ${{ inputs.use-matrix == true }}
205239 runs-on : ubuntu-latest
240+ # needs: build-modern-node
206241 # Use Playwright container for E2E tests, which has all dependencies and all browsers installed
207- container : mcr.microsoft.com/playwright:v1.52.0-jammy
208- env :
209- # fix Firefox permission issue (Firefox is unable to launch if the $HOME folder isn't owned by the current user)
210- HOME : /root
242+ # container: mcr.microsoft.com/playwright:v1.52.0-jammy
243+ # env:
244+ # # fix Firefox permission issue (Firefox is unable to launch if the $HOME folder isn't owned by the current user)
245+ # HOME: /root
246+ # strategy:
247+ # matrix:
248+ # browser: [chrome, firefox, webkit, edge]
211249 steps :
212250 - uses : actions/checkout@v4
213251
@@ -216,16 +254,36 @@ jobs:
216254 with :
217255 node-version : ${{ vars.DEFAULT_NODE_VERSION }}
218256 cache : ' npm'
219- cache-dependency-path : ' **/package-lock.json'
257+
258+ - name : Install Playwright dependencies
259+ run : npx playwright install-deps webkit
260+
261+ # - name: Restore modern node_modules cache
262+ # uses: actions/cache@v4
263+ # with:
264+ # path: |
265+ # node_modules
266+ # key: ${{ runner.os }}-modern-node-modules-${{ hashFiles('**/package-lock.json') }}
220267
221268 - name : Install dependencies
222269 run : npm ci
223270
271+ - name : Install playwright browsers
272+ run : npx playwright install
273+
274+ # - name: Download build output from artifacts
275+ # id: download_build_output
276+ # uses: actions/download-artifact@v4
277+ # continue-on-error: true
278+ # with:
279+ # name: ${{ runner.os }}-modern-build-output-${{ github.sha }}
280+
224281 - name : Build package
282+ # if: steps.download_build_output.outcome != 'success'
225283 run : npm run build
226284
227285 - name : Run e2e tests
228- run : npm run e2e
286+ run : npm run task:run- e2e
229287
230288 # Run tests on single specified Node.js version
231289 run-jest-single :
0 commit comments