Skip to content

chore: Add lint, test & related workflow #8

chore: Add lint, test & related workflow

chore: Add lint, test & related workflow #8

Workflow file for this run

name: Checks
on:
push:
branches:
- main
- 'feature/*'
pull_request:
branches:
- main
jobs:
lint:
name: Lint with Pint
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
tools: composer
- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest --no-interaction
- name: Run Pint
run: vendor/bin/pint
test:
name: Run Tests
runs-on: ubuntu-latest
services:
mysql:
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: secret
MYSQL_DATABASE: trakli
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping --silent"
--health-interval=10s
--health-timeout=5s
--health-retries=3
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
tools: composer
- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest --no-interaction
- name: Copy .env file
run: cp .env.example .env
- name: Update .env file
run: |
echo "DB_CONNECTION=mysql" >> .env
echo "DB_HOST=mysql" >> .env
echo "DB_PORT=33306" >> .env
echo "DB_DATABASE=trakli" >> .env
echo "DB_USERNAME=root" >> .env
echo "DB_PASSWORD=secret" >> .env
echo "APP_ENV=testing" >> .env
- name: Generate application key
run: php artisan key:generate
- name: Configure database
run: |
php artisan config:clear
php artisan config:cache
- name: Run migrations
run: php artisan migrate --seed
- name: Run tests
run: php artisan test