This repository has been archived by the owner on Aug 4, 2023. It is now read-only.
Register laravel fortify service provider in config/app.php #15
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: API | |
on: [push, pull_request] | |
jobs: | |
laravel: | |
name: pipeline (PHP ${{ matrix.php-versions }}) | |
runs-on: ubuntu-latest | |
services: | |
mysql: | |
image: mysql:5.7 | |
env: | |
MYSQL_ROOT_PASSWORD: 'secret' | |
MYSQL_DATABASE: 'users_api' | |
MYSQL_USER: 'user' | |
MYSQL_PASSWORD: 'secret' | |
ports: | |
- 3306/tcp | |
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | |
redis: | |
image: redis | |
options: >- | |
--health-cmd "redis-cli ping" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 6379:6379 | |
strategy: | |
fail-fast: false | |
matrix: | |
php-versions: ['8.2'] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup PHP, with composer and extensions | |
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php | |
with: | |
php-version: ${{ matrix.php-versions }} | |
extensions: mbstring, dom, fileinfo, mysql | |
coverage: none | |
- name: Start mysql service | |
run: sudo /etc/init.d/mysql start | |
- name: Get composer cache directory | |
id: composercache | |
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | |
- name: Cache composer dependencies | |
uses: actions/cache@v2 | |
with: | |
path: ${{ steps.composercache.outputs.dir }} | |
# Use composer.json for key, if composer.lock is not committed. | |
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
restore-keys: ${{ runner.os }}-composer- | |
- name: Install Composer dependencies | |
run: composer install -q --no-progress --prefer-dist --optimize-autoloader | |
- name: Prepare Environment | |
run: | | |
sed -i "s/3306/${{ job.services.mysql.ports['3306'] }}/g" .env.testing | |
sed -i "s/DB_PASSWORD=/DB_PASSWORD=secret/g" .env.testing | |
cp .env.testing .env | |
- name: Clear config cache | |
run: php artisan config:clear | |
- name: Generate key | |
run: php artisan key:generate -q -n | |
- name: Migrate & Seed Database | |
run: php artisan migrate --seed --force | |
- name: Change Directory Permissions | |
run: chmod -R 777 storage bootstrap/cache | |
- name: Install javascript packages | |
run: npm install --quiet --no-progress | |
- name: Build javascript packages | |
run: npm run build | |
- name: Run Laravel Server | |
run: php artisan serve --no-reload & | |
- name: curl to localhost | |
run: curl localhost:8000 & | |
- name: Run Unit Tests | |
run: php artisan test --testsuite=Unit --stop-on-failure | |
- name: Run Feature Tests | |
run: php artisan test --testsuite=Feature --stop-on-failure |