diff --git a/.github/workflows/run-feature-tests.yml b/.github/workflows/run-feature-tests.yml new file mode 100644 index 00000000..2ce0c46c --- /dev/null +++ b/.github/workflows/run-feature-tests.yml @@ -0,0 +1,84 @@ +# Run only Features tests +# TODO: Currently failing on ubuntu-latest and prefer-lowest +# TODO: Find a way to output electron logs to the console +name: run-feature-tests + +on: + workflow_dispatch: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + test: + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + matrix: + os: [ + windows-latest, + macos-latest + # ubuntu-latest, + ] + php: [ 8.4, 8.3, 8.2, 8.1 ] + laravel: [ '10.*', '11.*', '12.*' ] + stability: [ +# prefer-lowest, + prefer-stable + ] + exclude: + - laravel: 10.* + php: 8.4 + - laravel: 11.* + php: 8.1 + - laravel: 12.* + php: 8.1 + + name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Use Node.js + uses: actions/setup-node@v4 + with: + node-version: 20.x + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo + coverage: none + + - name: Setup problem matchers + run: | + echo "::add-matcher::${{ runner.tool_cache }}/php.json" + echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" + + - name: Install dependencies + run: | + composer require "laravel/framework:${{ matrix.laravel }}" --no-interaction --no-update + composer update --${{ matrix.stability }} --no-interaction + + - name: List Installed Dependencies + run: composer show + + - name: Show pest version + run: vendor/bin/pest --version + + - name: Execute tests on Linux + if: "matrix.os == 'ubuntu-latest'" + run: | + xvfb-run -a vendor/bin/pest --group=feature + env: + DISPLAY: ":99" + + - name: Execute tests on Windows or Mac + if: "matrix.os == 'windows-latest' || matrix.os == 'macos-latest'" + run: vendor/bin/pest --group=feature diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 24730d9e..ac8c8c75 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -3,34 +3,30 @@ name: run-tests on: workflow_dispatch: push: - branches: [main] + branches: + - main pull_request: - branches: [main] + branches: + - main jobs: test: runs-on: ${{ matrix.os }} + strategy: fail-fast: false matrix: - os: [ubuntu-latest, windows-latest] - php: [8.2, 8.1, 8.3] - laravel: [10.*, 11.*] - stability: [prefer-lowest, prefer-stable] - include: - - laravel: 10.* - testbench: ^8.18 - carbon: ^2.67 - laravel-package-tools: ^1.16.4 - collision: 7.* - - laravel: 11.* - testbench: 9.* - carbon: "^2.67|^3.0" - laravel-package-tools: ^1.16.4 - collision: ^8.1.1 + os: [ ubuntu-latest, windows-latest, macos-latest ] + php: [ 8.4, 8.3, 8.2, 8.1 ] + laravel: [ '10.*', '11.*', '12.*' ] + stability: [ prefer-lowest, prefer-stable ] exclude: + - laravel: 10.* + php: 8.4 - laravel: 11.* php: 8.1 + - laravel: 12.* + php: 8.1 name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} @@ -57,19 +53,14 @@ jobs: - name: Install dependencies run: | - composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" "nesbot/carbon:${{ matrix.carbon }}" "spatie/laravel-package-tools:${{ matrix.laravel-package-tools }}" "nunomaduro/collision:${{ matrix.collision }}" --no-interaction --no-update + composer require "laravel/framework:${{ matrix.laravel }}" --no-interaction --no-update composer update --${{ matrix.stability }} --no-interaction - name: List Installed Dependencies - run: composer show -D + run: composer show - name: Show pest version run: vendor/bin/pest --version - - name: Execute tests on Linux - if: matrix.os == 'ubuntu-latest' - run: Xvfb :99 & DISPLAY=:99 vendor/bin/pest - - - name: Execute tests on Windows - if: matrix.os == 'windows-latest' - run: vendor/bin/pest + - name: Execute tests + run: vendor/bin/pest --exclude-group=feature diff --git a/composer.json b/composer.json index 37bec1da..224f70e3 100644 --- a/composer.json +++ b/composer.json @@ -32,24 +32,24 @@ ], "require": { "php": "^8.1", - "illuminate/contracts": "^10.0|^11.0", + "illuminate/contracts": "^10.0|^11.0|^12.0", "laravel/prompts": "^0.1.1|^0.2|^0.3", - "nativephp/laravel": "*", + "nativephp/laravel": "dev-main", "nativephp/php-bin": "^0.5.1", "spatie/laravel-package-tools": "^1.16.4", "symfony/filesystem": "^6.4|^7.2" }, "require-dev": { "laravel/pint": "^1.0", - "nunomaduro/collision": "^7.9", - "nunomaduro/larastan": "^2.0.1", - "orchestra/testbench": "^8.18", - "pestphp/pest": "^2.7", - "pestphp/pest-plugin-arch": "^2.0", - "pestphp/pest-plugin-laravel": "^2.0", + "nunomaduro/collision": "^7.9|^8.1.1", + "larastan/larastan": "^2.0.1|^3.0", + "orchestra/testbench": "^8.18|^9.0|^10.0", + "pestphp/pest": "^2.7|^3.7", + "pestphp/pest-plugin-arch": "^2.0|^3.0", + "pestphp/pest-plugin-laravel": "^2.0|^3.1", "phpstan/extension-installer": "^1.1", - "phpstan/phpstan-deprecation-rules": "^1.0", - "phpstan/phpstan-phpunit": "^1.0", + "phpstan/phpstan-deprecation-rules": "^1.0|^2.0", + "phpstan/phpstan-phpunit": "^1.0|^2.0", "spatie/laravel-ray": "^1.26" }, "autoload": { diff --git a/tests/Pest.php b/tests/Pest.php index b72698d2..ea456d45 100644 --- a/tests/Pest.php +++ b/tests/Pest.php @@ -3,7 +3,13 @@ use Native\Electron\Tests\TestCase; use Symfony\Component\Filesystem\Filesystem; -uses(TestCase::class)->in('Feature', 'Unit'); +uses(TestCase::class) + ->group('feature') + ->in('Feature'); + +uses(TestCase::class) + ->group('unit') + ->in('Unit'); function testsDir(string $path = ''): string {