-
Notifications
You must be signed in to change notification settings - Fork 108
feat: run snippets from files #258
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from 53 commits
Commits
Show all changes
58 commits
Select commit
Hold shift + click to select a range
b2be2b8
wip
louiswol94 510e49e
wip
louiswol94 4fef005
wip
louiswol94 f65f5bc
wip
louiswol94 c7f3d3c
wip
louiswol94 29a540c
wip
louiswol94 c47c344
wip
louiswol94 b66db45
wip
louiswol94 55561ca
wip
louiswol94 f2720ac
wip
louiswol94 6477f86
wip
louiswol94 0eda7c9
wip
louiswol94 759aabd
wip
louiswol94 18bcfa3
wip
louiswol94 dc91357
wip
louiswol94 1d99420
wip
louiswol94 918e769
wip
louiswol94 737b3cf
wip
louiswol94 20ec189
wip
louiswol94 04e706d
wip
louiswol94 890481a
wip
louiswol94 3f5eea3
wip
louiswol94 69449a0
wip
louiswol94 91b7546
wip
louiswol94 0029e0f
wip
louiswol94 1a7789e
wip
louiswol94 dcc44ce
wip
louiswol94 87b9b2d
wip
louiswol94 9c168bf
wip
louiswol94 531ee35
wip
louiswol94 0b19d6e
wip
louiswol94 ff80d08
wip
louiswol94 b533854
wip
louiswol94 b983aa7
wip
louiswol94 e3a96ab
wip
louiswol94 a071dc8
wip
louiswol94 07f542b
wip
louiswol94 1970826
wip
louiswol94 4cd5ee8
wip
louiswol94 4d84a24
sync all changes from pro
louiswol94 4e16d45
Update version number and changelog for v3.7.0.
sheabunge 8279304
Merge branch 'core' into flat-file
louiswol94 89825fb
Merge branch 'edit-refresh/core' into flat-file
louiswol94 68d0d3a
sync changes from pro
louiswol94 5a43f3c
remove unrelated changes
louiswol94 b72b791
Merge branch 'core' into flat-file
louiswol94 f384c78
file bases E2E tests
louiswol94 347abe7
update playwright command
louiswol94 c331651
fix playwright storage state
louiswol94 555bb31
clear opcache cache on save
louiswol94 0d36e23
eslint fix
louiswol94 73672e2
fix e2e test snippet for list page tests
louiswol94 819f7c0
reusable playwright workflow
louiswol94 1df506b
remove debug steps from playwright workflow
louiswol94 3e4a082
add workflow permissions
louiswol94 350ba54
remove permissions
louiswol94 8187aab
remove permissions
louiswol94 1680b33
Merge remote-tracking branch 'origin/core/core-beta' into flat-file
imantsk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
name: Playwright Test Runner | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
test-mode: | ||
required: true | ||
type: string | ||
description: 'Test mode: default or file-based-execution' | ||
project-name: | ||
required: true | ||
type: string | ||
description: 'Playwright project name to run' | ||
|
||
jobs: | ||
playwright-test: | ||
name: Playwright tests (${{ inputs.test-mode == 'default' && 'Default Mode' || 'File-based Execution' }}) | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Checkout source code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up PHP | ||
uses: codesnippetspro/setup-php@v2 | ||
with: | ||
php-version: "8.1" | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: .node-version | ||
cache: 'npm' | ||
|
||
- name: Compute dependency hash | ||
id: deps-hash | ||
run: | | ||
set -euo pipefail | ||
tmpfile=$(mktemp) | ||
for f in src/composer.lock package-lock.json; do | ||
if [ -f "$f" ]; then | ||
cat "$f" >> "$tmpfile" | ||
fi | ||
done | ||
if [ -s "$tmpfile" ]; then | ||
deps_hash=$(shasum -a 1 "$tmpfile" | awk '{print $1}' | cut -c1-8) | ||
else | ||
deps_hash=$(echo "${GITHUB_SHA:-unknown}" | cut -c1-8) | ||
fi | ||
echo "deps_hash=$deps_hash" >> "$GITHUB_OUTPUT" | ||
|
||
- name: Get build cache | ||
id: deps-cache | ||
uses: actions/cache/restore@v4 | ||
with: | ||
path: | | ||
node_modules | ||
src/vendor | ||
key: ${{ runner.os }}-deps-${{ steps.deps-hash.outputs.deps_hash }} | ||
restore-keys: | | ||
${{ runner.os }}-deps- | ||
|
||
- name: Install workflow dependencies (wp-env, playwright) | ||
if: steps.deps-cache.outputs.cache-hit != 'true' | ||
run: npm run prepare-environment:ci && npm run bundle | ||
|
||
- name: Save vendor and node_modules cache | ||
if: steps.deps-cache.outputs.cache-hit != 'true' | ||
uses: actions/cache/save@v4 | ||
with: | ||
path: | | ||
src/vendor | ||
node_modules | ||
key: ${{ runner.os }}-deps-${{ steps.deps-hash.outputs.deps_hash }} | ||
|
||
- name: Start WordPress environment | ||
run: | | ||
npx wp-env start | ||
|
||
- name: Activate code-snippets plugin | ||
run: npx wp-env run cli wp plugin activate code-snippets | ||
|
||
- name: WordPress debug information | ||
run: | | ||
npx wp-env run cli wp core version | ||
npx wp-env run cli wp --info | ||
|
||
- name: Install playwright/test | ||
run: | | ||
npx playwright install chromium | ||
|
||
- name: Restart WordPress environment for file-based execution | ||
if: inputs.test-mode == 'file-based-execution' | ||
run: | | ||
echo "Restarting WordPress to clear opcache..." | ||
npx wp-env stop | ||
npx wp-env start | ||
|
||
- name: Run Playwright tests | ||
run: npm run test:playwright -- --project=${{ inputs.project-name }} | ||
|
||
- name: Verify file-based execution enabled | ||
if: always() && inputs.test-mode == 'file-based-execution' | ||
run: | | ||
npx wp-env run cli wp eval 'echo file_exists(WP_CONTENT_DIR . "/code-snippets/flat-files-enabled.flag") ? "ENABLED" : "DISABLED";' | ||
|
||
- name: Stop WordPress environment | ||
if: always() | ||
run: npx wp-env stop | ||
|
||
- uses: actions/upload-artifact@v4 | ||
if: always() | ||
with: | ||
name: playwright-test-results-${{ inputs.test-mode }} | ||
path: test-results/ | ||
if-no-files-found: ignore | ||
retention-days: 2 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.