Skip to content

Commit 9bca81f

Browse files
committed
chore(e2e): Replace deprecate buildjet with native github cache
Signed-off-by: David Dreschner <david.dreschner@nextcloud.com>
1 parent ae35f81 commit 9bca81f

2 files changed

Lines changed: 31 additions & 20 deletions

File tree

.github/workflows/cypress.yml

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -105,29 +105,19 @@ jobs:
105105
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
106106
with:
107107
node-version: ${{ steps.versions.outputs.nodeVersion }}
108+
cache: 'npm'
109+
cache-dependency-path: '**/package-lock.json'
108110

109111
- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
110112
run: npm i -g 'npm@${{ steps.versions.outputs.npmVersion }}'
111113

112-
- name: Restore npm cache
113-
uses: buildjet/cache/restore@3e70d19e31d6a8030aeddf6ed8dbe601f94d09f4 # v4.0.2
114-
with:
115-
path: ~/.npm
116-
key: node-${{ steps.versions.outputs.nodeVersion }}-npm-${{ steps.versions.outputs.npmVersion }}-${{ hashFiles('**/package-lock.json') }}
117-
118114
- name: Install node dependencies & build app
119115
run: |
120116
npm ci
121117
TESTING=true npm run build --if-present
122118
123-
- name: Save npm cache
124-
uses: buildjet/cache/save@3e70d19e31d6a8030aeddf6ed8dbe601f94d09f4 # v4.0.2
125-
with:
126-
path: ~/.npm
127-
key: node-${{ steps.versions.outputs.nodeVersion }}-npm-${{ steps.versions.outputs.npmVersion }}-${{ hashFiles('**/package-lock.json') }}
128-
129119
- name: Save context
130-
uses: buildjet/cache/save@3e70d19e31d6a8030aeddf6ed8dbe601f94d09f4 # v4.0.2
120+
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
131121
with:
132122
key: cypress-context-${{ github.run_id }}
133123
path: ./
@@ -196,7 +186,7 @@ jobs:
196186
steps:
197187
- name: Restore context
198188
id: cache
199-
uses: buildjet/cache/restore@3e70d19e31d6a8030aeddf6ed8dbe601f94d09f4 # v4.0.2
189+
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
200190
with:
201191
key: cypress-context-${{ github.run_id }}
202192
path: ./
@@ -224,6 +214,8 @@ jobs:
224214
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
225215
with:
226216
node-version: ${{ needs.init.outputs.nodeVersion }}
217+
cache: 'npm'
218+
cache-dependency-path: '**/package-lock.json'
227219

228220
- name: Set up npm ${{ needs.init.outputs.npmVersion }}
229221
run: npm i -g 'npm@${{ needs.init.outputs.npmVersion }}'
@@ -287,6 +279,10 @@ jobs:
287279
path: data.tar
288280

289281
summary:
282+
permissions:
283+
contents: none
284+
pull-requests: none
285+
actions: write
290286
runs-on: ubuntu-latest-low
291287
needs: [init, cypress]
292288

@@ -298,8 +294,8 @@ jobs:
298294
- name: Summary status
299295
run: if ${{ needs.init.result != 'success' || ( needs.cypress.result != 'success' && needs.cypress.result != 'skipped' ) }}; then exit 1; fi
300296

301-
- name: Delete cache on success
302-
uses: buildjet/cache-delete@7184288b8396c4492a56728c47dd286fbd1e96ae # v1
297+
- name: Delete context on success
298+
uses: snnaplab/delete-branch-cache-action@20f7992a7b8b51aa719420d11b32c9d34a5eb362 # v1.0.0
303299
if: needs.init.result == 'success' && needs.cypress.result == 'success'
304300
with:
305-
cache_key: cypress-context-${{ github.run_id }}
301+
key: cypress-context-${{ github.run_id }}

.github/workflows/playwright.yml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,16 @@ jobs:
6262
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
6363
with:
6464
node-version: ${{ steps.versions.outputs.node-version }}
65+
cache: 'npm'
66+
cache-dependency-path: '**/package-lock.json'
6567
- name: Set up npm
6668
run: npm i -g 'npm@${{ steps.versions.outputs.package-manager-version }}'
6769
- name: Install dependencies and build
6870
run: |
6971
npm ci
7072
npm run build --if-present
7173
- name: Save context
72-
uses: buildjet/cache/save@3e70d19e31d6a8030aeddf6ed8dbe601f94d09f4 # v4.0.2
74+
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
7375
with:
7476
key: playwright-context-${{ github.run_id }}
7577
path: ./
@@ -91,7 +93,7 @@ jobs:
9193
steps:
9294
- name: Restore context
9395
id: cache
94-
uses: buildjet/cache/restore@3e70d19e31d6a8030aeddf6ed8dbe601f94d09f4 # v4.0.2
96+
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
9597
with:
9698
key: playwright-context-${{ github.run_id }}
9799
path: ./
@@ -112,6 +114,8 @@ jobs:
112114
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
113115
with:
114116
node-version: ${{ steps.versions.outputs.node-version }}
117+
cache: 'npm'
118+
cache-dependency-path: '**/package-lock.json'
115119

116120
- name: Set up npm
117121
if: steps.cache.outputs.cache-hit != 'true'
@@ -150,13 +154,16 @@ jobs:
150154
merge-reports:
151155
# Merge reports after playwright-tests, even if some shards have failed
152156
if: ${{ !cancelled() }}
157+
permissions:
158+
contents: none
159+
actions: write
153160
needs: [gate, playwright-tests]
154161

155162
runs-on: ubuntu-latest-low
156163
steps:
157164
- name: Restore context
158165
id: cache
159-
uses: buildjet/cache/restore@3e70d19e31d6a8030aeddf6ed8dbe601f94d09f4 # v4.0.2
166+
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
160167
with:
161168
key: playwright-context-${{ github.run_id }}
162169
path: ./
@@ -170,6 +177,8 @@ jobs:
170177
if: steps.cache.outputs.cache-hit != 'true'
171178
with:
172179
node-version: ${{ needs.playwright-tests.outputs.node-version }}
180+
cache: 'npm'
181+
cache-dependency-path: '**/package-lock.json'
173182

174183
- name: Set up npm
175184
if: steps.cache.outputs.cache-hit != 'true'
@@ -202,6 +211,12 @@ jobs:
202211
echo ' 1. Extract the folder from the zip file'
203212
echo ' 2. run "npx playwright show-report name-of-my-extracted-playwright-report"'
204213
214+
- name: Delete context on success
215+
uses: snnaplab/delete-branch-cache-action@20f7992a7b8b51aa719420d11b32c9d34a5eb362 # v1.0.0
216+
if: needs.playwright-tests.result == 'success'
217+
with:
218+
key: playwright-context-${{ github.run_id }}
219+
205220
summary:
206221
permissions:
207222
contents: none

0 commit comments

Comments
 (0)