@@ -24,107 +24,31 @@ concurrency:
2424 cancel-in-progress : ${{ github.event_name == 'pull_request' }}
2525
2626jobs :
27- Playwright :
28- name : Playwright test on PHP 8.1
29- runs-on : ubuntu-22.04
27+ playwright-default :
3028 if : github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'run-tests')
31- steps :
32- - name : Checkout source code
33- uses : actions/checkout@v4
34-
35- - name : Set up PHP
36- uses : codesnippetspro/setup-php@v2
37- with :
38- php-version : " 8.1"
39-
40- - name : Set up Node.js
41- uses : actions/setup-node@v4
42- with :
43- node-version-file : .node-version
44- cache : ' npm'
45-
46- - name : Compute dependency hash
47- id : deps-hash
48- run : |
49- set -euo pipefail
50- # concatenate existing lock files (src/composer.lock and package-lock.json)
51- tmpfile=$(mktemp)
52- for f in src/composer.lock package-lock.json; do
53- if [ -f "$f" ]; then
54- cat "$f" >> "$tmpfile"
55- fi
56- done
57- if [ -s "$tmpfile" ]; then
58- deps_hash=$(shasum -a 1 "$tmpfile" | awk '{print $1}' | cut -c1-8)
59- else
60- # no lock files found, fall back to short commit sha
61- deps_hash=$(echo "${GITHUB_SHA:-unknown}" | cut -c1-8)
62- fi
63- echo "deps_hash=$deps_hash" >> "$GITHUB_OUTPUT"
64-
65- - name : Get build cache
66- id : deps-cache
67- uses : actions/cache/restore@v4
68- with :
69- path : |
70- node_modules
71- src/vendor
72- key : ${{ runner.os }}-deps-${{ steps.deps-hash.outputs.deps_hash }}
73- restore-keys : |
74- ${{ runner.os }}-deps-
75-
76- - name : Install workflow dependencies (wp-env, playwright)
77- if : steps.deps-cache.outputs.cache-hit != 'true'
78- run : npm run prepare-environment:ci && npm run bundle
79-
80- - name : Save vendor and node_modules cache
81- if : steps.deps-cache.outputs.cache-hit != 'true'
82- uses : actions/cache/save@v4
83- with :
84- path : |
85- src/vendor
86- node_modules
87- key : ${{ runner.os }}-deps-${{ steps.deps-hash.outputs.deps_hash }}
88-
89- - name : Start WordPress environment
90- run : |
91- npx wp-env start
29+ uses : ./.github/workflows/playwright-test.yml
30+ with :
31+ test-mode : ' default'
32+ project-name : ' chromium-db-snippets'
9233
93- - name : Activate code-snippets plugin
94- run : npx wp-env run cli wp plugin activate code-snippets
95-
96- - name : WordPress debug information
97- run : |
98- npx wp-env run cli wp core version
99- npx wp-env run cli wp --info
100-
101- - name : Install playwright/test
102- run : |
103- npx playwright install chromium
104-
105- - name : Run Playwright tests
106- run : npm run test:playwright
107-
108- - name : Stop WordPress environment
109- if : always()
110- run : npx wp-env stop
111-
112- - uses : actions/upload-artifact@v4
113- if : always()
114- with :
115- name : playwright-test-results
116- path : test-results/
117- if-no-files-found : ignore
118- retention-days : 2
34+ playwright-file-based-execution :
35+ if : github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'run-tests')
36+ uses : ./.github/workflows/playwright-test.yml
37+ with :
38+ test-mode : ' file-based-execution'
39+ project-name : ' chromium-file-based-snippets'
11940
12041 test-result :
121- needs : [Playwright ]
122- if : always() && (needs.Playwright .result != 'skipped')
42+ needs : [playwright-default, playwright-file-based-execution ]
43+ if : always() && (needs.playwright-default.result != 'skipped' || needs.playwright-file-based-execution .result != 'skipped')
12344 runs-on : ubuntu-22.04
124- name : Playwright - Test Results
45+ name : Playwright - Test Results Summary
12546 steps :
126- - name : Test status
127- run : echo "Test status is - ${{ needs.Playwright.result }}"
128- - name : Check Playwright status
129- if : ${{ needs.Playwright.result != 'success' && needs.Playwright.result != 'skipped' }}
47+ - name : Test status summary
48+ run : |
49+ echo "Default Mode: ${{ needs.playwright-default.result }}"
50+ echo "File-based Execution: ${{ needs.playwright-file-based-execution.result }}"
51+
52+ - name : Check overall status
53+ if : ${{ (needs.playwright-default.result != 'success' && needs.playwright-default.result != 'skipped') || (needs.playwright-file-based-execution.result != 'success' && needs.playwright-file-based-execution.result != 'skipped') }}
13054 run : exit 1
0 commit comments