Skip to content

Commit d5d7688

Browse files
nextcloud-commandChartman123
authored andcommitted
ci(actions): Update workflow templates from organization template repository
Signed-off-by: GitHub <noreply@github.com> Signed-off-by: Christian Hartmann <chris-hartmann@gmx.de>
1 parent 1d739cc commit d5d7688

2 files changed

Lines changed: 193 additions & 59 deletions

File tree

.github/actions-lock.txt

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,21 @@
33
fe1239ed98a163abbdea3e0490c85458 appstore-build-publish.yml
44
e6351c608939c31ae1e32923aa82aa10 dependabot-approve-merge.yml
55
2581a67c5bcdcd570427e6d51db767d7 fixup.yml
6-
985f3ac7d51405c1601c742832a14120 lint-eslint.yml
6+
dc0ae733f35c60274937c2647c027d46 lint-eslint.yml
77
43fd0c5fb704cabc5f11cdfaf513236d lint-info-xml.yml
88
4b40dd0073e16f74dd04e6d49dcc043d lint-php-cs.yml
99
cfb31e47b6e9ab65e76c89b028754a4e lint-php.yml
1010
ab3a506506b1d7c1cea9593ecfd84366 lint-stylelint.yml
11-
3b1f38e378f8e764b0b3c560a8cfe1cd node-test.yml
11+
d5f511793e785e83842609afc0317b24 node-test.yml
1212
65678bf15deefb099dea5410459a7c17 openapi.yml
13-
076e72a19e7bdf35ac5b2abee0198c43 phpunit-mariadb.yml
14-
8fab08ac7da700ee304af0bf3c18b3a3 phpunit-mysql.yml
15-
bbe9834ddb89207caf5e19d79ebb3672 phpunit-oci.yml
16-
256bf1dead4ef8479e9ce7433f871548 phpunit-pgsql.yml
17-
4ca2c2c4b1a73182667bab908e57c185 phpunit-sqlite.yml
13+
43fe311fa443cc05bca150d30148e656 phpunit-mariadb.yml
14+
6d20bb9054bf13310aaa1bf98025b3d9 phpunit-mysql.yml
15+
a9366230d0b876662fb0ab124ba586af phpunit-oci.yml
16+
33e50146debe0922d4e176f22d949aa1 phpunit-pgsql.yml
17+
869cf6703da576578e5d1774aa87d837 phpunit-sqlite.yml
1818
d1821b8a816578070ed8fd018f321f6d pr-feedback.yml
1919
43878db2acac51746332618c9f731553 psalm-matrix.yml
2020
6aa9eaa284ed1800168c96b97e90d582 rector-apply.yml
2121
2dbec18233063b42f4d8e03bbb43671c reuse.yml
22-
94c65e30a77686c079c6dfa54a008440 sync-workflow-templates.yml
22+
b47a9fe981a7435caea92db33f5ad121 sync-workflow-templates.yml
23+
0d4a72e82e345087f423a23cd06ab28c playwright.yml

.github/workflows/playwright.yml

Lines changed: 184 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,195 @@
1-
# SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
1+
# This workflow is provided via the organization template repository
2+
#
3+
# https://github.com/nextcloud/.github
4+
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
5+
#
6+
# SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
27
# SPDX-License-Identifier: MIT
8+
9+
# This workflow runs Playwright tests on pull requests to the master and stable branches.
10+
# It expects the following npm scripts to be defined in package.json:
11+
# - "playwright": runs the Playwright tests
12+
# - "playwright:install-ci": installs the Playwright browsers for CI (optional)
13+
#
14+
# If you only use the "Desktop Chrome" browser with "channel: chrome" in your Playwright config,
15+
# you can skip the "playwright:install-ci" script as the GitHub Actions runner already has Chrome Browser installed.
16+
#
17+
# For merging the reports, it expects a Playwright merge config file at tests/playwright/merge.config.ts.
18+
# You can adjust the path in the "Merge into HTML Report" step if you have a different location for the merge config file.
19+
# The default configuration would look like this:
20+
# ```js
21+
# export default {
22+
# testDir: 'tests/playwright/e2e', // path to your Playwright tests
23+
# reporter: [['html', { open: 'never' }]],
24+
# }
25+
# ```
26+
327
name: Playwright Tests
28+
429
on:
530
pull_request:
6-
branches: [main]
31+
branches:
32+
- main
33+
- stable5.3
734

835
permissions:
936
contents: read
37+
concurrency:
38+
group: node-${{ github.head_ref || github.run_id }}
39+
cancel-in-progress: true
1040

