Skip to content

Commit 7680465

Browse files
committed
Update GitHub Actions for Laravel 12
1 parent 82ba43e commit 7680465

File tree

3 files changed

+143
-157
lines changed

3 files changed

+143
-157
lines changed

.github/workflows/build-ci-atlas.yml

+53-58
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,69 @@
1-
name: "Atlas CI"
1+
name: Atlas CI
22

33
on:
4-
push:
5-
pull_request:
4+
push:
5+
pull_request:
66

77
jobs:
8-
build:
9-
runs-on: "${{ matrix.os }}"
8+
build:
9+
runs-on: ${{ matrix.os }}
1010

11-
name: "PHP ${{ matrix.php }} Laravel ${{ matrix.laravel }} Atlas"
11+
name: PHP ${{ matrix.php }} Laravel ${{ matrix.laravel }} Atlas
1212

13-
strategy:
14-
matrix:
15-
os:
16-
- "ubuntu-latest"
17-
php:
18-
- "8.2"
19-
- "8.3"
20-
- "8.4"
21-
laravel:
22-
- "11.*"
13+
strategy:
14+
matrix:
15+
os: [ubuntu-latest]
16+
php: ['8.2', '8.3', '8.4']
17+
laravel: ['11.*', '12.*']
2318

24-
steps:
25-
- uses: "actions/checkout@v4"
19+
steps:
20+
- uses: actions/checkout@v4
2621

27-
- name: "Create MongoDB Atlas Local"
28-
run: |
29-
docker run --name mongodb -p 27017:27017 --detach mongodb/mongodb-atlas-local:latest
30-
until docker exec --tty mongodb mongosh --eval "db.runCommand({ ping: 1 })"; do
31-
sleep 1
32-
done
33-
until docker exec --tty mongodb mongosh --eval "db.createCollection('connection_test') && db.getCollection('connection_test').createSearchIndex({mappings:{dynamic: true}})"; do
34-
sleep 1
35-
done
22+
- name: Create MongoDB Atlas Local
23+
run: |
24+
docker run --name mongodb -p 27017:27017 --detach mongodb/mongodb-atlas-local:latest
25+
until docker exec --tty mongodb mongosh --eval "db.runCommand({ ping: 1 })"; do
26+
sleep 1
27+
done
28+
until docker exec --tty mongodb mongosh --eval "db.createCollection('connection_test') && db.getCollection('connection_test').createSearchIndex({mappings:{dynamic: true}})"; do
29+
sleep 1
30+
done
3631
37-
- name: "Show MongoDB server status"
38-
run: |
39-
docker exec --tty mongodb mongosh --eval "db.runCommand({ serverStatus: 1 })"
32+
- name: Show MongoDB server status
33+
run: |
34+
docker exec --tty mongodb mongosh --eval "db.runCommand({ serverStatus: 1 })"
4035
41-
- name: "Installing php"
42-
uses: "shivammathur/setup-php@v2"
43-
with:
44-
php-version: ${{ matrix.php }}
45-
extensions: "curl,mbstring,xdebug"
46-
coverage: "xdebug"
47-
tools: "composer"
36+
- name: Installing php
37+
uses: shivammathur/setup-php@v2
38+
with:
39+
php-version: ${{ matrix.php }}
40+
extensions: curl,mbstring,xdebug
41+
coverage: xdebug
42+
tools: composer
4843

49-
- name: "Show Docker version"
50-
if: ${{ runner.debug }}
51-
run: "docker version && env"
44+
- name: Show Docker version
45+
if: '${{ runner.debug }}'
46+
run: docker version && env
5247

53-
- name: "Restrict Laravel version"
54-
run: "composer require --dev --no-update 'laravel/framework:${{ matrix.laravel }}'"
48+
- name: Restrict Laravel version
49+
run: composer require --dev --no-update 'laravel/framework:${{ matrix.laravel }}'
5550

56-
- name: "Download Composer cache dependencies from cache"
57-
id: "composer-cache"
58-
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
51+
- name: Download Composer cache dependencies from cache
52+
id: composer-cache
53+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
5954

