App Tests #785
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
name: App Tests | |
on: | |
push: | |
branches: | |
- master | |
- '*.x' | |
pull_request: | |
schedule: | |
- cron: '0 0 * * *' | |
jobs: | |
tests: | |
runs-on: ubuntu-22.04 | |
strategy: | |
fail-fast: true | |
matrix: | |
php: [ 8.1, 8.2 ] | |
laravel: [ 9, 10 ] | |
stability: [ 'prefer-lowest', 'prefer-stable' ] | |
variants: [ | |
'', | |
'--kind username-based' | |
] | |
name: PHP ${{ matrix.php }} L${{ matrix.laravel }} ${{ matrix.variants }} (w/ ${{ matrix.stability }}) | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
path: ./monorepo | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
extensions: dom, curl, libxml, mbstring, zip | |
ini-values: error_reporting=E_ALL | |
tools: composer:v2 | |
coverage: none | |
- name: Create Laravel Project | |
uses: nick-fields/retry@v2 | |
with: | |
timeout_minutes: 5 | |
max_attempts: 5 | |
command: composer create-project laravel/laravel app "${{ matrix.laravel }}.x" --remove-vcs --prefer-dist --no-interaction | |
- name: Downgrade Laravel dependencies to lowest supported versions | |
run: composer update --prefer-lowest --prefer-dist --no-interaction | |
working-directory: ./app | |
if: matrix.stability == 'prefer-lowest' | |
- name: Set Laravel Environment | |
run: | | |
sed -i "s/APP_DEBUG=.*/APP_DEBUG=true/" .env | |
sed -i "s/DB_PASSWORD=.*/DB_PASSWORD=secret/" .env | |
working-directory: ./app | |
- name: Relax dependency constraint for claudiodekker/laravel-auth-core | |
run: | | |
sed -i "s/\"claudiodekker\/laravel-auth-core\": \".*\"/\"claudiodekker\/laravel-auth-core\": \"\*\"/" composer.json | |
working-directory: ./monorepo/packages/bladebones | |
- name: Install Library & Bladebones Adapter | |
run: | | |
composer config minimum-stability dev | |
composer config repositories.library path ../monorepo/packages/core | |
composer config repositories.adapter path ../monorepo/packages/bladebones | |
composer require claudiodekker/laravel-auth-core claudiodekker/laravel-auth-bladebones -W --${{ matrix.stability }} | |
working-directory: ./app | |
- name: Generate Auth Scaffolding | |
run: php artisan auth:generate --yes ${{ matrix.variants }} | |
working-directory: ./app | |
- name: Migrate Database | |
run: php artisan migrate | |
working-directory: ./app | |
- name: Execute tests | |
run: vendor/bin/phpunit | |
working-directory: ./app | |
services: | |
mysql: | |
image: 'mysql:5.7' | |
ports: | |
- 3306:3306 | |
env: | |
MYSQL_DATABASE: laravel | |
MYSQL_ROOT_PASSWORD: secret |