Skip to content

Commit b470c26

Browse files
committed
chore: improve playwright ci feedback and caching
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent 253f17e commit b470c26

1 file changed

Lines changed: 45 additions & 2 deletions

File tree

.github/workflows/playwright.yml

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,8 @@ jobs:
138138
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
139139
with:
140140
node-version: ${{ steps.versions.outputs.nodeVersion }}
141+
cache: npm
142+
cache-dependency-path: apps/${{ env.APP_NAME }}/package-lock.json
141143

142144
- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
143145
run: npm i -g 'npm@${{ steps.versions.outputs.npmVersion }}'
@@ -147,9 +149,27 @@ jobs:
147149
env:
148150
CYPRESS_INSTALL_BINARY: 0
149151
run: |
150-
npm ci
152+
npm ci --prefer-offline
151153
TESTING=true npm run build --if-present
152154
155+
- name: Cache Playwright browsers
156+
id: playwright-cache
157+
uses: actions/cache@v4
158+
with:
159+
path: ~/.cache/ms-playwright
160+
key: ${{ runner.os }}-playwright-${{ hashFiles(format('apps/{0}/package-lock.json', env.APP_NAME)) }}
161+
restore-keys: |
162+
${{ runner.os }}-playwright-
163+
164+
- name: Cache LibreSign binary payloads
165+
id: libresign-binaries-cache
166+
uses: actions/cache@v4
167+
with:
168+
path: .cache/libresign-binaries
169+
key: ${{ runner.os }}-libresign-binaries-${{ hashFiles(format('apps/{0}/appinfo/install-*.json', env.APP_NAME), format('apps/{0}/lib/Service/Install/InstallService.php', env.APP_NAME)) }}
170+
restore-keys: |
171+
${{ runner.os }}-libresign-binaries-
172+
153173
- name: Set up Nextcloud
154174
run: |
155175
sudo echo "127.0.0.1 mailpit" | sudo tee -a /etc/hosts
@@ -161,6 +181,14 @@ jobs:
161181
--admin-pass admin
162182
./occ --version
163183
184+
- name: Restore cached LibreSign binaries
185+
if: steps.libresign-binaries-cache.outputs.cache-hit == 'true'
186+
run: |
187+
instance_id="$(./occ config:system:get instanceid)"
188+
target_dir="data/appdata_${instance_id}/libresign"
189+
mkdir -p "$target_dir"
190+
cp -a .cache/libresign-binaries/. "$target_dir/"
191+
164192
- name: Install app dependencies
165193
run: |
166194
git clone --depth 1 -b ${{ matrix.server-versions }} https://github.com/nextcloud/notifications apps/notifications
@@ -193,6 +221,16 @@ jobs:
193221
--l="Rio de Janeiro"
194222
./occ user:setting admin settings email admin@email.tld
195223
224+
- name: Refresh cached LibreSign binaries snapshot
225+
run: |
226+
instance_id="$(./occ config:system:get instanceid)"
227+
source_dir="data/appdata_${instance_id}/libresign"
228+
rm -rf .cache/libresign-binaries
229+
mkdir -p .cache/libresign-binaries
230+
if [ -d "$source_dir" ]; then
231+
cp -a "$source_dir"/. .cache/libresign-binaries/
232+
fi
233+
196234
- name: Start PHP built-in server
197235
run: |
198236
# front_controller_active tells Nextcloud to generate clean URLs (without index.php prefix)
@@ -202,9 +240,14 @@ jobs:
202240
timeout 30 bash -c 'until curl -s http://localhost:8080/status.php > /dev/null; do sleep 1; done'
203241
echo "Nextcloud is ready at http://localhost:8080"
204242
243+
- name: Install Playwright system dependencies
244+
working-directory: apps/${{ env.APP_NAME }}
245+
run: npx playwright install-deps chromium
246+
205247
- name: Install Playwright browsers
248+
if: steps.playwright-cache.outputs.cache-hit != 'true'
206249
working-directory: apps/${{ env.APP_NAME }}
207-
run: npx playwright install chromium --with-deps
250+
run: npx playwright install chromium
208251

209252
- name: Run Playwright tests
210253
working-directory: apps/${{ env.APP_NAME }}

0 commit comments

Comments
 (0)