60-
- name: "Cache Composer dependencies"
61-
uses: "actions/cache@v4"
62-
with:
63-
path: ${{ steps.composer-cache.outputs.dir }}
64-
key: "${{ matrix.os }}-composer-${{ hashFiles('**/composer.json') }}"
65-
restore-keys: "${{ matrix.os }}-composer-"
55+
- name: Cache Composer dependencies
56+
uses: actions/cache@v4
57+
with:
58+
path: ${{ steps.composer-cache.outputs.dir }}
59+
key: ${{ matrix.os }}-composer-${{ hashFiles('**/composer.json') }}
60+
restore-keys: ${{ matrix.os }}-composer-
6661

67-
- name: "Install dependencies"
68-
run: |
69-
composer update --no-interaction
62+
- name: Install dependencies
63+
run: |
64+
composer update --no-interaction
7065
71-
- name: "Run tests"
72-
run: |
73-
export MONGODB_URI="mongodb://127.0.0.1:27017/?directConnection=true"
74-
./vendor/bin/phpunit --coverage-clover coverage.xml --group atlas-search
66+
- name: Run tests
67+
run: |
68+
export MONGODB_URI="mongodb://127.0.0.1:27017/?directConnection=true"
69+
./vendor/bin/phpunit --coverage-clover coverage.xml --group atlas-search

.github/workflows/build-ci.yml

+72-81
Original file line numberDiff line numberDiff line change
@@ -1,97 +1,88 @@
1-
name: "CI"
1+
name: CI
22

33
on:
4-
push:
5-
pull_request:
4+
push:
5+
pull_request:
66

77
jobs:
8-
build:
9-
runs-on: "${{ matrix.os }}"
8+
build:
9+
runs-on: ${{ matrix.os }}
1010

11-
name: "PHP ${{ matrix.php }} Laravel ${{ matrix.laravel }} MongoDB ${{ matrix.mongodb }} ${{ matrix.mode }}"
11+
name: PHP ${{ matrix.php }} Laravel ${{ matrix.laravel }} MongoDB ${{ matrix.mongodb }} ${{ matrix.mode }}
1212

13-
strategy:
14-
matrix:
15-
os:
16-
- "ubuntu-latest"
17-
mongodb:
18-
- "4.4"
19-
- "5.0"
20-
- "6.0"
21-
- "7.0"
22-
- "8.0"
23-
php:
24-
- "8.1"
25-
- "8.2"
26-
- "8.3"
27-
- "8.4"
28-
laravel:
29-
- "10.*"
30-
- "11.*"
31-
include:
32-
- php: "8.1"
33-
laravel: "10.*"
34-
mongodb: "5.0"
35-
mode: "low-deps"
36-
os: "ubuntu-latest"
37-
- php: "8.4"
38-
laravel: "11.*"
39-
mongodb: "7.0"
40-
os: "ubuntu-latest"
41-
exclude:
42-
- php: "8.1"
43-
laravel: "11.*"
13+
strategy:
14+
matrix:
15+
os: [ubuntu-latest]
16+
mongodb: ['4.4', '5.0', '6.0', '7.0', '8.0']
17+
php: ['8.1', '8.2', '8.3', '8.4']
18+
laravel: ['10.*', '11.*', '12.*']
19+
include:
20+
- php: '8.1'
21+
laravel: 10.*
22+
mongodb: '5.0'
23+
mode: low-deps
24+
os: ubuntu-latest
25+
- php: '8.4'
26+
laravel: 11.*
27+
mongodb: '7.0'
28+
os: ubuntu-latest
29+
exclude:
30+
- php: '8.1'
31+
laravel: 11.*
32+
- laravel: 12.*
33+
php: '8.1'
4434

45-
steps:
46-
- uses: "actions/checkout@v4"
35+
steps:
36+
- uses: actions/checkout@v4
4737

