Skip to content

Commit e840f42

Browse files
authored
Support Laravel 11 (#113)
* 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
1 parent ce5c27f commit e840f42

20 files changed

+399
-328
lines changed

.github/workflows/pest-coverage.yml

+37-36
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,42 @@
11
name: Tests coverage
22

33
on:
4-
push:
5-
branches:
6-
- master
7-
pull_request:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
88

99
jobs:
10-
test:
11-
name: Pest - coverage
12-
13-
runs-on: ubuntu-latest
14-
15-
services:
16-
db:
17-
image: mysql:8.0
18-
env:
19-
MYSQL_ALLOW_EMPTY_PASSWORD: yes
20-
MYSQL_DATABASE: laravel_eloquent_spatial_test
21-
ports:
22-
- 3306
23-
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
24-
25-
steps:
26-
- name: Checkout code
27-
uses: actions/checkout@v2
28-
29-
- name: Setup PHP
30-
uses: shivammathur/setup-php@v2
31-
with:
32-
php-version: 8.3
33-
coverage: xdebug
34-
35-
- name: Install dependencies
36-
run: composer install --prefer-dist --no-interaction
37-
38-
- name: Execute tests
39-
env:
40-
DB_PORT: ${{ job.services.db.ports['3306'] }}
41-
run: XDEBUG_MODE=coverage ./vendor/bin/pest --coverage --min=100
10+
test:
11+
name: Pest - coverage
12+
13+
runs-on: ubuntu-latest
14+
15+
services:
16+
db:
17+
image: mysql:8.0
18+
env:
19+
MYSQL_ALLOW_EMPTY_PASSWORD: yes
20+
MYSQL_DATABASE: laravel_eloquent_spatial_test
21+
ports:
22+
- 3306
23+
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
24+
25+
steps:
26+
- name: Checkout code
27+
uses: actions/checkout@v2
28+
29+
- name: Setup PHP
30+
uses: shivammathur/setup-php@v2
31+
with:
32+
php-version: 8.3
33+
coverage: xdebug
34+
35+
- name: Install dependencies
36+
run: composer install --prefer-dist --no-interaction
37+
38+
- name: Execute tests
39+
env:
40+
DB_PORT: ${{ job.services.db.ports['3306'] }}
41+
DB_CONNECTION: mysql
42+
run: XDEBUG_MODE=coverage ./vendor/bin/pest --coverage --min=100

.github/workflows/pest.yml

+75-55
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,80 @@
11
name: Tests
22

33
on:
4-
push:
5-
branches:
6-
- master
7-
pull_request:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
88

99
jobs:
10-
test:
11-
name: Pest - PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }} - DB ${{ matrix.db }} ${{ matrix.dependency-version }}
12-
13-
runs-on: ubuntu-latest
14-
15-
strategy:
16-
fail-fast: false
17-
matrix:
18-
php: [ 8.3, 8.2, 8.1 ]
19-
laravel: [ 10.* ]
20-
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' ]
21-
dependency-version: [ prefer-stable, prefer-lowest ]
22-
include:
23-
- laravel: 10.*
24-
testbench: ^8.0
25-
26-
services:
27-
db:
28-
image: ${{ matrix.db }}
29-
env:
30-
MYSQL_ALLOW_EMPTY_PASSWORD: yes
31-
MYSQL_DATABASE: laravel_eloquent_spatial_test
32-
POSTGRES_DB: laravel_eloquent_spatial_test
33-
POSTGRES_USER: root
34-
POSTGRES_HOST_AUTH_METHOD: trust
35-
ports:
36-
- ${{ contains(matrix.db, 'postgis') && '5432' || '3306' }}
37-
options: >-
38-
${{ (contains(matrix.db, 'postgis') && '--health-cmd="pg_isready"') || '--health-cmd="mysqladmin ping"' }}
39-
--health-interval=10s --health-timeout=5s --health-retries=3
40-
41-
steps:
42-
- name: Checkout code
43-
uses: actions/checkout@v2
44-
45-
- name: Setup PHP
46-
uses: shivammathur/setup-php@v2
47-
with:
48-
php-version: ${{ matrix.php }}
49-
coverage: none
50-
51-
- name: Install dependencies
52-
run: |
53-
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
54-
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction
55-
56-
- name: Execute tests
57-
env:
58-
DB_PORT: ${{ job.services.db.ports[contains(matrix.db, 'postgis') && '5432' || '3306'] }}
59-
DB_CONNECTION: ${{ contains(matrix.db, 'postgis') && 'pgsql' || 'mysql' }}
60-
run: vendor/bin/pest
10+
test:
11+
name: Pest - PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }} - DB ${{ matrix.db }} ${{ matrix.dependency-version }}
12+
13+
runs-on: ubuntu-latest
14+
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
php: [ 8.3, 8.2, 8.1 ]
19+
laravel: [ 11.*, 10.* ]
20+
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' ]
21+
dependency-version: [ prefer-stable ]
22+
include:
23+
- laravel: 10.*
24+
testbench: ^8.0
25+
- laravel: 11.*
26+
testbench: ^9.0
27+
exclude:
28+
- laravel: 11.*
29+
php: 8.1
30+
31+
services:
32+
db:
33+
image: ${{ matrix.db }}
34+
env:
35+
MYSQL_ALLOW_EMPTY_PASSWORD: yes
36+
MYSQL_DATABASE: laravel_eloquent_spatial_test
37+
POSTGRES_DB: laravel_eloquent_spatial_test
38+
POSTGRES_USER: root
39+
POSTGRES_HOST_AUTH_METHOD: trust
40+
ports:
41+
- ${{ contains(matrix.db, 'postgis') && '5432' || '3306' }}
42+
options: >-
43+
${{ (contains(matrix.db, 'postgis') && '--health-cmd="pg_isready"') || '--health-cmd="mysqladmin ping"' }}
44+
--health-interval=10s --health-timeout=5s --health-retries=3
45+
46+
steps:
47+
- name: Checkout code
48+
uses: actions/checkout@v2
49+
50+
- name: Setup PHP
51+
uses: shivammathur/setup-php@v2
52+
with:
53+
php-version: ${{ matrix.php }}
54+
coverage: none
55+
56+
- name: Install dependencies
57+
run: |
58+
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
59+
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction
60+
61+
- name: Set DB_CONNECTION env variable (PostGIS)
62+
if: contains(matrix.db, 'postgis')
63+
run: |
64+
echo "DB_CONNECTION=pgsql" >> "$GITHUB_ENV"
65+
66+
- name: Set DB_CONNECTION env variable (MariaDB & Laravel 11)
67+
if: contains(matrix.laravel, '11') && contains(matrix.db, 'mariadb')
68+
run: |
69+
echo "DB_CONNECTION=mariadb" >> "$GITHUB_ENV"
70+
71+
- name: Set DB_COLLATION env variable (Mysql 5.7 & Laravel 11)
72+
if: contains(matrix.laravel, '11') && contains(matrix.db, 'mysql:5.7')
73+
run: |
74+
echo "DB_COLLATION=utf8mb4_unicode_ci" >> "$GITHUB_ENV"
75+
76+
- name: Execute tests
77+
env:
78+
DB_PORT: ${{ job.services.db.ports[contains(matrix.db, 'postgis') && '5432' || '3306'] }}
79+
DB_CONNECTION: ${{ env.DB_CONNECTION || 'mysql' }}
80+
run: vendor/bin/pest

