Skip to content

Commit

Permalink
Merge pull request #2926 from briannesbitt/feature/laravel-11-tests
Browse files Browse the repository at this point in the history
Enable Laravel 11 check
  • Loading branch information
kylekatarnls authored Jan 26, 2024
2 parents afebc38 + 4f7b5c5 commit 8cde64b
Show file tree
Hide file tree
Showing 10 changed files with 158 additions and 291 deletions.
90 changes: 90 additions & 0 deletions .github/workflows/laravel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: Laravel

on: [ pull_request, push ]

jobs:
ubuntu:
runs-on: ubuntu-latest

services:
memcached:
image: memcached:1.6-alpine
ports:
- 11211:11211
mysql:
image: mysql:5.7
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: forge
ports:
- 33306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
redis:
image: redis:7.0
ports:
- 6379:6379
options: --entrypoint redis-server
dynamodb:
image: amazon/dynamodb-local:2.0.0
ports:
- 8888:8000

strategy:
fail-fast: false
matrix:
php: ['8.2', '8.3']
reference: [master]

name: ${{ matrix.reference }} - PHP ${{ matrix.php }}

steps:
- name: Checkout the code
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, gd, redis-phpredis/[email protected], igbinary, msgpack, lzf, zstd, lz4, memcached, gmp, :php-psr
ini-values: error_reporting=E_ALL
tools: composer:v2
coverage: none
env:
REDIS_CONFIGURE_OPTS: --enable-redis --enable-redis-igbinary --enable-redis-msgpack --enable-redis-lzf --with-liblzf --enable-redis-zstd --with-libzstd --enable-redis-lz4 --with-liblz4
REDIS_LIBS: liblz4-dev, liblzf-dev, libzstd-dev

- name: Install locales
run: |
sudo apt-get update || apt --fix-broken install || echo 'Apt failure ignored'
sudo apt-get install tzdata locales -y && sudo locale-gen fr_FR.UTF-8 sr_ME.UTF-8 ar_AE.UTF-8 zh_TW.UTF-8 zh_CN.UTF-8 yo_NG.UTF-8 en_US.UTF-8 || echo 'Apt failure ignored'
- name: Get composer cache directory
id: composer-cache-ubuntu
run: echo "dir=$(composer config cache-files-dir)" > $GITHUB_OUTPUT

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

- name: Install dependencies
uses: nick-fields/retry@v2
if: steps.composer-cache.outputs.cache-hit != 'true'
with:
timeout_minutes: 10
max_attempts: 3
command: |
composer remove --no-update phpmd/phpmd friendsofphp/php-cs-fixer --no-interaction --dev;
composer update --prefer-dist --no-progress --prefer-stable;
- name: Execute tests
run: vendor/bin/multi-tester tests/Laravel/laravel-${{ matrix.reference }}.multi-tester.yml
env:
DB_PORT: ${{ job.services.mysql.ports[3306] }}
DB_USERNAME: root
DYNAMODB_CACHE_TABLE: laravel_dynamodb_test
DYNAMODB_ENDPOINT: "http://localhost:8888"
AWS_ACCESS_KEY_ID: randomKey
AWS_SECRET_ACCESS_KEY: randomSecret
73 changes: 5 additions & 68 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,6 @@ jobs:
ubuntu:
runs-on: ubuntu-latest

services:
memcached:
image: memcached:1.6-alpine
ports:
- 11211:11211
mysql:
image: mysql:5.7
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: forge
ports:
- 33306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
redis:
image: redis:5.0
ports:
- 6379:6379
options: --entrypoint redis-server
dynamodb:
image: amazon/dynamodb-local:latest
ports:
- 8888:8000

strategy:
fail-fast: false
matrix:
Expand All @@ -48,28 +25,10 @@ jobs:
- php: 8.3
setup: lowest

- php: 8.1
laravel: true
reference: 10.x

- php: 8.1
laravel: true
reference: 10.x
classmap-authoritative: true

- php: 8.2
laravel: true
reference: master

- php: 8.2
laravel: true
reference: master
classmap-authoritative: true

- php: 8.2
coverage: true

