Skip to content

Commit 38b0ccd

Browse files
authored
[6.x] GitHub Actions will run test suite in Windows (#33054)
* Github Actions run test suite in Windows * Only once run on PHP 7.4 with the latest stable Composer packages installed. The Linux strategy matrix will discover issues in PHP 7.2 & 7.3. * Don't install PHP extension 'pcntl' that isn't available on Windows. * Some extensions must be explicitly setup on Windows. e.g., pdo_mysql, fileinfo, ftp * php.ini 'memory_limit' must be increased 128M to 512M when running all PHPUnit tests synchronously. * Some GitHub Actions workflow configs don't work in Windows because containers only work on Linux: * MySQL server * Redis server. There are no native Windows binaries for Redis so a clone like Memurai would have to be manually setup. * Memcached The above absent services will cause some tests to be skipped. * Skip CI-only tests when running Windows Server 2019 since mysqld.exe isn't available. * Further increase testRetry*()'s margin of error for assertEqualsWithDelta(). The call is meant to be delayed 100ms but Github Actions' virtual env returns up to 110.3ms. * Bump league/flysystem 1.0.8 to 1.0.34 FilesystemAdapterTest::testPath() fails when run on Windows using 1.0.8. A Windows-only change added in 1.0.34 meets the behavior Laravel expects for file paths. * Fix brittle FilesystemTest on Windows w/ PHP 7.2 The test cases re-using subdirectory __DIR__.'/tmp/foo' causes issues when running PHP 7.2 on Windows. The kernel's directory deletetion operating is async so the next PHPUnit test case is starting before directory deletion has completed for the previous test. 1. create __DIR__.'/tmp' only once for FilesystemTest by using PHPUnit @beforeClass and @afterclass annotations. 2. make each test use a unique subdirectory name so there is no overlap / leakage between tests when mkdir() is called.
1 parent c37f4d5 commit 38b0ccd

File tree

6 files changed

+242
-188
lines changed

6 files changed

+242
-188
lines changed

.github/workflows/tests.yml

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
- cron: '0 0 * * *'
88

99
jobs:
10-
tests:
10+
linux_tests:
1111

1212
runs-on: ubuntu-latest
1313
services:
@@ -60,3 +60,44 @@ jobs:
6060
env:
6161
DB_PORT: ${{ job.services.mysql.ports[3306] }}
6262
DB_USERNAME: root
63+
64+
windows_tests:
65+
66+
runs-on: windows-latest
67+
strategy:
68+
fail-fast: true
69+
matrix:
70+
php: [7.2, 7.3, 7.4]
71+
include:
72+
- php: 7.2
73+
stability: prefer-lowest
74+
- php: 7.3
75+
stability: prefer-stable
76+
- php: 7.4
77+
stability: prefer-stable
78+
79+
name: PHP ${{ matrix.php }} - ${{ matrix.stability }} - Windows
80+
81+
steps:
82+
- name: Checkout code
83+
uses: actions/checkout@v2
84+
85+
- name: Cache dependencies
86+
uses: actions/cache@v1
87+
with:
88+
path: ~/.composer/cache/files
89+
key: dependencies-php-${{ matrix.php }}-${{ matrix.stability }}-windows-composer-${{ hashFiles('composer.json') }}
90+
91+
- name: Setup PHP
92+
uses: shivammathur/setup-php@v2
93+
with:
94+
php-version: ${{ matrix.php }}
95+
extensions: dom, curl, libxml, mbstring, zip, pdo, sqlite, pdo_sqlite, gd, pdo_mysql, fileinfo, ftp
96+
coverage: none
97+
ini-values: memory_limit=512M
98+
99+
- name: Install dependencies
100+
run: composer update --${{ matrix.stability }} --prefer-dist --no-interaction --no-progress
101+
102+
- name: Execute tests
103+
run: vendor/bin/phpunit --verbose

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"dragonmantank/cron-expression": "^2.0",
2424
"egulias/email-validator": "^2.1.10",
2525
"league/commonmark": "^1.3",
26-
"league/flysystem": "^1.0.8",
26+
"league/flysystem": "^1.0.34",
2727
"monolog/monolog": "^1.12|^2.0",
2828
"nesbot/carbon": "^2.0",
2929
"opis/closure": "^3.1",

src/Illuminate/Filesystem/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
}
3131
},
3232
"suggest": {
33-
"league/flysystem": "Required to use the Flysystem local and FTP drivers (^1.0).",
33+
"league/flysystem": "Required to use the Flysystem local and FTP drivers (^1.0.34).",
3434
"league/flysystem-aws-s3-v3": "Required to use the Flysystem S3 driver (^1.0).",
3535
"league/flysystem-cached-adapter": "Required to use the Flysystem cache (^1.0).",
3636
"league/flysystem-sftp": "Required to use the Flysystem SFTP driver (^1.0).",

0 commit comments

Comments
 (0)