Skip to content

Commit 79b0e56

Browse files
committed
Merge remote-tracking branch 'origin/core/core-beta' into feat/version-switch
2 parents 6cee314 + 5272b5a commit 79b0e56

36 files changed

+2555
-252
lines changed

.github/workflows/build.yml

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,28 @@ on:
77
required: false
88
type: string
99
default: ${{ inputs.ref }}
10+
php:
11+
required: false
12+
type: number
13+
default: 8.3
14+
1015
outputs:
1116
version:
1217
value: ${{ jobs.build.outputs.version }}
1318
artifact_name:
1419
value: ${{ jobs.build.outputs.artifact_name }}
1520
artifact_url:
1621
value: ${{ jobs.build.outputs.artifact_url }}
22+
artifact_id:
23+
value: ${{ jobs.build.outputs.artifact_id }}
1724
jobs:
1825
build:
1926
runs-on: ubuntu-latest
2027
outputs:
28+
version: ${{ steps.build.outputs.version }}
2129
artifact_name: ${{ steps.build.outputs.name }}
2230
artifact_url: ${{ steps.artifacts.outputs.artifact-url }}
23-
version: ${{ steps.build.outputs.version }}
31+
artifact_id: ${{ steps.artifacts.outputs.artifact-id }}
2432
steps:
2533
- uses: actions/checkout@v4
2634
with:
@@ -29,27 +37,29 @@ jobs:
2937
- name: Set up PHP
3038
uses: codesnippetspro/setup-php@v2
3139
with:
32-
php-version: "8.3"
40+
php-version: "${{ inputs.php }}"
3341

3442
- name: Set up Node.js
3543
uses: actions/setup-node@v4
3644
with:
3745
node-version-file: .node-version
46+
cache: 'npm'
3847

3948
- name: Install & Build
4049
id: build
4150
run: |
4251
npm install && npm run bundle
4352
44-
echo "name=$(jq -r .name package.json)" >> $GITHUB_OUTPUT
53+
name=$(jq -r .name package.json)
54+
echo "name=$name" >> $GITHUB_OUTPUT
4555
echo "version=$(jq -r .version package.json)" >> $GITHUB_OUTPUT
4656
47-
mkdir -p ./bundle/code-snippets
48-
mv ./bundle/* ./bundle/code-snippets/ 2>/dev/null || true
57+
mkdir -p ./upload/$name
58+
mv ./bundle/* ./upload/$name/ 2>/dev/null || true
4959
5060
- name: Upload
5161
id: artifacts
5262
uses: actions/upload-artifact@v4
5363
with:
5464
name: ${{ steps.build.outputs.name }}
55-
path: ./bundle
65+
path: ./upload

.github/workflows/create-tag.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ on:
55
types: [closed]
66
branches:
77
- core
8-
8+
- core-beta
9+
- pro
10+
- pro-beta
911
jobs:
1012
create-tag:
1113
if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'tag/v')

.github/workflows/playwright.yml

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
name: "(Test): Playwright"
2+
3+
on:
4+
pull_request:
5+
types: [labeled, synchronize, opened, reopened]
6+
push:
7+
branches:
8+
- 'core'
9+
- 'pro'
10+
paths-ignore:
11+
- '**.md'
12+
- '**.txt'
13+
- '.gitignore'
14+
- 'docs/**'
15+
workflow_dispatch:
16+
17+
permissions:
18+
contents: write
19+
pull-requests: write
20+
actions: read
21+
22+
concurrency:
23+
group: playwright-${{ github.event_name }}-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.ref }}
24+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
25+
26+
jobs:
27+
Playwright:
28+
name: Playwright test on PHP 8.1
29+
runs-on: ubuntu-22.04
30+
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
92+
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
119+
120+
test-result:
121+
needs: [Playwright]
122+
if: always() && (needs.Playwright.result != 'skipped')
123+
runs-on: ubuntu-22.04
124+
name: Playwright - Test Results
125+
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' }}
130+
run: exit 1

0 commit comments

Comments
 (0)