name: ${{ matrix.laravel && 'Laravel compatibility - ' || '' }}${{ matrix.classmap-authoritative && 'classmap-authoritative - ' || '' }}${{ matrix.coverage && 'Coverage - ' || '' }}PHP ${{ matrix.php }} - ${{ matrix.setup || 'stable' }} - ubuntu
name: ${{ matrix.classmap-authoritative && 'classmap-authoritative - ' || '' }}${{ matrix.coverage && 'Coverage - ' || '' }}PHP ${{ matrix.php }} - ${{ matrix.setup || 'stable' }} - ubuntu

steps:
- name: Checkout the code
Expand All @@ -79,27 +38,16 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: json, msgpack${{ matrix.laravel && ', dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, gd, redis-phpredis/[email protected], igbinary, msgpack, lzf, zstd, lz4, memcached, gmp' || '' }}
extensions: json, msgpack
ini-values: error_reporting=${{ (matrix.setup != 'lowest') && '32767' || '8191' }}
tools: composer:v2
coverage: ${{ matrix.coverage && 'pcov' || 'none' }}
env:
REDIS_CONFIGURE_OPTS: --enable-redis --enable-redis-igbinary --enable-redis-msgpack --enable-redis-lzf --with-liblzf --enable-redis-zstd --with-libzstd --enable-redis-lz4 --with-liblz4
REDIS_LIBS: liblz4-dev, liblzf-dev, libzstd-dev

- name: Install locales
run: |
sudo apt-get update || apt --fix-broken install || echo 'Apt failure ignored'
sudo apt-get install tzdata locales -y && sudo locale-gen fr_FR.UTF-8 sr_ME.UTF-8 ar_AE.UTF-8 zh_TW.UTF-8 zh_CN.UTF-8 yo_NG.UTF-8 en_US.UTF-8 || echo 'Apt failure ignored'
- name: Set Minimum PHP 8.1 Versions
uses: nick-invision/retry@v2
with:
timeout_minutes: 5
max_attempts: 5
command: composer require ramsey/collection:^1.2 brick/math:^0.9.3 --no-interaction --no-update
if: matrix.laravel

- name: Get composer cache directory
id: composer-cache-ubuntu
run: echo "dir=$(composer config cache-files-dir)" > $GITHUB_OUTPUT
Expand All @@ -118,30 +66,19 @@ jobs:
timeout_minutes: 10
max_attempts: 3
command: |
composer remove --no-update phpmd/phpmd friendsofphp/php-cs-fixer --no-interaction --dev;
if [[ "${{ matrix.laravel }}" != 'true' ]]; then
composer remove --no-update kylekatarnls/multi-tester --no-interaction --dev;
fi;
composer remove --no-update phpmd/phpmd friendsofphp/php-cs-fixer kylekatarnls/multi-tester --no-interaction --dev;
composer update --prefer-dist --no-progress --prefer-${{ matrix.setup || 'stable' }} ${{ matrix.classmap-authoritative && '--classmap-authoritative' || '' }}${{ matrix.php >= 8.2 && ' --ignore-platform-reqs' || '' }};
- name: Run test suite
continue-on-error: ${{ matrix.laravel || false }}
run: |
if [[ "${{ matrix.laravel }}" != 'true' && "${{ matrix.coverage }}" = 'true' ]]; then
if [[ "${{ matrix.coverage }}" = 'true' ]]; then
php -d memory_limit=-1 -d zend.enable_gc=0 -d error_reporting=-1 vendor/phpunit/phpunit/phpunit --coverage-clover=clover.xml --coverage-text;
fi;
if [[ "${{ matrix.laravel }}" != 'true' && "${{ matrix.coverage }}" != 'true' ]]; then
if [[ "${{ matrix.coverage }}" != 'true' ]]; then
php -d memory_limit=-1 -d zend.enable_gc=0 -d error_reporting=-1 vendor/phpunit/phpunit/phpunit;
fi;
if [[ "${{ matrix.laravel }}" = 'true' ]]; then
vendor/bin/multi-tester tests/Laravel/laravel-${{ matrix.reference }}.multi-tester.yml;
fi;
env:
PHP_VERSION: ${{ matrix.php }}
REDIS_HOST: 127.0.0.1
REDIS_PORT: 6379
DB_PORT: ${{ job.services.mysql.ports[3306] }}
DB_USERNAME: root

- name: Code Climate Test Reporter
if: matrix.coverage
Expand Down
Loading

0 comments on commit 8cde64b

Please sign in to comment.