.github/workflows/phpstan.yml

+23-23
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
11
name: Static code analysis
22

33
on:
4-
push:
5-
branches:
6-
- master
7-
pull_request:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
88

99
jobs:
10-
phpstan:
11-
name: PHPStan
10+
phpstan:
11+
name: PHPStan
1212

13-
runs-on: ubuntu-latest
13+
runs-on: ubuntu-latest
1414

15-
strategy:
16-
fail-fast: false
17-
matrix:
18-
php: [ 8.3, 8.2, 8.1 ]
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
php: [ 8.3, 8.2 ]
1919

20-
steps:
21-
- name: Checkout code
22-
uses: actions/checkout@v2
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v2
2323

24-
- name: Setup PHP
25-
uses: shivammathur/setup-php@v2
26-
with:
27-
php-version: ${{ matrix.php }}
28-
coverage: none
24+
- name: Setup PHP
25+
uses: shivammathur/setup-php@v2
26+
with:
27+
php-version: ${{ matrix.php }}
28+
coverage: none
2929

30-
- name: Install dependencies
31-
run: composer install --prefer-dist --no-interaction
30+
- name: Install dependencies
31+
run: composer install --prefer-dist --no-interaction
3232

33-
- name: Run PHPStan
34-
run: ./vendor/bin/phpstan analyse --memory-limit=2G --error-format=github
33+
- name: Run PHPStan
34+
run: ./vendor/bin/phpstan analyse --memory-limit=2G --error-format=github

