Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Laravel 12.x Compatibility #3278

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 53 additions & 58 deletions .github/workflows/build-ci-atlas.yml
Original file line number Diff line number Diff line change
@@ -1,74 +1,69 @@
name: "Atlas CI"
name: Atlas CI

on:
push:
pull_request:
push:
pull_request:

jobs:
build:
runs-on: "${{ matrix.os }}"
build:
runs-on: ${{ matrix.os }}

name: "PHP ${{ matrix.php }} Laravel ${{ matrix.laravel }} Atlas"
name: PHP ${{ matrix.php }} Laravel ${{ matrix.laravel }} Atlas

strategy:
matrix:
os:
- "ubuntu-latest"
php:
- "8.2"
- "8.3"
- "8.4"
laravel:
- "11.*"
strategy:
matrix:
os: [ubuntu-latest]
php: ['8.2', '8.3', '8.4']
laravel: ['11.*', '12.*']

steps:
- uses: "actions/checkout@v4"
steps:
- uses: actions/checkout@v4

- name: "Create MongoDB Atlas Local"
run: |
docker run --name mongodb -p 27017:27017 --detach mongodb/mongodb-atlas-local:latest
until docker exec --tty mongodb mongosh --eval "db.runCommand({ ping: 1 })"; do
sleep 1
done
until docker exec --tty mongodb mongosh --eval "db.createCollection('connection_test') && db.getCollection('connection_test').createSearchIndex({mappings:{dynamic: true}})"; do
sleep 1
done
- name: Create MongoDB Atlas Local
run: |
docker run --name mongodb -p 27017:27017 --detach mongodb/mongodb-atlas-local:latest
until docker exec --tty mongodb mongosh --eval "db.runCommand({ ping: 1 })"; do
sleep 1
done
until docker exec --tty mongodb mongosh --eval "db.createCollection('connection_test') && db.getCollection('connection_test').createSearchIndex({mappings:{dynamic: true}})"; do
sleep 1
done

- name: "Show MongoDB server status"
run: |
docker exec --tty mongodb mongosh --eval "db.runCommand({ serverStatus: 1 })"
- name: Show MongoDB server status
run: |
docker exec --tty mongodb mongosh --eval "db.runCommand({ serverStatus: 1 })"

- name: "Installing php"
uses: "shivammathur/setup-php@v2"
with:
php-version: ${{ matrix.php }}
extensions: "curl,mbstring,xdebug"
coverage: "xdebug"
tools: "composer"
- name: Installing php
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: curl,mbstring,xdebug
coverage: xdebug
tools: composer

- name: "Show Docker version"
if: ${{ runner.debug }}
run: "docker version && env"
- name: Show Docker version
if: '${{ runner.debug }}'
run: docker version && env

- name: "Restrict Laravel version"
run: "composer require --dev --no-update 'laravel/framework:${{ matrix.laravel }}'"
- name: Restrict Laravel version
run: composer require --dev --no-update 'laravel/framework:${{ matrix.laravel }}'

- name: "Download Composer cache dependencies from cache"
id: "composer-cache"
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Download Composer cache dependencies from cache
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: "Cache Composer dependencies"
uses: "actions/cache@v4"
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: "${{ matrix.os }}-composer-${{ hashFiles('**/composer.json') }}"
restore-keys: "${{ matrix.os }}-composer-"
- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ matrix.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ matrix.os }}-composer-

- name: "Install dependencies"
run: |
composer update --no-interaction
- name: Install dependencies
run: |
composer update --no-interaction

- name: "Run tests"
run: |
export MONGODB_URI="mongodb://127.0.0.1:27017/?directConnection=true"
./vendor/bin/phpunit --coverage-clover coverage.xml --group atlas-search
- name: Run tests
run: |
export MONGODB_URI="mongodb://127.0.0.1:27017/?directConnection=true"
./vendor/bin/phpunit --coverage-clover coverage.xml --group atlas-search
153 changes: 72 additions & 81 deletions .github/workflows/build-ci.yml
Original file line number Diff line number Diff line change
@@ -1,97 +1,88 @@
name: "CI"
name: CI