48-
- name: "Create MongoDB Replica Set"
49-
run: |
50-
docker run --name mongodb -p 27017:27017 -e MONGO_INITDB_DATABASE=unittest --detach mongo:${{ matrix.mongodb }} mongod --replSet rs --setParameter transactionLifetimeLimitSeconds=5
38+
- name: Create MongoDB Replica Set
39+
run: |
40+
docker run --name mongodb -p 27017:27017 -e MONGO_INITDB_DATABASE=unittest --detach mongo:${{ matrix.mongodb }} mongod --replSet rs --setParameter transactionLifetimeLimitSeconds=5
5141
52-
if [ "${{ matrix.mongodb }}" = "4.4" ]; then MONGOSH_BIN="mongo"; else MONGOSH_BIN="mongosh"; fi
53-
until docker exec --tty mongodb $MONGOSH_BIN --eval "db.runCommand({ ping: 1 })"; do
54-
sleep 1
55-
done
56-
sudo docker exec --tty mongodb $MONGOSH_BIN --eval "rs.initiate({\"_id\":\"rs\",\"members\":[{\"_id\":0,\"host\":\"127.0.0.1:27017\" }]})"
42+
if [ "${{ matrix.mongodb }}" = "4.4" ]; then MONGOSH_BIN="mongo"; else MONGOSH_BIN="mongosh"; fi
43+
until docker exec --tty mongodb $MONGOSH_BIN --eval "db.runCommand({ ping: 1 })"; do
44+
sleep 1
45+
done
46+
sudo docker exec --tty mongodb $MONGOSH_BIN --eval "rs.initiate({\"_id\":\"rs\",\"members\":[{\"_id\":0,\"host\":\"127.0.0.1:27017\" }]})"
5747
58-
- name: "Show MongoDB server status"
59-
run: |
60-
if [ "${{ matrix.mongodb }}" = "4.4" ]; then MONGOSH_BIN="mongo"; else MONGOSH_BIN="mongosh"; fi
61-
docker exec --tty mongodb $MONGOSH_BIN --eval "db.runCommand({ serverStatus: 1 })"
48+
- name: Show MongoDB server status
49+
run: |
50+
if [ "${{ matrix.mongodb }}" = "4.4" ]; then MONGOSH_BIN="mongo"; else MONGOSH_BIN="mongosh"; fi
51+
docker exec --tty mongodb $MONGOSH_BIN --eval "db.runCommand({ serverStatus: 1 })"
6252
63-
- name: "Installing php"
64-
uses: "shivammathur/setup-php@v2"
65-
with:
66-
php-version: ${{ matrix.php }}
67-
extensions: "curl,mbstring,xdebug"
68-
coverage: "xdebug"
69-
tools: "composer"
53+
- name: Installing php
54+
uses: shivammathur/setup-php@v2
55+
with:
56+
php-version: ${{ matrix.php }}
57+
extensions: curl,mbstring,xdebug
58+
coverage: xdebug
59+
tools: composer
7060

71-
- name: "Show Docker version"
72-
if: ${{ runner.debug }}
73-
run: "docker version && env"
61+
- name: Show Docker version
62+
if: '${{ runner.debug }}'
63+
run: docker version && env
7464

75-
- name: "Restrict Laravel version"
76-
run: "composer require --dev --no-update 'laravel/framework:${{ matrix.laravel }}'"
65+
- name: Restrict Laravel version
66+
run: composer require --dev --no-update 'laravel/framework:${{ matrix.laravel }}'
7767

78-
- name: "Download Composer cache dependencies from cache"
79-
id: "composer-cache"
80-
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
68+
- name: Download Composer cache dependencies from cache
69+
id: composer-cache
70+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
8171

82-
- name: "Cache Composer dependencies"
83-
uses: "actions/cache@v4"
84-
with:
85-
path: ${{ steps.composer-cache.outputs.dir }}
86-
key: "${{ matrix.os }}-composer-${{ hashFiles('**/composer.json') }}"
87-
restore-keys: "${{ matrix.os }}-composer-"
72+
- name: Cache Composer dependencies
73+
uses: actions/cache@v4
74+
with:
75+
path: ${{ steps.composer-cache.outputs.dir }}
76+
key: ${{ matrix.os }}-composer-${{ hashFiles('**/composer.json') }}
77+
restore-keys: ${{ matrix.os }}-composer-
8878

