Skip to content

Commit fadcdcc

Browse files
committed
wip
1 parent c2e0358 commit fadcdcc

File tree

9 files changed

+36
-22
lines changed

9 files changed

+36
-22
lines changed

.github/workflows/cs.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ jobs:
4646
# Validate the composer.json file.
4747
# @link https://getcomposer.org/doc/03-cli.md#validate
4848
- name: Validate Composer installation
49+
working-directory: plugins/sqlite-database-integration
4950
run: composer validate --no-check-all
5051

5152
# Install dependencies and handle caching in one go.
@@ -55,14 +56,17 @@ jobs:
5556
with:
5657
# Bust the cache at least once a month - output format: YYYY-MM.
5758
custom-cache-suffix: $(date -u "+%Y-%m")
59+
working-directory: plugins/sqlite-database-integration
5860

5961
# Check the codestyle of the files.
6062
# The results of the CS check will be shown inline in the PR via the CS2PR tool.
6163
# @link https://github.com/staabm/annotate-pull-request-from-checkstyle/
6264
- name: Check PHP code style
6365
id: phpcs
66+
working-directory: plugins/sqlite-database-integration
6467
run: composer check-cs -- --no-cache --report-full --report-checkstyle=./phpcs-report.xml
6568

6669
- name: Show PHPCS results in PR
6770
if: ${{ always() && steps.phpcs.outcome == 'failure' }}
71+
working-directory: plugins/sqlite-database-integration
6872
run: cs2pr ./phpcs-report.xml

.github/workflows/end-to-end-tests.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,10 @@ jobs:
2828
run: npx playwright install --with-deps
2929

3030
- name: Run end-to-end tests
31+
working-directory: plugins/sqlite-database-integration
3132
run: composer run test-e2e
3233

3334
- name: Stop Docker containers
3435
if: always()
36+
working-directory: plugins/sqlite-database-integration
3537
run: composer run wp-test-clean

.github/workflows/phpunit-tests-run.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ jobs:
4242
with:
4343
ignore-cache: "yes"
4444
composer-options: "--optimize-autoloader"
45+
working-directory: plugins/sqlite-database-integration
4546

4647
- name: Run PHPUnit tests
47-
run: php ./vendor/bin/phpunit -c ./phpunit.xml.dist
48+
working-directory: plugins/sqlite-database-integration
49+
run: php ./vendor/bin/phpunit -c ./phpunit.xml.dist

.github/workflows/verify-version.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,14 @@ jobs:
1414
- uses: actions/checkout@v4
1515

1616
- name: Extract version from "load.php"
17+
working-directory: plugins/sqlite-database-integration
1718
id: load_version
1819
run: |
1920
VERSION=$(grep "Version:" load.php | sed "s/.*Version: \([^ ]*\).*/\1/")
2021
echo "load_version=$VERSION" >> $GITHUB_OUTPUT
2122
2223
- name: Extract version from "version.php"
24+
working-directory: plugins/sqlite-database-integration
2325
id: const_version
2426
run: |
2527
VERSION=$(php -r "require 'version.php'; echo SQLITE_DRIVER_VERSION;")

.github/workflows/wp-tests-end-to-end.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,10 @@ jobs:
2828
run: npx playwright install --with-deps
2929

3030
- name: Run WordPress end-to-end tests
31+
working-directory: plugins/sqlite-database-integration
3132
run: composer run wp-test-e2e
3233

3334
- name: Stop Docker containers
3435
if: always()
36+
working-directory: plugins/sqlite-database-integration
3537
run: composer run wp-test-clean

