CRM/.github/workflows/ci.yml

105 خطوط
2.7 KiB
YAML

name: CI
on:
push:
pull_request:
permissions:
contents: read
jobs:
backend:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- connection: sqlite
database: ':memory:'
host: 127.0.0.1
port: 0
username: root
password: ''
- connection: mysql
database: crm
host: 127.0.0.1
port: 3306
username: root
password: root
- connection: pgsql
database: crm
host: 127.0.0.1
port: 5432
username: postgres
password: postgres
services:
mysql:
image: mysql:8.4
env:
MYSQL_DATABASE: crm
MYSQL_ROOT_PASSWORD: root
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping -h 127.0.0.1 -proot"
--health-interval=10s
--health-timeout=5s
--health-retries=10
postgres:
image: postgres:17
env:
POSTGRES_DB: crm
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
options: >-
--health-cmd="pg_isready -U postgres -d crm"
--health-interval=10s
--health-timeout=5s
--health-retries=10
defaults:
run:
working-directory: backend
env:
APP_ENV: testing
APP_KEY: base64:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
DB_CONNECTION: ${{ matrix.connection }}
DB_DATABASE: ${{ matrix.database }}
DB_HOST: ${{ matrix.host }}
DB_PORT: ${{ matrix.port }}
DB_USERNAME: ${{ matrix.username }}
DB_PASSWORD: ${{ matrix.password }}
CACHE_STORE: array
QUEUE_CONNECTION: sync
SESSION_DRIVER: array
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
extensions: mbstring, pdo_sqlite, pdo_mysql, pdo_pgsql
coverage: none
- run: composer install --no-interaction --prefer-dist --no-progress
- run: php artisan migrate:fresh --seed --force
- run: php artisan test
frontend:
runs-on: ubuntu-latest
defaults:
run:
working-directory: frontend
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '22'
cache: npm
cache-dependency-path: frontend/package-lock.json
- run: npm ci
- run: npm run lint
- run: npm run test:run
- run: npm run build
- run: npx playwright install --with-deps chromium
- run: npm run test:e2e