on:
push:
pull_request:
push:
pull_request:

jobs:
build:
runs-on: "${{ matrix.os }}"
build:
runs-on: ${{ matrix.os }}

name: "PHP ${{ matrix.php }} Laravel ${{ matrix.laravel }} MongoDB ${{ matrix.mongodb }} ${{ matrix.mode }}"
name: PHP ${{ matrix.php }} Laravel ${{ matrix.laravel }} MongoDB ${{ matrix.mongodb }} ${{ matrix.mode }}

strategy:
matrix:
os:
- "ubuntu-latest"
mongodb:
- "4.4"
- "5.0"
- "6.0"
- "7.0"
- "8.0"
php:
- "8.1"
- "8.2"
- "8.3"
- "8.4"
laravel:
- "10.*"
- "11.*"
include:
- php: "8.1"
laravel: "10.*"
mongodb: "5.0"
mode: "low-deps"
os: "ubuntu-latest"
- php: "8.4"
laravel: "11.*"
mongodb: "7.0"
os: "ubuntu-latest"
exclude:
- php: "8.1"
laravel: "11.*"
strategy:
matrix:
os: [ubuntu-latest]
mongodb: ['4.4', '5.0', '6.0', '7.0', '8.0']
php: ['8.1', '8.2', '8.3', '8.4']
laravel: ['10.*', '11.*', '12.*']
include:
- php: '8.1'
laravel: 10.*
mongodb: '5.0'
mode: low-deps
os: ubuntu-latest
- php: '8.4'
laravel: 11.*
mongodb: '7.0'
os: ubuntu-latest
exclude:
- php: '8.1'
laravel: 11.*
- laravel: 12.*
php: '8.1'

steps:
- uses: "actions/checkout@v4"
steps:
- uses: actions/checkout@v4

- name: "Create MongoDB Replica Set"
run: |
docker run --name mongodb -p 27017:27017 -e MONGO_INITDB_DATABASE=unittest --detach mongo:${{ matrix.mongodb }} mongod --replSet rs --setParameter transactionLifetimeLimitSeconds=5
- name: Create MongoDB Replica Set
run: |
docker run --name mongodb -p 27017:27017 -e MONGO_INITDB_DATABASE=unittest --detach mongo:${{ matrix.mongodb }} mongod --replSet rs --setParameter transactionLifetimeLimitSeconds=5

if [ "${{ matrix.mongodb }}" = "4.4" ]; then MONGOSH_BIN="mongo"; else MONGOSH_BIN="mongosh"; fi
until docker exec --tty mongodb $MONGOSH_BIN --eval "db.runCommand({ ping: 1 })"; do
sleep 1
done
sudo docker exec --tty mongodb $MONGOSH_BIN --eval "rs.initiate({\"_id\":\"rs\",\"members\":[{\"_id\":0,\"host\":\"127.0.0.1:27017\" }]})"
if [ "${{ matrix.mongodb }}" = "4.4" ]; then MONGOSH_BIN="mongo"; else MONGOSH_BIN="mongosh"; fi
until docker exec --tty mongodb $MONGOSH_BIN --eval "db.runCommand({ ping: 1 })"; do
sleep 1
done
sudo docker exec --tty mongodb $MONGOSH_BIN --eval "rs.initiate({\"_id\":\"rs\",\"members\":[{\"_id\":0,\"host\":\"127.0.0.1:27017\" }]})"

- name: "Show MongoDB server status"
run: |
if [ "${{ matrix.mongodb }}" = "4.4" ]; then MONGOSH_BIN="mongo"; else MONGOSH_BIN="mongosh"; fi
docker exec --tty mongodb $MONGOSH_BIN --eval "db.runCommand({ serverStatus: 1 })"
- name: Show MongoDB server status
run: |
if [ "${{ matrix.mongodb }}" = "4.4" ]; then MONGOSH_BIN="mongo"; else MONGOSH_BIN="mongosh"; fi
docker exec --tty mongodb $MONGOSH_BIN --eval "db.runCommand({ serverStatus: 1 })"

