Skip to content

Commit

Permalink
Support Laravel 11 (#113)
Browse files Browse the repository at this point in the history
* add laravel 11 to the ci

* add version-specific migrations

* ignore doctrine on laravel 11

* support testing mariadb locally

* update readme

* use DatabaseTransactions

* change files to 4 spaces

* ci fixes

* ci fixes

* ci fixes

* ci fixes

* ci fixes

* ci fixes

* ci fixes

* ci fixes

* ci fixes

* ci fixes

* ci fixes

* ci fixes

* ci fixes
  • Loading branch information
MatanYadaev authored Mar 13, 2024
1 parent ce5c27f commit e840f42
Show file tree
Hide file tree
Showing 20 changed files with 399 additions and 328 deletions.
73 changes: 37 additions & 36 deletions .github/workflows/pest-coverage.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,42 @@
name: Tests coverage

on:
push:
branches:
- master
pull_request:
push:
branches:
- master
pull_request:

jobs:
test:
name: Pest - coverage

runs-on: ubuntu-latest

services:
db:
image: mysql:8.0
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: laravel_eloquent_spatial_test
ports:
- 3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3

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

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.3
coverage: xdebug

- name: Install dependencies
run: composer install --prefer-dist --no-interaction

- name: Execute tests
env:
DB_PORT: ${{ job.services.db.ports['3306'] }}
run: XDEBUG_MODE=coverage ./vendor/bin/pest --coverage --min=100
test:
name: Pest - coverage

runs-on: ubuntu-latest

services:
db:
image: mysql:8.0
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: laravel_eloquent_spatial_test
ports:
- 3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3

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

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.3
coverage: xdebug

- name: Install dependencies
run: composer install --prefer-dist --no-interaction

- name: Execute tests
env:
DB_PORT: ${{ job.services.db.ports['3306'] }}
DB_CONNECTION: mysql
run: XDEBUG_MODE=coverage ./vendor/bin/pest --coverage --min=100
130 changes: 75 additions & 55 deletions .github/workflows/pest.yml
Original file line number Diff line number Diff line change
@@ -1,60 +1,80 @@
name: Tests

on:
push:
branches:
- master
pull_request:
push:
branches:
- master
pull_request:

jobs:
test:
name: Pest - PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }} - DB ${{ matrix.db }} ${{ matrix.dependency-version }}

runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
php: [ 8.3, 8.2, 8.1 ]
laravel: [ 10.* ]
db: [ 'mysql:8.0', 'mysql:5.7', 'mariadb:10.11', 'postgis/postgis:16-3.4', 'postgis/postgis:15-3.4', 'postgis/postgis:14-3.4', 'postgis/postgis:13-3.4', 'postgis/postgis:12-3.4' ]
dependency-version: [ prefer-stable, prefer-lowest ]
include:
- laravel: 10.*
testbench: ^8.0

services:
db:
image: ${{ matrix.db }}
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: laravel_eloquent_spatial_test
POSTGRES_DB: laravel_eloquent_spatial_test
POSTGRES_USER: root
POSTGRES_HOST_AUTH_METHOD: trust
ports:
- ${{ contains(matrix.db, 'postgis') && '5432' || '3306' }}
options: >-
${{ (contains(matrix.db, 'postgis') && '--health-cmd="pg_isready"') || '--health-cmd="mysqladmin ping"' }}
--health-interval=10s --health-timeout=5s --health-retries=3
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none

- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction
- name: Execute tests
env:
DB_PORT: ${{ job.services.db.ports[contains(matrix.db, 'postgis') && '5432' || '3306'] }}
DB_CONNECTION: ${{ contains(matrix.db, 'postgis') && 'pgsql' || 'mysql' }}
run: vendor/bin/pest
test:
name: Pest - PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }} - DB ${{ matrix.db }} ${{ matrix.dependency-version }}

runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
php: [ 8.3, 8.2, 8.1 ]
laravel: [ 11.*, 10.* ]
db: [ 'mysql:8.0', 'mysql:5.7', 'mariadb:10.11', 'postgis/postgis:16-3.4', 'postgis/postgis:15-3.4', 'postgis/postgis:14-3.4', 'postgis/postgis:13-3.4', 'postgis/postgis:12-3.4' ]
dependency-version: [ prefer-stable ]
include:
- laravel: 10.*
testbench: ^8.0
- laravel: 11.*
testbench: ^9.0
exclude:
- laravel: 11.*
php: 8.1