1141
jobs:
12-
test:
13-
timeout-minutes: 60
42+
playwright-setup:
43+
timeout-minutes: 10
44+
name: Playwright setup
45+
runs-on: ubuntu-latest
46+
steps:
47+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
48+
with:
49+
persist-credentials: false
50+
- name: Read package.json
51+
uses: nextcloud-libraries/parse-package-engines-action@122ae05d4257008180a514e1ddeb0c1b9d094bdd # v0.1.0
52+
id: versions
53+
- name: Set up node
54+
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
55+
with:
56+
node-version: ${{ steps.versions.outputs.node-version }}
57+
- name: Set up npm
58+
run: npm i -g 'npm@${{ steps.versions.outputs.package-manager-version }}'
59+
- name: Install dependencies and build
60+
run: |
61+
npm ci
62+
npm run build --if-present
63+
- name: Save context
64+
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
65+
with:
66+
key: playwright-context-${{ github.run_id }}
67+
path: ./
68+
69+
playwright-tests:
70+
needs: [playwright-setup]
71+
timeout-minutes: 30
72+
name: Playwright tests ${{ matrix.shardIndex }} / ${{ matrix.shardTotal }}
1473
runs-on: ubuntu-latest
74+
strategy:
75+
fail-fast: false
76+
matrix:
77+
shardIndex: [1, 2] # adjust to your needs
78+
shardTotal: [2]
79+
outputs:
80+
node-version: ${{ steps.versions.outputs.node-version }}
81+
package-manager-version: ${{ steps.versions.outputs.package-manager-version }}
82+
83+
steps:
84+
- name: Restore context
85+
id: cache
86+
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
87+
with:
88+
key: playwright-context-${{ github.run_id }}
89+
path: ./
90+
91+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
92+
if: steps.cache.outputs.cache-hit != 'true'
93+
with:
94+
persist-credentials: false
95+
96+
- name: Read package.json
97+
uses: nextcloud-libraries/parse-package-engines-action@122ae05d4257008180a514e1ddeb0c1b9d094bdd # v0.1.0
98+
id: versions
99+
100+
- name: Set up node
101+
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
102+
with:
103+
node-version: ${{ steps.versions.outputs.node-version }}
104+
105+
- name: Set up npm
106+
run: npm i -g 'npm@${{ steps.versions.outputs.package-manager-version }}'
107+
108+
- name: Install dependencies and build
109+
if: steps.cache.outputs.cache-hit != 'true'
110+
run: |
111+
npm ci
112+
npm run build --if-present
113+
114+
- name: Install Playwright browsers
115+
run: npm run playwright:install-ci --if-present
116+
117+
- name: Run Playwright tests
118+
run: npm run playwright -- --shard='${{ matrix.shardIndex }}/${{ matrix.shardTotal }}'
119+
120+
- name: Upload blob report to GitHub Actions Artifacts
121+
if: ${{ !cancelled() }}
122+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
123+
with:
124+
name: blob-report-${{ matrix.shardIndex }}
125+
path: blob-report
126+
retention-days: 1
127+
128+
merge-reports:
129+
# Merge reports after playwright-tests, even if some shards have failed
130+
if: ${{ !cancelled() }}
131+
needs: [playwright-tests]
132+
133+
runs-on: ubuntu-latest-low
134+
steps:
135+
- name: Restore context
136+
id: cache
137+
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
138+
with:
139+
key: playwright-context-${{ github.run_id }}
140+
path: ./
141+
142+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
143+
if: steps.cache.outputs.cache-hit != 'true'
144+
with:
145+
persist-credentials: false
146+
147+
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
148+
if: steps.cache.outputs.cache-hit != 'true'
149+
with:
150+
node-version: ${{ needs.playwright-tests.outputs.node-version }}
151+
152+
- name: Set up npm
153+
if: steps.cache.outputs.cache-hit != 'true'
154+
run: npm i -g 'npm@${{ needs.playwright-tests.outputs.package-manager-version }}'
155+
156+
- name: Install dependencies
157+
if: steps.cache.outputs.cache-hit != 'true'
158+
run: npm ci
159+
160+
- name: Download blob reports from GitHub Actions Artifacts
161+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
162+
with:
163+
path: all-blob-reports
164+
pattern: blob-report-*
165+
merge-multiple: true
166+
167+
- name: Merge into HTML Report
168+
run: npx playwright merge-reports --config tests/playwright/merge.config.ts --reporter html,github ./all-blob-reports
169+
170+
- name: Upload HTML report
171+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
172+
with:
173+
name: html-report--attempt-${{ github.run_attempt }}
174+
path: playwright-report
175+
retention-days: 7
176+
177+
- name: How to show the logs
178+
run: |
179+
echo 'To view the report:'
180+
echo ' 1. Extract the folder from the zip file'
181+
echo ' 2. run "npx playwright show-report name-of-my-extracted-playwright-report"'
182+
183+
summary:
184+
permissions:
185+
contents: none
186+
runs-on: ubuntu-latest-low
187+
needs: [playwright-tests]
188+
189+
if: always()
190+
191+
name: playwright-test-summary
192+
15193
steps:
16-
- name: Checkout app
17-
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
18-
with:
19-
persist-credentials: false
20-
21-
- name: Check composer.json
22-
id: check_composer
23-
uses: andstor/file-existence-action@558493d6c74bf472d87c84eab196434afc2fa029 # v2
24-
with:
25-
files: 'composer.json'
26-
27-
- name: Install composer dependencies
28-
if: steps.check_composer.outputs.files_exists == 'true'
29-
run: composer install --no-dev
30-
31-
- name: Read package.json node and npm engines version
32-
uses: skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3
33-
id: versions
34-
with:
35-
fallbackNode: '^20'
36-
fallbackNpm: '^10'
37-
38-
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
39-
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
40-
with:
41-
node-version: ${{ steps.versions.outputs.nodeVersion }}
42-
43-
- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
44-
run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}"
45-
46-
- name: Install node dependencies & build app
47-
run: |
48-
npm ci
49-
TESTING=true npm run build --if-present
50-
51-
- name: Install Playwright Browsers
52-
run: npx playwright install chromium --only-shell
53-
54-
- name: Run Playwright tests
55-
run: npx playwright test
56-
57-
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
58-
if: always()
59-
with:
60-
name: playwright-report
61-
path: playwright-report/
62-
retention-days: 30
194+
- name: Summary status
195+
run: if ${{ needs.playwright-tests.result != 'success' }}; then exit 1; fi

0 commit comments

Comments
 (0)