- name: "Installing php"
uses: "shivammathur/setup-php@v2"
with:
php-version: ${{ matrix.php }}
extensions: "curl,mbstring,xdebug"
coverage: "xdebug"
tools: "composer"
- name: Installing php
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: curl,mbstring,xdebug
coverage: xdebug
tools: composer

- name: "Show Docker version"
if: ${{ runner.debug }}
run: "docker version && env"
- name: Show Docker version
if: '${{ runner.debug }}'
run: docker version && env

- name: "Restrict Laravel version"
run: "composer require --dev --no-update 'laravel/framework:${{ matrix.laravel }}'"
- name: Restrict Laravel version
run: composer require --dev --no-update 'laravel/framework:${{ matrix.laravel }}'

- name: "Download Composer cache dependencies from cache"
id: "composer-cache"
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Download Composer cache dependencies from cache
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: "Cache Composer dependencies"
uses: "actions/cache@v4"
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: "${{ matrix.os }}-composer-${{ hashFiles('**/composer.json') }}"
restore-keys: "${{ matrix.os }}-composer-"
- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ matrix.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ matrix.os }}-composer-

- name: "Install dependencies"
run: |
composer update --no-interaction \
$([[ "${{ matrix.mode }}" == low-deps ]] && echo ' --prefer-lowest') \
$([[ "${{ matrix.mode }}" == ignore-php-req ]] && echo ' --ignore-platform-req=php+')
- name: "Run tests"
run: |
export MONGODB_URI="mongodb://127.0.0.1:27017/?replicaSet=rs"
./vendor/bin/phpunit --coverage-clover coverage.xml --exclude-group atlas-search
- name: Install dependencies
run: |
composer update --no-interaction \
$([[ "${{ matrix.mode }}" == low-deps ]] && echo ' --prefer-lowest') \
$([[ "${{ matrix.mode }}" == ignore-php-req ]] && echo ' --ignore-platform-req=php+')

- name: Run tests
run: |
export MONGODB_URI="mongodb://127.0.0.1:27017/?replicaSet=rs"
./vendor/bin/phpunit --coverage-clover coverage.xml --exclude-group atlas-search
36 changes: 18 additions & 18 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
name: "Static Analysis"
name: Static Analysis

on:
push:
pull_request:
workflow_call:
inputs:
ref:
description: "The git ref to check"
description: The git ref to check
type: string
required: true

env:
PHP_VERSION: "8.2"
DRIVER_VERSION: "stable"
PHP_VERSION: '8.2'
DRIVER_VERSION: stable

jobs:
phpstan:
runs-on: "ubuntu-22.04"
runs-on: ubuntu-22.04

continue-on-error: true

strategy:
matrix:
php:
- '8.1'
- '8.2'
- '8.3'
php: ['8.1', '8.2', '8.3']

steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.ref || github.ref }}

- name: "Get SHA hash of checked out ref"
if: ${{ github.event_name == 'workflow_dispatch' }}
- name: Get SHA hash of checked out ref
if: "${{ github.event_name == 'workflow_dispatch' }}"
run: |
echo CHECKED_OUT_SHA=$(git rev-parse HEAD) >> $GITHUB_ENV

Expand All @@ -58,23 +58,23 @@ jobs:
uses: actions/cache/restore@v4
with:
path: .cache
key: "phpstan-result-cache-${{ matrix.php }}-${{ github.run_id }}"
key: phpstan-result-cache-${{ matrix.php }}-${{ github.run_id }}
restore-keys: |
phpstan-result-cache-

- name: Run PHPStan
run: ./vendor/bin/phpstan analyse --no-interaction --no-progress --ansi --error-format=sarif > phpstan.sarif
continue-on-error: true

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

- name: "Upload SARIF report"
if: ${{ github.event_name == 'workflow_dispatch' }}
uses: "github/codeql-action/upload-sarif@v3"
- name: Upload SARIF report
if: "${{ github.event_name == 'workflow_dispatch' }}"
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: phpstan.sarif
ref: ${{ inputs.ref }}
Expand Down
Loading
Loading