Skip to content

Commit

Permalink
Added support php 8.3 (#12)
Browse files Browse the repository at this point in the history
* added support php 8.3|8.4
  • Loading branch information
pvsaintpe committed May 2, 2024
1 parent f294c2d commit 130b7c0
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 67 deletions.
60 changes: 16 additions & 44 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ on:
- unassigned

env:
php_extensions: 'apcu, bcmath, ctype, curl, dom, iconv, intl, json, mbstring, opcache, openssl, pdo, pdo_pgsql, pcntl, pcov, posix, redis, session, simplexml, sockets, tokenizer, xml, xmlwriter, zip'
php_extensions: 'apcu, bcmath, ctype, curl, dom, iconv, intl, json, mbstring, opcache, openssl, pdo, pdo_pgsql, pcntl, pcov, posix, redis, session, simplexml, sockets, tokenizer, xml, xmlwriter, zip, xdebug'
key: cache-v0.1
DB_USER: 'postgres'
DB_NAME: 'testing'
DB_NAME: 'postgres'
DB_PASSWORD: 'postgres'
DB_HOST: '127.0.0.1'

Expand All @@ -33,11 +33,11 @@ jobs:
strategy:
matrix:
operating_system: [ubuntu-latest]
php_versions: ['7.4']
php_versions: ['8.3']
fail-fast: false
env:
PHP_CS_FIXER_FUTURE_MODE: '0'
name: 'Lint PHP'
name: 'Linter PHP'
steps:
- name: 'Checkout'
uses: actions/checkout@v2
Expand Down Expand Up @@ -75,48 +75,18 @@ jobs:
strategy:
fail-fast: false
matrix:
coverage: [false]
coverage: [true]
experimental: [false]
operating_system: [ubuntu-latest]
postgres: ['9.6']
laravel: ['^6.0']
php_versions: ['7.4']
postgres: ['11', '12', '13', '14', '15']
laravel: ['^11.0']
php_versions: ['8.3']
include:
- operating_system: ubuntu-latest
postgres: '10'
php_versions: '7.4'
laravel: '^7.0'
experimental: false
coverage: true
- operating_system: ubuntu-latest
postgres: '11'
php_versions: '7.4'
laravel: '^8.0'
experimental: false
coverage: true
- operating_system: ubuntu-latest
postgres: '12'
php_versions: '8.0'
laravel: '^8.0'
experimental: false
coverage: true
- operating_system: ubuntu-latest
postgres: '13'
php_versions: '8.0'
laravel: '^9.0'
experimental: false
coverage: false
- operating_system: ubuntu-latest
postgres: '14'
php_versions: '8.1'
laravel: '^10.0'
experimental: false
coverage: false
- operating_system: ubuntu-latest
postgres: '15'
php_versions: '8.2'
postgres: '16'
php_versions: '8.4'
laravel: '^11.0'
experimental: false
experimental: true
coverage: false
runs-on: '${{ matrix.operating_system }}'
services:
Expand All @@ -130,7 +100,7 @@ jobs:
- 5432:5432
# needed because the postgres container does not provide a healthcheck
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
name: 'Test / Laravel ${{ matrix.laravel }} / PHP ${{ matrix.php_versions }} / Postgres ${{ matrix.postgres }}'
name: 'Testing / Laravel ${{ matrix.laravel }} / PHP ${{ matrix.php_versions }} / Postgres ${{ matrix.postgres }}'
needs:
- lint
steps:
Expand Down Expand Up @@ -160,10 +130,11 @@ jobs:
with:
php-version: ${{ matrix.php_versions }}
extensions: ${{ env.php_extensions }}
ini-values: 'pcov.directory=src, date.timezone=UTC, upload_max_filesize=20M, post_max_size=20M, memory_limit=512M, short_open_tag=Off'
coverage: pcov
ini-values: 'pcov.directory=src, date.timezone=UTC, upload_max_filesize=20M, post_max_size=20M, memory_limit=512M, short_open_tag=Off, xdebug.mode="develop,coverage"'
coverage: xdebug
tools: 'phpunit'
- name: 'Install PHP dependencies with Composer'
continue-on-error: ${{ matrix.experimental }}
run: |
composer require "laravel/framework=${{ matrix.laravel }}" --no-update
COMPOSER_MEMORY_LIMIT=-1 composer install --prefer-dist --no-progress --no-suggest --optimize-autoloader
Expand Down Expand Up @@ -192,6 +163,7 @@ jobs:
-e "s/\${DATABASE}/${{ env.DB_NAME }}/" \
-e "s/\${HOST}/${{ env.DB_HOST }}/" \
phpunit.xml.dist > phpunit.xml
./vendor/bin/phpunit -c phpunit.xml --migrate-configuration
if [[ ${{ matrix.coverage }} == true ]]; then
./vendor/bin/phpunit --stderr --coverage-clover build/logs/clover.xml --coverage-text
else
Expand Down
17 changes: 8 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,18 @@
}
},
"require": {
"php": "^7.3|^7.4|^8.0|^8.1|^8.2",
"illuminate/support": "^5.7|^6.20|^7.30|^8.20|^9.0|^10.0|^11.0",
"illuminate/database": "^5.7|^6.20|^7.30|^8.20|^9.0|^10.0|^11.0",
"illuminate/console": "^5.7|^6.20|^7.30|^8.20|^9.0|^10.0|^11.0"
"php": "^8.3|^8.4",
"illuminate/support": "^11.0",
"illuminate/database": "^11.0",
"illuminate/console": "^11.0"
},
"require-dev": {
"phpunit/phpunit": "^7.3|^8.5|^9.4|^10.0|^11.0",
"phpunit/phpunit": "^11.0",
"php-mock/php-mock": "^2.0",
"orchestra/testbench": "^3.8|^4.8|^5.7|^6.2|^7.0|^8.0|^9.0",
"umbrellio/code-style-php": "^1.0",
"orchestra/testbench": "^9.0",
"umbrellio/code-style-php": "^1.2",
"laravel/legacy-factories": "^1.0",
"php-coveralls/php-coveralls": "^2.1",
"squizlabs/php_codesniffer": "^3.5"
"php-coveralls/php-coveralls": "^2.7"
},
"scripts": {
"lint": "vendor/bin/ecs check src --config=ecs.php",
Expand Down
31 changes: 31 additions & 0 deletions phpunit.xml.bak
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
bootstrap="vendor/autoload.php"
colors="true" processIsolation="false"
stopOnFailure="true"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.1/phpunit.xsd"
>
<coverage>
<include>
<directory suffix=".php">./src</directory>
</include>
<exclude>
<file>./src/Console/RollbackNewMigrations.php</file>
</exclude>
</coverage>
<php>
<env name="APP_ENV" value="testing"/>
<ini name="error_reporting" value="-1"/>
<var name="db_type" value="pdo_pgsql"/>
<var name="db_host" value="127.0.0.1"/>
<var name="db_username" value="postgres"/>
<var name="db_password" value=""/>
<var name="db_database" value="testing"/>
<var name="db_port" value="5432"/>
</php>
<testsuites>
<testsuite name="Test suite">
<directory suffix="Test.php">./tests</directory>
</testsuite>
</testsuites>
</phpunit>
7 changes: 4 additions & 3 deletions tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ sed -e "s/\${USERNAME}/postgres/" \
-e "s/\${DATABASE}/testing/" \
-e "s/\${HOST}/127.0.0.1/" \
.env.sample > .env
sed -e "s/\${LARAVEL_VERSION}/^8.0/" \
-e "s/\${PHP_VERSION}/8.0.11/" \
sed -e "s/\${LARAVEL_VERSION}/^11.0/" \
-e "s/\${PHP_VERSION}/8.3.6/" \
composer.json.sample > composer.json
rm -rf release
composer create-project laravel/laravel release
Expand All @@ -29,4 +29,5 @@ sed -e "s/\${USERNAME}/postgres/" \
-e "s/\${DATABASE}/testing/" \
-e "s/\${HOST}/127.0.0.1/" \
phpunit.xml.dist > phpunit.xml
php -d pcov.directory='.' vendor/bin/phpunit --coverage-html build --coverage-text
php vendor/bin/phpunit -c phpunit.xml --migrate-configuration
php -d xdebug.mode=coverage -d memory_limit=-1 vendor/bin/phpunit --coverage-html build --coverage-text
18 changes: 7 additions & 11 deletions tests/functional/Console/RollbackMissingMigrationsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
use Generator;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\DB;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Test;
use Umbrellio\Deploy\Exceptions\RollbackMissingMigrationException;
use Umbrellio\Deploy\RollbackMissingMigrationServiceProvider;
use Umbrellio\Deploy\Tests\FunctionalTestCase;
Expand Down Expand Up @@ -35,31 +37,25 @@ public static function provideMigrations(): Generator
];
}

/**
* @test
* @dataProvider provideMigrations
*/
#[Test]
#[DataProvider('provideMigrations')]
public function rollbackSuccessful(array $before, array $after): void
{
$this->assertSame($before, $this->getMigrations());
$this->rollback(self::DATABASE_PATH . 'new_migrations', self::DATABASE_PATH . 'old_migrations');
$this->assertSame($after, $this->getMigrations());
}

/**
* @test
* @dataProvider provideMigrations
*/
#[Test]
#[DataProvider('provideMigrations')]
public function nothingToRollback(array $before, array $after): void
{
$this->assertSame($before, $this->getMigrations());
$this->rollback(self::DATABASE_PATH . 'old_migrations', self::DATABASE_PATH . 'old_migrations');
$this->assertSame($before, $this->getMigrations());
}

/**
* @test
*/
#[Test]
public function rollbackFail(): void
{
$this->expectException(RollbackMissingMigrationException::class);
Expand Down
Empty file removed tests/unit/.gitkeep
Empty file.

0 comments on commit 130b7c0

Please sign in to comment.