Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Update GitHub Actions for Laravel 12
  • Loading branch information
laravel-shift committed Feb 16, 2025
commit 76804652f4fa6a5c904329d8ee53d8dca63586d8
59 changes: 27 additions & 32 deletions .github/workflows/build-ci-atlas.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,25 @@
name: "Atlas CI"
name: Atlas CI

on:
push:
pull_request:

jobs:
build:
runs-on: "${{ matrix.os }}"
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.*"
os: [ubuntu-latest]
php: ['8.2', '8.3', '8.4']
laravel: ['11.*', '12.*']

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

- name: "Create MongoDB Atlas Local"
- 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
Expand All @@ -34,41 +29,41 @@ jobs:
sleep 1
done

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

- name: "Installing php"
uses: "shivammathur/setup-php@v2"
- name: Installing php
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: "curl,mbstring,xdebug"
coverage: "xdebug"
tools: "composer"
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"
- 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"
- 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-"
key: ${{ matrix.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ matrix.os }}-composer-

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

- name: "Run tests"
- 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
93 changes: 42 additions & 51 deletions .github/workflows/build-ci.yml
Original file line number Diff line number Diff line change
@@ -1,51 +1,41 @@
name: "CI"
name: CI

on:
push:
pull_request:

jobs:
build:
runs-on: "${{ matrix.os }}"
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.*"
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"
- 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.*"
- php: '8.1'
laravel: 11.*
- laravel: 12.*
php: '8.1'

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

- name: "Create MongoDB Replica Set"
- 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

Expand All @@ -55,43 +45,44 @@ jobs:
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"
- 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"
- name: Installing php
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: "curl,mbstring,xdebug"
coverage: "xdebug"
tools: "composer"
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"
- 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"
- 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-"
key: ${{ matrix.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ matrix.os }}-composer-

- name: "Install dependencies"
- 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"

- 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