.github/workflows/pint.yml

+19-19
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
name: Lint
22

33
on:
4-
push:
5-
branches:
6-
- master
7-
pull_request:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
88

99
jobs:
10-
php-cs-fixer:
11-
name: Pint
10+
php-cs-fixer:
11+
name: Pint
1212

13-
runs-on: ubuntu-latest
13+
runs-on: ubuntu-latest
1414

15-
steps:
16-
- name: Checkout code
17-
uses: actions/checkout@v2
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v2
1818

19-
- name: Setup PHP
20-
uses: shivammathur/setup-php@v2
21-
with:
22-
php-version: 8.3
23-
coverage: none
19+
- name: Setup PHP
20+
uses: shivammathur/setup-php@v2
21+
with:
22+
php-version: 8.3
23+
coverage: none
2424

25-
- name: Install dependencies
26-
run: composer install --prefer-dist --no-interaction
25+
- name: Install dependencies
26+
run: composer install --prefer-dist --no-interaction
2727

28-
- name: Run PHP CS Fixer
29-
run: ./vendor/bin/pint --test
28+
- name: Run PHP CS Fixer
29+
run: ./vendor/bin/pint --test
+20-20
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
name: Update Changelog
22

33
on:
4-
release:
5-
types: [ released ]
4+
release:
5+
types: [ released ]
66

77
jobs:
8-
update:
9-
runs-on: ubuntu-latest
8+
update:
9+
runs-on: ubuntu-latest
1010

11-
steps:
12-
- name: Checkout code
13-
uses: actions/checkout@v2
14-
with:
15-
ref: master
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v2
14+
with:
15+
ref: master
1616

17-
- name: Update Changelog
18-
uses: stefanzweifel/changelog-updater-action@v1
19-
with:
20-
latest-version: ${{ github.event.release.name }}
21-
release-notes: ${{ github.event.release.body }}
17+
- name: Update Changelog
18+
uses: stefanzweifel/changelog-updater-action@v1
19+
with:
20+
latest-version: ${{ github.event.release.name }}
21+
release-notes: ${{ github.event.release.body }}
2222

23-
- name: Commit updated CHANGELOG
24-
uses: stefanzweifel/git-auto-commit-action@v4
25-
with:
26-
branch: master
27-
commit_message: Update CHANGELOG
28-
file_pattern: CHANGELOG.md
23+
- name: Commit updated CHANGELOG
24+
uses: stefanzweifel/git-auto-commit-action@v4
25+
with:
26+
branch: master
27+
commit_message: Update CHANGELOG
28+
file_pattern: CHANGELOG.md

.run/Fix formatting.run.xml

+8-7
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
<component name="ProjectRunConfigurationManager">
2-
<configuration default="false" name="Fix formatting" type="ComposerRunConfigurationType" factoryName="Composer Script">
3-
<option name="commandLineParameters" value="" />
4-
<option name="pathToComposerJson" value="$PROJECT_DIR$/composer.json" />
5-
<option name="script" value="php-cs-fixer" />
6-
<method v="2" />
7-
</configuration>
8-
</component>
2+
<configuration default="false" name="Fix formatting" type="ComposerRunConfigurationType"
3+
factoryName="Composer Script">
4+
<option name="commandLineParameters" value=""/>
5+
<option name="pathToComposerJson" value="$PROJECT_DIR$/composer.json"/>
6+
<option name="script" value="php-cs-fixer"/>
7+
<method v="2"/>
8+
</configuration>
9+
</component>

0 commit comments

Comments
 (0)