.github/workflows/wp-tests-phpunit-run.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ try {
108108
try {
109109
execSync(
110110
`composer run wp-test-php -- --log-junit=phpunit-results.xml --verbose`,
111-
{ stdio: 'inherit' }
111+
{ stdio: 'inherit', cwd: path.join( __dirname, '..', '..', 'plugins', 'sqlite-database-integration' ) }
112112
);
113113
console.log( '\n⚠️ All tests passed, checking if expected errors/failures occurred...' );
114114
} catch ( error ) {

.github/workflows/wp-tests-phpunit.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,5 @@ jobs:
2929

3030
- name: Stop Docker containers
3131
if: always()
32+
working-directory: plugins/sqlite-database-integration
3233
run: composer run wp-test-clean

plugins/sqlite-database-integration/composer.json

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -42,39 +42,39 @@
4242
"test-e2e": [
4343
"@wp-test-ensure-env @no_additional_args",
4444
"rm -f tests/e2e/package.json tests/e2e/node_modules @no_additional_args",
45-
"ln -s ../../wordpress/package.json tests/e2e/package.json @no_additional_args",
46-
"ln -s ../../wordpress/node_modules tests/e2e/node_modules @no_additional_args",
47-
"npm --prefix tests/e2e run test:e2e -- --config . @additional_args"
45+
"ln -s ../../../../wordpress/package.json tests/e2e/package.json @no_additional_args",
46+
"ln -s ../../../../wordpress/node_modules tests/e2e/node_modules @no_additional_args",
47+
"npm --prefix tests/e2e run test:e2e -- --config ../.. @additional_args"
4848
],
4949
"wp-setup": [
50-
"./wp-setup.sh"
50+
"../../wp-setup.sh"
5151
],
5252
"wp-run": [
53-
"npm --prefix wordpress run"
53+
"npm --prefix ../../wordpress run"
5454
],
5555
"wp-test-start": [
56-
"npm --prefix wordpress run env:start",
57-
"npm --prefix wordpress run env:install",
58-
"npm --prefix wordpress run env:cli -- plugin install gutenberg",
59-
"npm --prefix wordpress run env:cli -- plugin install query-monitor"
56+
"npm --prefix ../../wordpress run env:start",
57+
"npm --prefix ../../wordpress run env:install",
58+
"npm --prefix ../../wordpress run env:cli -- plugin install gutenberg",
59+
"npm --prefix ../../wordpress run env:cli -- plugin install query-monitor"
6060
],
6161
"wp-test-ensure-env": [
62-
"if [ ! -f wordpress/src/wp-load.php ]; then composer run wp-setup; fi",
62+
"if [ ! -f ../../wordpress/src/wp-load.php ]; then composer run wp-setup; fi",
6363
"@putenv COMPOSE_IGNORE_ORPHANS=true",
64-
"cd wordpress && if [ -z \"$(node tools/local-env/scripts/docker.js ps -q)\" ]; then cd ..; composer run wp-test-start; fi"
64+
"cd ../../wordpress && if [ -z \"$(node tools/local-env/scripts/docker.js ps -q)\" ]; then cd -; composer run wp-test-start; fi"
6565
],
6666
"wp-test-php": [
6767
"@wp-test-ensure-env @no_additional_args",
68-
"rm -rf wordpress/src/wp-content/database/.ht.sqlite @no_additional_args",
69-
"npm --prefix wordpress run test:php -- @additional_args"
68+
"rm -rf ../../wordpress/src/wp-content/database/.ht.sqlite @no_additional_args",
69+
"npm --prefix ../../wordpress run test:php -- @additional_args"
7070
],
7171
"wp-test-e2e": [
7272
"@wp-test-ensure-env @no_additional_args",
73-
"npm --prefix wordpress run test:e2e -- @additional_args"
73+
"npm --prefix ../../wordpress run test:e2e -- @additional_args"
7474
],
7575
"wp-test-clean": [
76-
"npm --prefix wordpress run env:clean",
77-
"rm -rf wordpress/src/wp-content/database/.ht.sqlite"
76+
"npm --prefix ../../wordpress run env:clean",
77+
"rm -rf ../../wordpress/src/wp-content/database/.ht.sqlite"
7878
]
7979
}
8080
}

wp-setup.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ WP_VERSION="6.7.2"
1212

1313
DIR="$(dirname "$0")"
1414
WP_DIR="$DIR/wordpress"
15+
PLUGIN_DIR="$DIR/plugins/sqlite-database-integration"
1516

1617
# 1. Ensure that Git is installed.
1718
echo "Checking if Git is installed..."
@@ -34,29 +35,29 @@ services:
3435
environment:
3536
WP_SQLITE_AST_DRIVER: true
3637
volumes:
37-
- ../:/var/www/src/wp-content/plugins/sqlite-database-integration
38+
- ../plugins/sqlite-database-integration:/var/www/src/wp-content/plugins/sqlite-database-integration
3839
3940
php:
4041
# PHP temporarily pinned to 8.3.10, see: https://github.com/WordPress/wordpress-develop/pull/9602
4142
image: wordpressdevelop/php@sha256:c0ba85936a9d1ac2c98bf3da2d62ceb0e5787a6b11e383630df0c5a5bf2534b5
4243
environment:
4344
WP_SQLITE_AST_DRIVER: true
4445
volumes:
45-
- ../:/var/www/src/wp-content/plugins/sqlite-database-integration
46+
- ../plugins/sqlite-database-integration:/var/www/src/wp-content/plugins/sqlite-database-integration
4647
4748
cli:
4849
# PHP temporarily pinned to 8.3.10, see: https://github.com/WordPress/wordpress-develop/pull/9602
4950
image: wordpressdevelop/cli@sha256:85ad7d7a9c3bd9a8775fc83aea7f7dfc0aad25b2bc4f7d740696b28cd2a0ef89
5051
environment:
5152
WP_SQLITE_AST_DRIVER: true
5253
volumes:
53-
- ../:/var/www/src/wp-content/plugins/sqlite-database-integration
54+
- ../plugins/sqlite-database-integration:/var/www/src/wp-content/plugins/sqlite-database-integration
5455
EOF
5556

5657
# 4. Add "db.php" to the "wp-content" directory.
5758
echo "Adding 'db.php' to the 'wp-content' directory..."
5859
rm -f "$WP_DIR"/src/wp-content/db.php
59-
cp "$DIR"/db.copy "$WP_DIR"/src/wp-content/db.php
60+
cp "$PLUGIN_DIR"/db.copy "$WP_DIR"/src/wp-content/db.php
6061
sed -i.bak "s#'{SQLITE_IMPLEMENTATION_FOLDER_PATH}'#__DIR__.'/plugins/sqlite-database-integration'#g" "$WP_DIR"/src/wp-content/db.php
6162
sed -i.bak "s#{SQLITE_PLUGIN}#$WP_DIR/src/wp-content/plugins/sqlite-database-integration/load.php#g" "$WP_DIR"/src/wp-content/db.php
6263

0 commit comments

Comments
 (0)