Skip to content

Make CI run the tests, and fix what they found on Windows - #9

Merged
simonhamp merged 8 commits into
mainfrom
ci-tests
Nov 20, 2026
Merged

simonhamp merged 8 commits into
mainfrom
ci-tests

Conversation

@simonhamp

@simonhamp simonhamp commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

The unit and feature test jobs have been green without running a single test. Turning them on found three bugs that broke Parcel on Windows.

Running the tests. The big refactor in #2 removed Box's phpunit.xml.dist and nothing replaced it, and /phpunit.xml is gitignored. With no config and no path, Pest printed its usage text and passed. You can see it in the "Run tests" step on #8. This adds a phpunit.xml.dist with Unit and Feature suites, and the workflows select them with --testsuite. The tests were never grouped, so the old --group filters would have matched nothing. composer test works locally again too.

Windows CI setup. The feature tests need fileinfo and zip for composer install, and pdo_sqlite and sqlite3 because the bundled app opens its database. setup-php only enables those by default on Linux and macOS, so the workflow now turns them on. The PHP that NativePHP desktop ships already has them.

Box on Windows. Box 4.6.8 to 4.6.10 delete their temp build folder while still chdir'd into it, and Windows refuses, so every compile failed with Failed to remove directory ... Resource temporarily unavailable. Box fixed it in 4.7.1 (box-project/box#1651). Parcel now requires ^4.7.1. The only other change since 4.6.10 is PHP 8.5 support.

Phar paths on Windows. nativephp_rp() converted every path to the platform's separator, phar:// paths included. On Windows, phar://C:/.../bundle/config became phar:\\C:\...\bundle\config\, which PHP doesn't read as a phar. Laravel couldn't find the config directory, so a bundled app couldn't boot. That would hit any desktop app shipped with Parcel and run on Windows, wherever it was built. Only real filesystem paths get backslashes now. nativephp_rp() takes an optional separator so the unit tests can check the Windows behaviour from Linux. The old phar-path expectations had the bug baked in, invisible because / is the separator there. The new tests fail if phar paths get converted again.

Cache paths on Windows. Laravel counts an APP_*_CACHE path as absolute only when it starts with / or \. NativePHP desktop sets those variables for bundled builds (php.ts, under runningSecureBuild()), and on Windows they're C:\... paths. Laravel put the base path in front of them, which is inside the phar, so the package manifest couldn't be written and the app failed to boot. When compacting Illuminate\Foundation\Application, RealPathMod now adds the drive letters to $absoluteCachePathPrefixes. That line is identical in Laravel 10, 11, 12 and 13. Other files named Application.php are left alone.

Test diagnostics. The feature tests now print stdout, the response body and the server output when they fail. That's how the two bugs above showed up. stopPhpServer() no longer passes SIGTERM, which doesn't exist on Windows.

Locally on macOS, 71 unit and 2 feature tests pass. On CI, Linux and macOS pass. Windows is the one to check on the latest commit.

🤖 Generated with Claude Code

simonhamp and others added 6 commits November 20, 2026 00:20
The big refactor removed Box's phpunit.xml.dist and nothing replaced
it, and /phpunit.xml is gitignored. With no config and no path, Pest
prints its usage, so the unit and feature jobs have been passing
without running anything. composer test did the same locally.

Add a phpunit.xml.dist with Unit and Feature suites, and select them
in CI with --testsuite. The old --group filters would have matched
nothing, because the tests aren't grouped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Linux and macOS runners have them already. On Windows, composer install
in the test's Laravel project fails without them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Box 4.6.8 to 4.6.10 delete their temp build folder while still chdir'd
into it. Windows won't remove a process's working directory, so every
compile there failed with "Failed to remove directory ... Resource
temporarily unavailable". Box 4.7.1 fixed it (box-project/box#1651).
4.7.0 only added PHP 8.5 support.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The artisan check only reported stderr, which is empty on Windows, and
the serve check didn't say what came back. Include stdout, the response
body and the server's output in the failure messages.

stopPhpServer() passed SIGTERM, which isn't defined on Windows (no
pcntl), so cleanup itself crashed there. Process::stop() copes without
a signal.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
nativephp_rp() converted every path it returned to the platform's
separator, phar:// paths included. On Windows that turned
phar://C:/.../bundle/config into phar:\\C:\...\bundle\config\, which
PHP doesn't treat as a phar stream, so Laravel couldn't find the app's
config directory and any bundled app failed to boot there. Only real
filesystem paths get backslashes now.

The separator is an optional argument (defaulting to the platform's) so
the Windows behaviour can be tested anywhere. The existing phar-path
expectations had the bug baked in; on Linux and macOS it was invisible.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@simonhamp simonhamp changed the title Make CI actually run the tests Make CI run the tests, and fix what they found on Windows Nov 20, 2026
simonhamp and others added 2 commits November 20, 2026 01:36
Laravel counts an APP_*_CACHE path as absolute only when it starts with
/ or \. NativePHP desktop sets those variables for a bundled app, and on
Windows they're C:\... paths, so Laravel put the base path in front of
them. In a bundle that's inside the phar, where the package manifest
can't be written, and the app failed to boot.

When compacting Illuminate\Foundation\Application, add the drive letters
to its absolute prefixes. The line is the same in Laravel 10 to 13.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The bundled app opens its SQLite database when artisan boots. Linux and
macOS runners have pdo_sqlite already; Windows ones don't, and NativePHP
desktop ships a PHP that does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@simonhamp
simonhamp merged commit eb2d3e2 into main Nov 20, 2026
6 checks passed
@simonhamp
simonhamp deleted the ci-tests branch November 20, 2026 01:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant