diff --git a/.github/workflows/build-ci-atlas.yml b/.github/workflows/build-ci-atlas.yml index 7a4ebd03f..1c658f811 100644 --- a/.github/workflows/build-ci-atlas.yml +++ b/.github/workflows/build-ci-atlas.yml @@ -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 diff --git a/.github/workflows/build-ci.yml b/.github/workflows/build-ci.yml index d16a5885f..95921c0c7 100644 --- a/.github/workflows/build-ci.yml +++ b/.github/workflows/build-ci.yml @@ -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 diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index a66100d93..02073c773 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -1,4 +1,4 @@ -name: "Static Analysis" +name: Static Analysis on: push: @@ -6,32 +6,32 @@ on: 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 @@ -58,7 +58,7 @@ 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- @@ -66,15 +66,15 @@ jobs: 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 }} diff --git a/composer.json b/composer.json index 82c980859..5335be5a0 100644 --- a/composer.json +++ b/composer.json @@ -15,21 +15,37 @@ "security": "https://www.mongodb.com/security" }, "authors": [ - { "name": "Andreas Braun", "email": "andreas.braun@mongodb.com", "role": "Leader" }, - { "name": "Jérôme Tamarelle", "email": "jerome.tamarelle@mongodb.com", "role": "Maintainer" }, - { "name": "Jeremy Mikola", "email": "jmikola@gmail.com", "role": "Maintainer" }, - { "name": "Jens Segers", "homepage": "https://jenssegers.com", "role": "Creator" } + { + "name": "Andreas Braun", + "email": "andreas.braun@mongodb.com", + "role": "Leader" + }, + { + "name": "Jérôme Tamarelle", + "email": "jerome.tamarelle@mongodb.com", + "role": "Maintainer" + }, + { + "name": "Jeremy Mikola", + "email": "jmikola@gmail.com", + "role": "Maintainer" + }, + { + "name": "Jens Segers", + "homepage": "https://jenssegers.com", + "role": "Creator" + } ], "license": "MIT", "require": { "php": "^8.1", "ext-mongodb": "^1.15", "composer-runtime-api": "^2.0.0", - "illuminate/cache": "^10.36|^11", - "illuminate/container": "^10.0|^11", - "illuminate/database": "^10.30|^11", - "illuminate/events": "^10.0|^11", - "illuminate/support": "^10.0|^11", + "illuminate/cache": "^10.36|^11|^12.0", + "illuminate/container": "^10.0|^11|^12.0", + "illuminate/database": "^10.30|^11|^12.0", + "illuminate/events": "^10.0|^11|^12.0", + "illuminate/support": "^10.0|^11|^12.0", "mongodb/mongodb": "^1.18", "symfony/http-foundation": "^6.4|^7" }, @@ -38,13 +54,13 @@ "laravel/scout": "^10.3", "league/flysystem-gridfs": "^3.28", "league/flysystem-read-only": "^3.0", - "phpunit/phpunit": "^10.3", - "orchestra/testbench": "^8.0|^9.0", + "phpunit/phpunit": "^10.3|^11.5.3", + "orchestra/testbench": "^8.0|^9.0|^10.0", "mockery/mockery": "^1.4.4@stable", "doctrine/coding-standard": "12.0.x-dev", "spatie/laravel-query-builder": "^5.6", - "phpstan/phpstan": "^1.10", - "rector/rector": "^1.2" + "phpstan/phpstan": "^1.10|^2.1", + "rector/rector": "^1.2|^2.0" }, "conflict": { "illuminate/bus": "< 10.37.2"