Closed driesvints closed 3 years ago
The test suite's windows_os()
checks could be replaced with an environment variable set in phpunit.xml.dist
? I see there are already $_SERVER['CI']
checks for the CI=true
variable that GitHub Actions initializes.
The alternate, slower solution would be for test classes to probe for an available MySQL connection. A new PHP trait can be pulled into test classes that specifically target MySQL. It will ensure a MySQL instance is available within PHPUnit hook setUpBeforeClass()
.
Redis is more difficult to solve since there isn't a recent native Redis binary for Windows. Instead it's suggested to use the WSL subsystem: https://redislabs.com/blog/redis-on-windows-10/
The last ported executable is downloadable from https://github.com/microsoftarchive/redis/releases which is based on Redis v3.0.5 from Oct 2015. That binary uses a GUI wizard flow to install a Windows service so I'm unsure how to go about scripting a custom GitHub marketplace action that can be leveraged by "laravel/framework", "laravel/horizon", etc.
Thanks @derekmd. I guess we should ask ourselves first how much Redis and MySQL are even used on Windows. If they aren't and we should focus on other caching/session drivers and SqlServer instead then we can probably check into getting SqlServer builds up and running instead.
Proving an environment variable-based mechanism for local dev to run the full test suite on Windows might be good enough. When I develop "laravel/framework" in a Windows native environment (because I'm a monster [and I really dislike the slower latency of a VM]), I tend to manually comment out the windows_os()
checks for MySQL, etc. tests to run. XAMPP includes the Redis PHP extension so it actually runs RedisConnectionTest
immediately on Windows once you install the ported Redis executable.
It would be very rare that a Laravel application's HTTP server/PHP in production would run in a Windows environment. I see the goal of the CI environment's Windows image run is to give feedback on OS-dependent functionality: specifically shell commands and file system paths.
Would the MySQL & Redis integrations differ in any way between Linux/Mac & Windows? I think the CI's Ubuntu test suite feedback is OK for those drivers. Looking at Ruby on Rails & Symfony's CI setup, they only run their test suite under the Ubuntu image.
So like you noted, a more value-added (and reachable) goal might be to add tests targeting MS SQL Server to run on Windows while adding other driver tests for the Ubuntu runs.
@derekmd those are some good remarks. Thanks for those. I'll open a new ticket to get MS SQL Server builds running for the windows tests.
Our Windows builds currently skip Redis & MySQL tests. We'll need to figure out what to do to get those running as well on GitHub Actions.