CyberRegister/CyberRegister

View on GitHub
.github/workflows/laravel.yml

Summary

Maintainability
Test Coverage
name: Laravel

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  laravel-tests:

    runs-on: ubuntu-latest

    services:
      mysql:
        image: mariadb:latest
        env:
          MYSQL_ROOT_PASSWORD: root
          MYSQL_DATABASE: laravel
        ports:
          - 33306:3306
        options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3

    steps:
      - uses: actions/checkout@v2
      - name: Copy .env
        run: php -r "file_exists('.env') || copy('.env.example', '.env');"
      - name: Install Prequisites
        run: sudo apt install php-imagick
      - name: Install Dependencies
        run: composer install
      - name: Generate key
        run: php artisan key:generate
      - name: Generate passport keys
        run: php artisan passport:keys
      - name: Directory Permissions
        run: chmod -R 777 storage bootstrap/cache
      - name: Create DB tables
        run: php artisan migrate --force
        env:
          DB_CONNECTION: mysql
          DB_HOST: 127.0.0.1
          DB_PORT: 33306
          DB_DATABASE: laravel
          DB_USERNAME: root
          DB_PASSWORD: root
      - name: Execute tests (Unit and Feature tests) via Pest
        run: vendor/bin/pest
        env:
          DB_CONNECTION: mysql
          DB_HOST: 127.0.0.1
          DB_PORT: 33306
          DB_DATABASE: laravel
          DB_USERNAME: root
          DB_PASSWORD: root
      - name: Static analysis via PHPStan
        run: vendor/bin/phpstan analyse