Skip to content

Commit a81b4f2

Browse files
authored
Merge pull request #272 from codesnippetspro/core-beta
Release v3.8.0
2 parents 346c70e + 66cc3f9 commit a81b4f2

38 files changed

+1924
-138
lines changed
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
name: Playwright Test Runner
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
test-mode:
7+
required: true
8+
type: string
9+
description: 'Test mode: default or file-based-execution'
10+
project-name:
11+
required: true
12+
type: string
13+
description: 'Playwright project name to run'
14+
15+
jobs:
16+
playwright-test:
17+
name: Playwright tests (${{ inputs.test-mode == 'default' && 'Default Mode' || 'File-based Execution' }})
18+
runs-on: ubuntu-22.04
19+
steps:
20+
- name: Checkout source code
21+
uses: actions/checkout@v4
22+
23+
- name: Set up PHP
24+
uses: codesnippetspro/setup-php@v2
25+
with:
26+
php-version: "8.1"
27+
28+
- name: Set up Node.js
29+
uses: actions/setup-node@v4
30+
with:
31+
node-version-file: .node-version
32+
cache: 'npm'
33+
34+
- name: Compute dependency hash
35+
id: deps-hash
36+
run: |
37+
set -euo pipefail
38+
tmpfile=$(mktemp)
39+
for f in src/composer.lock package-lock.json; do
40+
if [ -f "$f" ]; then
41+
cat "$f" >> "$tmpfile"
42+
fi
43+
done
44+
if [ -s "$tmpfile" ]; then
45+
deps_hash=$(shasum -a 1 "$tmpfile" | awk '{print $1}' | cut -c1-8)
46+
else
47+
deps_hash=$(echo "${GITHUB_SHA:-unknown}" | cut -c1-8)
48+
fi
49+
echo "deps_hash=$deps_hash" >> "$GITHUB_OUTPUT"
50+
51+
- name: Get build cache
52+
id: deps-cache
53+
uses: actions/cache/restore@v4
54+
with:
55+
path: |
56+
node_modules
57+
src/vendor
58+
key: ${{ runner.os }}-deps-${{ steps.deps-hash.outputs.deps_hash }}
59+
restore-keys: |
60+
${{ runner.os }}-deps-
61+
62+
- name: Install workflow dependencies (wp-env, playwright)
63+
if: steps.deps-cache.outputs.cache-hit != 'true'
64+
run: npm run prepare-environment:ci && npm run bundle
65+
66+
- name: Save vendor and node_modules cache
67+
if: steps.deps-cache.outputs.cache-hit != 'true'
68+
uses: actions/cache/save@v4
69+
with:
70+
path: |
71+
src/vendor
72+
node_modules
73+
key: ${{ runner.os }}-deps-${{ steps.deps-hash.outputs.deps_hash }}
74+
75+
- name: Start WordPress environment
76+
run: |
77+
npx wp-env start
78+
79+
- name: Activate code-snippets plugin
80+
run: npx wp-env run cli wp plugin activate code-snippets
81+
82+
- name: WordPress debug information
83+
run: |
84+
npx wp-env run cli wp core version
85+
npx wp-env run cli wp --info
86+
87+
- name: Install playwright/test
88+
run: |
89+
npx playwright install chromium
90+
91+
- name: Run Playwright tests
92+
run: npm run test:playwright -- --project=${{ inputs.project-name }}
93+
94+
- name: Stop WordPress environment
95+
if: always()
96+
run: npx wp-env stop
97+
98+
- uses: actions/upload-artifact@v4
99+
if: always()
100+
with:
101+
name: playwright-test-results-${{ inputs.test-mode }}
102+
path: test-results/
103+
if-no-files-found: ignore
104+
retention-days: 2

.github/workflows/playwright.yml

Lines changed: 21 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -24,107 +24,31 @@ concurrency:
2424
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
2525

2626
jobs:
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

CHANGELOG.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,31 @@
11
# Changelog
22

3-
## 3.7.1 ([unreleased])
3+
4+
5+
6+
## [3.7.1-beta.3] (2025-10-22)
7+
8+
### Added
9+
* Snippets REST API now supports pagination via page and per_page query parameters.
10+
11+
12+
## [3.7.1-beta.2] (2025-10-22)
13+
14+
### Added
15+
* Implemented version switching with a new 'Version Switch' section in Settings
16+
17+
## [3.7.1-beta.1] (2025-10-16)
18+
19+
### Added
20+
* Added @CarolinaOP and @louiswol94 as plugin contributors
21+
* File-based execution mode for snippets (Optional in Plugin Settings)
22+
23+
### Changed
24+
* Minor UI/UX tweaks to the editor form and sidebar
25+
* Improved editor preview behavior.
426

527
### Fixed
28+
* Improved reliability of snippet evaluation and front-end integration.
629
* Prefixed Composer packages to reduce collisions with other plugins, especially those using Guzzle.
730
* Functions conditions were loading before loop setup, resulting in some conditions not working. (PRO)
831
* JavaScript and CSS snippets loading twice due to a conditions bug. (PRO)

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "code-snippets",
33
"description": "Manage code snippets running on a WordPress-powered site through a graphical interface.",
44
"homepage": "https://codesnippets.pro",
5-
"version": "3.7.0",
5+
"version": "3.7.1-beta.3",
66
"main": "src/dist/edit.js",
77
"directories": {
88
"test": "tests"

scripts/version.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@ replaceInFile(
1515
.replace(/(?<prefix>'CODE_SNIPPETS_VERSION',\s+)'[\w-.]+'/, `$1'${plugin.version}'`)
1616
)
1717

18-
replaceInFile(
19-
'src/readme.txt',
20-
contents => contents
21-
.replace(/(?<prefix>Stable tag:\s+|@version\s+)\d+\.\d+[\w-.]+$/mg, `$1${plugin.version}`)
22-
)
18+
if (!/beta/i.test(plugin.version)) {
19+
replaceInFile(
20+
'src/readme.txt',
21+
contents => contents
22+
.replace(/(?<prefix>Stable tag:\s+|@version\s+)\d+\.\d+[\w-.]+$/mg, `$1${plugin.version}`)
23+
)
24+
}

src/code-snippets.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
* License: GPL-2.0-or-later
99
* License URI: license.txt
1010
* Text Domain: code-snippets
11-
* Version: 3.7.0
11+
* Version: 3.7.1-beta.3
1212
* Requires PHP: 7.4
1313
* Requires at least: 5.0
1414
*
15-
* @version 3.7.0
15+
* @version 3.7.1-beta.3
1616
* @package Code_Snippets
1717
* @author Shea Bunge <shea@codesnippets.pro>
1818
* @copyright 2012-2024 Code Snippets Pro
@@ -37,7 +37,7 @@
3737
*
3838
* @const string
3939
*/
40-
define( 'CODE_SNIPPETS_VERSION', '3.7.0' );
40+
define( 'CODE_SNIPPETS_VERSION', '3.7.1-beta.3' );
4141

4242
/**
4343
* The full path to the main file of this plugin.

0 commit comments

Comments
 (0)