Skip to content

Commit e6df5a7

Browse files
authored
Merge pull request #143 from Kit/tests-fix-php-8.3
Tests: Fix Runners on PHP 8.3
2 parents b533c89 + 6b3bbdc commit e6df5a7

2 files changed

Lines changed: 38 additions & 2 deletions

File tree

.github/workflows/tests.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,19 @@ jobs:
180180
php-version: ${{ matrix.php-versions }}
181181
coverage: xdebug
182182

183+
# Workaround for PHP 8.3 (and potentially other versions): the GitHub
184+
# Actions ubuntu-latest runner ships with a pre-installed PHP that leaves
185+
# an empty regular file at /run/php/php<version>-fpm.sock. setup-php
186+
# installs a different patch version on top, but PHP-FPM never replaces
187+
# the stale file with a real Unix socket, so nginx returns 502.
188+
# Removing the stale file and restarting PHP-FPM forces a clean socket.
189+
- name: Restart PHP-FPM
190+
run: |
191+
sudo rm -f /run/php/php${{ matrix.php-versions }}-fpm.sock
192+
sudo systemctl restart php${{ matrix.php-versions }}-fpm
193+
sleep 1
194+
ls -la /run/php/
195+
183196
# Configure nginx to use the PHP version and WOrdPress installation at /var/www/html
184197
- name: Configure nginx site
185198
run: |
@@ -305,7 +318,7 @@ jobs:
305318
# Run Codeception End to End Tests.
306319
- name: Run tests/${{ matrix.test-groups }}
307320
working-directory: ${{ env.PLUGIN_DIR }}
308-
run: php vendor/bin/codecept run tests/${{ matrix.test-groups }} --fail-fast
321+
run: php vendor/bin/codecept run tests/${{ matrix.test-groups }} --env headless --fail-fast
309322

310323
# Artifacts are data generated by this workflow that we want to access, such as log files, screenshots, HTML output.
311324
# The if: failure() directive means that this will run when the workflow fails e.g. if a test fails, which is needed

tests/EndToEnd.suite.yml

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,27 @@ modules:
6868
wpRootFolder: '%WORDPRESS_ROOT_DIR%'
6969
dbUrl: '%WORDPRESS_DB_URL%'
7070
domain: '%WORDPRESS_DOMAIN%'
71-
71+
72+
# Environments
73+
#
74+
# Run with `vendor/bin/codecept run EndToEnd --env headless` to run Chrome in
75+
# headless mode (used by GitHub Actions). Without `--env headless`, Chrome runs
76+
# in headed mode so a developer can watch tests execute locally.
77+
env:
78+
headless:
79+
modules:
80+
config:
81+
lucatume\WPBrowser\Module\WPWebDriver:
82+
capabilities:
83+
"goog:chromeOptions":
84+
args:
85+
- "--headless"
86+
- "--disable-gpu"
87+
- "--disable-dev-shm-usage"
88+
- "--disable-software-rasterizer"
89+
- "--proxy-server='direct://'"
90+
- "--proxy-bypass-list=*"
91+
- "--no-sandbox"
92+
- "--user-agent=%TEST_SITE_HTTP_USER_AGENT%"
93+
prefs:
94+
download.default_directory: '%WORDPRESS_ROOT_DIR%'

0 commit comments

Comments
 (0)