-
-
Notifications
You must be signed in to change notification settings - Fork 520
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update GitHub Actions for Laravel 11
- Loading branch information
1 parent
e29f1eb
commit 2be9727
Showing
3 changed files
with
64 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,77 +1,75 @@ | ||
name: MySQL Tests | ||
|
||
on: [push, pull_request] | ||
on: | ||
- push | ||
- pull_request | ||
|
||
jobs: | ||
laravel-tests: | ||
runs-on: ubuntu-latest | ||
# Service container Mysql mysql | ||
|
||
services: | ||
# Label used to access the service container | ||
mysql: | ||
# Docker Hub image (also with version) | ||
image: mysql:8.0 | ||
env: | ||
MYSQL_ALLOW_EMPTY_PASSWORD: yes | ||
MYSQL_DATABASE: db_test_laravel | ||
## map the "external" 33306 port with the "internal" 3306 | ||
MYSQL_DATABASE: db_test_laravel | ||
ports: | ||
- 33306:3306 | ||
# Set health checks to wait until mysql database has started (it takes some seconds to start) | ||
options: >- | ||
--health-cmd="mysqladmin ping" | ||
--health-interval=10s | ||
--health-timeout=5s | ||
--health-retries=3 | ||
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
operating-system: [ubuntu-latest] | ||
php-versions: [ '8.3', '8.2', '8.1' ] | ||
dependency-stability: [ prefer-stable ] | ||
|
||
laravel: [ '10.*', '9.*' ] | ||
php-versions: ['8.3', '8.2', '8.1'] | ||
dependency-stability: [prefer-stable] | ||
laravel: ['9.*', '10.*', '11.*'] | ||
include: | ||
- laravel: 10.* | ||
testbench: 8.* | ||
- laravel: 9.* | ||
- laravel: 9.* | ||
testbench: 7.* | ||
- laravel: 11.* | ||
testbench: 9.* | ||
exclude: | ||
- laravel: 10.* | ||
php-versions: 8.0 | ||
- laravel: 11.* | ||
php-versions: '8.1' | ||
|
||
name: P${{ matrix.php-versions }} - L${{ matrix.laravel }} - ${{ matrix.dependency-stability }} - ${{ matrix.operating-system}} | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Install PHP versions | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php-versions }} | ||
|
||
- name: Get Composer Cache Directory 2 | ||
id: composer-cache | ||
run: | | ||
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | ||
- uses: actions/cache@v3 | ||
id: actions-cache | ||
with: | ||
path: ${{ steps.composer-cache.outputs.dir }} | ||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-composer- | ||
- name: Install Laravel Dependencies | ||
run: | | ||
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update | ||
composer update --${{ matrix.dependency-stability }} --prefer-dist --no-interaction --no-suggest | ||
# Code quality | ||
- name: Execute tests (Unit and Feature tests) via PHPUnit | ||
# Set environment | ||
env: | ||
DB_CONNECTION: mysql | ||
DB_DATABASE: db_test_laravel | ||
DB_PORT: 33306 | ||
DB_USERNAME: root | ||
|
||
run: vendor/bin/phpunit --testdox |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,91 +1,90 @@ | ||
name: PostgreSQL Tests | ||
name: PostgreSQL Tests | ||
|
||
on: [push, pull_request] | ||
on: | ||
- push | ||
- pull_request | ||
|
||
jobs: | ||
laravel-tests: | ||
runs-on: ubuntu-latest | ||
# Service container Postgresql postgresql | ||
|
||
services: | ||
# Label used to access the service container | ||
postgres: | ||
# Docker Hub image (also with version) | ||
image: postgres:latest | ||
env: | ||
POSTGRES_USER: postgres | ||
POSTGRES_PASSWORD: postgres | ||
POSTGRES_DB: db_test_laravel | ||
## map the "external" 55432 port with the "internal" 5432 | ||
POSTGRES_DB: db_test_laravel | ||
ports: | ||
- 55432:5432 | ||
# Set health checks to wait until postgresql database has started (it takes some seconds to start) | ||
options: >- | ||
--health-cmd pg_isready | ||
--health-interval 10s | ||
--health-timeout 5s | ||
--health-retries 5 | ||
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
operating-system: [ubuntu-latest] | ||
php-versions: [ '8.3', '8.2', '8.1' ] | ||
dependency-stability: [ prefer-stable ] | ||
|
||
laravel: [ '10.*', '9.*'] | ||
php-versions: ['8.3', '8.2', '8.1'] | ||
dependency-stability: [prefer-stable] | ||
laravel: ['9.*', '10.*', '11.*'] | ||
include: | ||
- laravel: 10.* | ||
testbench: 8.* | ||
- laravel: 9.* | ||
- laravel: 9.* | ||
testbench: 7.* | ||
- laravel: 11.* | ||
testbench: 9.* | ||
exclude: | ||
- laravel: 10.* | ||
php-versions: 8.0 | ||
- laravel: 11.* | ||
php-versions: '8.1' | ||
|
||
name: P${{ matrix.php-versions }} - L${{ matrix.laravel }} - ${{ matrix.dependency-stability }} - ${{ matrix.operating-system}} | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Install PHP versions | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php-versions }} | ||
|
||
- name: Get Composer Cache Directory 2 | ||
id: composer-cache | ||
run: | | ||
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | ||
- uses: actions/cache@v3 | ||
id: actions-cache | ||
with: | ||
path: ${{ steps.composer-cache.outputs.dir }} | ||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-composer- | ||
- name: Cache PHP dependencies | ||
uses: actions/cache@v3 | ||
id: vendor-cache | ||
with: | ||
path: vendor | ||
key: ${{ runner.OS }}-build-${{ hashFiles('**/composer.lock') }} | ||
|
||
- name: Install Laravel Dependencies | ||
run: | | ||
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update | ||
composer update --${{ matrix.dependency-stability }} --prefer-dist --no-interaction --no-suggest | ||
- name: Show dir | ||
run: pwd | ||
|
||
- name: PHP Version | ||
run: php --version | ||
|
||
# Code quality | ||
- name: Execute tests (Unit and Feature tests) via PHPUnit | ||
# Set environment | ||
env: | ||
DB_CONNECTION: pgsql | ||
DB_DATABASE: db_test_laravel | ||
DB_PORT: 55432 | ||
DB_USERNAME: postgres | ||
DB_PASSWORD: postgres | ||
|
||
run: vendor/bin/phpunit --testdox |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters