Browse Source

added build on macos

Ne-Lexa 4 years ago
parent
commit
a85288d34b
2 changed files with 20 additions and 11 deletions
  1. 18 7
      .github/workflows/build.yml
  2. 2 4
      tests/ZipTestCase.php

+ 18 - 7
.github/workflows/build.yml

@@ -19,6 +19,7 @@ jobs:
                 os:
                     - ubuntu-latest
                     - windows-latest
+                    - macos-latest
                 php:
                     - '7.4'
                     - '8.0'
@@ -35,6 +36,16 @@ jobs:
                 if:   matrix.os == 'ubuntu-latest'
                 run:  sudo apt-get install unzip p7zip-full
 
+            -
+                name: Install windows dependencies
+                if:   matrix.os == 'windows-latest'
+                run:  choco install zip unzip 7zip
+
+            -
+                name: Install macos dependencies
+                if:   matrix.os == 'macos-latest'
+                run:  brew install zip unzip p7zip
+
             -
                 name: Install PHP with extensions
                 uses: shivammathur/setup-php@v2
@@ -46,20 +57,20 @@ jobs:
                     tools:       composer:v2
 
             -
-                name: Determine composer cache directory on Linux
-                if:   matrix.os == 'ubuntu-latest'
+                name: Determine composer cache directory on Linux or MacOS
+                if:   matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
                 run:  echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV
 
-            -
-                name: Set coverage args
-                if:   matrix.os == 'ubuntu-latest' && matrix.php == '8.0'
-                run:  echo "PHPUNIT_COVERAGE=1" >> $GITHUB_ENV
-
             -
                 name: Determine composer cache directory on Windows
                 if:   matrix.os == 'windows-latest'
                 run:  echo "COMPOSER_CACHE_DIR=~\AppData\Local\Composer" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
 
+            -
+                name: Set coverage args
+                if:   matrix.os == 'ubuntu-latest' && matrix.php == '8.0'
+                run:  echo "PHPUNIT_COVERAGE=1" >> $GITHUB_ENV
+
             -
                 name: Cache composer dependencies
                 uses: actions/cache@v2

+ 2 - 4
tests/ZipTestCase.php

@@ -26,8 +26,6 @@ abstract class ZipTestCase extends TestCase
 
     /**
      * Before test.
-     *
-     * @noinspection PhpMissingParentCallCommonInspection
      */
     protected function setUp(): void
     {
@@ -48,11 +46,11 @@ abstract class ZipTestCase extends TestCase
     {
         parent::tearDown();
 
-        if ($this->outputFilename !== null && file_exists($this->outputFilename)) {
+        if (file_exists($this->outputFilename)) {
             unlink($this->outputFilename);
         }
 
-        if ($this->outputDirname !== null && is_dir($this->outputDirname)) {
+        if (is_dir($this->outputDirname)) {
             FilesUtil::removeDir($this->outputDirname);
         }
     }