Skip to content

Commit 8fe81f6

Browse files
Merge pull request #60323 from nextcloud/carl/cypress-rebuild-app-if-cache-missing
feat(cypress): Rebuild app if cache is missing
2 parents 4eb8bc8 + 416bc31 commit 8fe81f6

1 file changed

Lines changed: 32 additions & 1 deletion

File tree

.github/workflows/cypress.yml

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,12 +147,31 @@ jobs:
147147

148148
steps:
149149
- name: Restore context
150+
id: cache
150151
uses: buildjet/cache/restore@3e70d19e31d6a8030aeddf6ed8dbe601f94d09f4 # v4.0.2
151152
with:
152-
fail-on-cache-miss: true
153153
key: cypress-context-${{ github.run_id }}
154154
path: ./
155155

156+
- name: Checkout server
157+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
158+
if: steps.cache.outputs.cache-hit != 'true'
159+
with:
160+
persist-credentials: false
161+
# We need to checkout submodules for 3rdparty
162+
submodules: true
163+
164+
- name: Check composer.json
165+
id: check_composer
166+
if: steps.cache.outputs.cache-hit != 'true'
167+
uses: andstor/file-existence-action@558493d6c74bf472d87c84eab196434afc2fa029 # v3.1.0
168+
with:
169+
files: 'composer.json'
170+
171+
- name: Install composer dependencies
172+
if: steps.check_composer.outputs.files_exists == 'true' && steps.cache.outputs.cache-hit != 'true'
173+
run: composer install --no-dev
174+
156175
- name: Set up node ${{ needs.init.outputs.nodeVersion }}
157176
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
158177
with:
@@ -161,6 +180,12 @@ jobs:
161180
- name: Set up npm ${{ needs.init.outputs.npmVersion }}
162181
run: npm i -g 'npm@${{ needs.init.outputs.npmVersion }}'
163182

183+
- name: Install node dependencies & build app
184+
if: steps.cache.outputs.cache-hit != 'true'
185+
run: |
186+
npm ci
187+
TESTING=true npm run build --if-present
188+
164189
- name: Install cypress
165190
run: ./node_modules/cypress/bin/cypress install
166191

@@ -224,3 +249,9 @@ jobs:
224249
steps:
225250
- name: Summary status
226251
run: if ${{ needs.init.result != 'success' || ( needs.cypress.result != 'success' && needs.cypress.result != 'skipped' ) }}; then exit 1; fi
252+
253+
- name: Delete cache on success
254+
uses: buildjet/cache-delete@7184288b8396c4492a56728c47dd286fbd1e96ae # v1
255+
if: needs.init.result == 'success' && needs.cypress.result == 'success'
256+
with:
257+
cache_key: cypress-context-${{ github.run_id }}

0 commit comments

Comments
 (0)