Skip to content

Commit

Permalink
[6.x] GitHub Actions will run test suite in Windows (#33054)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
derekmd authored Jun 2, 2020
1 parent c37f4d5 commit 38b0ccd
Show file tree
Hide file tree
Showing 6 changed files with 242 additions and 188 deletions.
43 changes: 42 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
- cron: '0 0 * * *'

jobs:
tests:
linux_tests:

runs-on: ubuntu-latest
services:
Expand Down Expand Up @@ -60,3 +60,44 @@ jobs:
env:
DB_PORT: ${{ job.services.mysql.ports[3306] }}
DB_USERNAME: root

windows_tests:

runs-on: windows-latest
strategy:
fail-fast: true
matrix:
php: [7.2, 7.3, 7.4]
include:
- php: 7.2
stability: prefer-lowest
- php: 7.3
stability: prefer-stable
- php: 7.4
stability: prefer-stable

name: PHP ${{ matrix.php }} - ${{ matrix.stability }} - Windows

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Cache dependencies
uses: actions/cache@v1
with:
path: ~/.composer/cache/files
key: dependencies-php-${{ matrix.php }}-${{ matrix.stability }}-windows-composer-${{ hashFiles('composer.json') }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pdo, sqlite, pdo_sqlite, gd, pdo_mysql, fileinfo, ftp
coverage: none
ini-values: memory_limit=512M

- name: Install dependencies
run: composer update --${{ matrix.stability }} --prefer-dist --no-interaction --no-progress

- name: Execute tests
run: vendor/bin/phpunit --verbose
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"dragonmantank/cron-expression": "^2.0",
"egulias/email-validator": "^2.1.10",
"league/commonmark": "^1.3",
"league/flysystem": "^1.0.8",
"league/flysystem": "^1.0.34",
"monolog/monolog": "^1.12|^2.0",
"nesbot/carbon": "^2.0",
"opis/closure": "^3.1",
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Filesystem/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
}
},
"suggest": {
"league/flysystem": "Required to use the Flysystem local and FTP drivers (^1.0).",
"league/flysystem": "Required to use the Flysystem local and FTP drivers (^1.0.34).",
"league/flysystem-aws-s3-v3": "Required to use the Flysystem S3 driver (^1.0).",
"league/flysystem-cached-adapter": "Required to use the Flysystem cache (^1.0).",
"league/flysystem-sftp": "Required to use the Flysystem SFTP driver (^1.0).",
Expand Down
Loading

0 comments on commit 38b0ccd

Please sign in to comment.