services:
db:
image: ${{ matrix.db }}
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: laravel_eloquent_spatial_test
POSTGRES_DB: laravel_eloquent_spatial_test
POSTGRES_USER: root
POSTGRES_HOST_AUTH_METHOD: trust
ports:
- ${{ contains(matrix.db, 'postgis') && '5432' || '3306' }}
options: >-
${{ (contains(matrix.db, 'postgis') && '--health-cmd="pg_isready"') || '--health-cmd="mysqladmin ping"' }}
--health-interval=10s --health-timeout=5s --health-retries=3
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none

- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction
- name: Set DB_CONNECTION env variable (PostGIS)
if: contains(matrix.db, 'postgis')
run: |
echo "DB_CONNECTION=pgsql" >> "$GITHUB_ENV"
- name: Set DB_CONNECTION env variable (MariaDB & Laravel 11)
if: contains(matrix.laravel, '11') && contains(matrix.db, 'mariadb')
run: |
echo "DB_CONNECTION=mariadb" >> "$GITHUB_ENV"
- name: Set DB_COLLATION env variable (Mysql 5.7 & Laravel 11)
if: contains(matrix.laravel, '11') && contains(matrix.db, 'mysql:5.7')
run: |
echo "DB_COLLATION=utf8mb4_unicode_ci" >> "$GITHUB_ENV"
- name: Execute tests
env:
DB_PORT: ${{ job.services.db.ports[contains(matrix.db, 'postgis') && '5432' || '3306'] }}
DB_CONNECTION: ${{ env.DB_CONNECTION || 'mysql' }}
run: vendor/bin/pest
46 changes: 23 additions & 23 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
name: Static code analysis

on:
push:
branches:
- master
pull_request:
push:
branches:
- master
pull_request:

jobs:
phpstan:
name: PHPStan
phpstan:
name: PHPStan

runs-on: ubuntu-latest
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
php: [ 8.3, 8.2, 8.1 ]
strategy:
fail-fast: false
matrix:
php: [ 8.3, 8.2 ]

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

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none

- name: Install dependencies
run: composer install --prefer-dist --no-interaction
- name: Install dependencies
run: composer install --prefer-dist --no-interaction

- name: Run PHPStan
run: ./vendor/bin/phpstan analyse --memory-limit=2G --error-format=github
- name: Run PHPStan
run: ./vendor/bin/phpstan analyse --memory-limit=2G --error-format=github
38 changes: 19 additions & 19 deletions .github/workflows/pint.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
name: Lint

on:
push:
branches:
- master
pull_request:
push:
branches:
- master
pull_request:

jobs:
php-cs-fixer:
name: Pint
php-cs-fixer:
name: Pint

runs-on: ubuntu-latest
runs-on: ubuntu-latest

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

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.3
coverage: none
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.3
coverage: none

- name: Install dependencies
run: composer install --prefer-dist --no-interaction
- name: Install dependencies
run: composer install --prefer-dist --no-interaction

- name: Run PHP CS Fixer
run: ./vendor/bin/pint --test
- name: Run PHP CS Fixer
run: ./vendor/bin/pint --test
40 changes: 20 additions & 20 deletions .github/workflows/update-changelog.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
name: Update Changelog

on:
release:
types: [ released ]
release:
types: [ released ]

jobs:
update:
runs-on: ubuntu-latest
update:
runs-on: ubuntu-latest

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

- name: Update Changelog
uses: stefanzweifel/changelog-updater-action@v1
with:
latest-version: ${{ github.event.release.name }}
release-notes: ${{ github.event.release.body }}
- name: Update Changelog
uses: stefanzweifel/changelog-updater-action@v1
with:
latest-version: ${{ github.event.release.name }}
release-notes: ${{ github.event.release.body }}

- name: Commit updated CHANGELOG
uses: stefanzweifel/git-auto-commit-action@v4
with:
branch: master
commit_message: Update CHANGELOG
file_pattern: CHANGELOG.md
- name: Commit updated CHANGELOG
uses: stefanzweifel/git-auto-commit-action@v4
with:
branch: master
commit_message: Update CHANGELOG
file_pattern: CHANGELOG.md
15 changes: 8 additions & 7 deletions .run/Fix formatting.run.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Fix formatting" type="ComposerRunConfigurationType" factoryName="Composer Script">
<option name="commandLineParameters" value="" />
<option name="pathToComposerJson" value="$PROJECT_DIR$/composer.json" />
<option name="script" value="php-cs-fixer" />
<method v="2" />
</configuration>
</component>
<configuration default="false" name="Fix formatting" type="ComposerRunConfigurationType"
factoryName="Composer Script">
<option name="commandLineParameters" value=""/>
<option name="pathToComposerJson" value="$PROJECT_DIR$/composer.json"/>
<option name="script" value="php-cs-fixer"/>
<method v="2"/>
</configuration>
</component>
Loading

0 comments on commit e840f42

Please sign in to comment.