89-
- name: "Install dependencies"
90-
run: |
91-
composer update --no-interaction \
92-
$([[ "${{ matrix.mode }}" == low-deps ]] && echo ' --prefer-lowest') \
93-
$([[ "${{ matrix.mode }}" == ignore-php-req ]] && echo ' --ignore-platform-req=php+')
94-
- name: "Run tests"
95-
run: |
96-
export MONGODB_URI="mongodb://127.0.0.1:27017/?replicaSet=rs"
97-
./vendor/bin/phpunit --coverage-clover coverage.xml --exclude-group atlas-search
79+
- name: Install dependencies
80+
run: |
81+
composer update --no-interaction \
82+
$([[ "${{ matrix.mode }}" == low-deps ]] && echo ' --prefer-lowest') \
83+
$([[ "${{ matrix.mode }}" == ignore-php-req ]] && echo ' --ignore-platform-req=php+')
84+
85+
- name: Run tests
86+
run: |
87+
export MONGODB_URI="mongodb://127.0.0.1:27017/?replicaSet=rs"
88+
./vendor/bin/phpunit --coverage-clover coverage.xml --exclude-group atlas-search

.github/workflows/static-analysis.yml

+18-18
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,37 @@
1-
name: "Static Analysis"
1+
name: Static Analysis
22

33
on:
44
push:
55
pull_request:
66
workflow_call:
77
inputs:
88
ref:
9-
description: "The git ref to check"
9+
description: The git ref to check
1010
type: string
1111
required: true
1212

1313
env:
14-
PHP_VERSION: "8.2"
15-
DRIVER_VERSION: "stable"
14+
PHP_VERSION: '8.2'
15+
DRIVER_VERSION: stable
1616

1717
jobs:
1818
phpstan:
19-
runs-on: "ubuntu-22.04"
19+
runs-on: ubuntu-22.04
20+
2021
continue-on-error: true
22+
2123
strategy:
2224
matrix:
23-
php:
24-
- '8.1'
25-
- '8.2'
26-
- '8.3'
25+
php: ['8.1', '8.2', '8.3']
26+
2727
steps:
2828
- name: Checkout
2929
uses: actions/checkout@v4
3030
with:
3131
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.ref || github.ref }}
3232

33-
- name: "Get SHA hash of checked out ref"
34-
if: ${{ github.event_name == 'workflow_dispatch' }}
33+
- name: Get SHA hash of checked out ref
34+
if: "${{ github.event_name == 'workflow_dispatch' }}"
3535
run: |
3636
echo CHECKED_OUT_SHA=$(git rev-parse HEAD) >> $GITHUB_ENV
3737
@@ -58,23 +58,23 @@ jobs:
5858
uses: actions/cache/restore@v4
5959
with:
6060
path: .cache
61-
key: "phpstan-result-cache-${{ matrix.php }}-${{ github.run_id }}"
61+
key: phpstan-result-cache-${{ matrix.php }}-${{ github.run_id }}
6262
restore-keys: |
6363
phpstan-result-cache-
6464
6565
- name: Run PHPStan
6666
run: ./vendor/bin/phpstan analyse --no-interaction --no-progress --ansi --error-format=sarif > phpstan.sarif
6767
continue-on-error: true
6868

69-
- name: "Upload SARIF report"
70-
if: ${{ github.event_name != 'workflow_dispatch' }}
71-
uses: "github/codeql-action/upload-sarif@v3"
69+
- name: Upload SARIF report
70+
if: "${{ github.event_name != 'workflow_dispatch' }}"
71+
uses: github/codeql-action/upload-sarif@v3
7272
with:
7373
sarif_file: phpstan.sarif
7474

75-
- name: "Upload SARIF report"
76-
if: ${{ github.event_name == 'workflow_dispatch' }}
77-
uses: "github/codeql-action/upload-sarif@v3"
75+
- name: Upload SARIF report
76+
if: "${{ github.event_name == 'workflow_dispatch' }}"
77+
uses: github/codeql-action/upload-sarif@v3
7878
with:
7979
sarif_file: phpstan.sarif
8080
ref: ${{ inputs.ref }}

0 commit comments

Comments
 (0)