EscolaLMS/Courses

View on GitHub
.github/workflows/test.yml

Summary

Maintainability
Test Coverage
name: Tests PHPUnit in environments

on: [pull_request]

jobs:
  php8-laravel-latest-phpunit-mysql:
    runs-on: ubuntu-latest
    container:
      image: escolalms/php:8

    services:
      mysql:
        image: mysql:5.7
        env:
          MYSQL_ROOT_PASSWORD: root
          MYSQL_DATABASE: database
          MYSQL_PASSWORD: password
          MYSQL_USER: username
        ports:
          - 33306:3306
        options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3

    steps:
      - name: Instantiate package
        uses: actions/checkout@v2

      - name: Setup environment
        run: cp env/mysql/* .

      - name: Update composer
        run: COMPOSER_ROOT_VERSION=0.9.9 composer update

      - name: Clear config
        run: vendor/bin/testbench config:clear

      - name: Publish things
        run: vendor/bin/testbench migrate:fresh

      - name: Run tests
        run: vendor/bin/phpunit

  php82-laravel-latest-phpunit-mysql:
    runs-on: ubuntu-latest
    container:
      image: escolalms/php:8.2

    services:
      mysql:
        image: mysql:5.7
        env:
          MYSQL_ROOT_PASSWORD: root
          MYSQL_DATABASE: database
          MYSQL_PASSWORD: password
          MYSQL_USER: username
        ports:
          - 33306:3306
        options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3

    steps:
      - name: Instantiate package
        uses: actions/checkout@v2

      - name: Setup environment
        run: cp env/mysql/* .

      - name: Update composer
        run: COMPOSER_ROOT_VERSION=0.9.9 composer update

      - name: Clear config
        run: vendor/bin/testbench config:clear

      - name: Publish things
        run: vendor/bin/testbench migrate:fresh

      - name: Run tests
        run: vendor/bin/phpunit

  php82-laravel-latest-phpunit-postgres:
    runs-on: ubuntu-latest
    container:
      image: escolalms/php:8.2

    services:
      postgres:
        image: postgres:12
        env:
          POSTGRES_USER: postgres
          POSTGRES_PASSWORD: postgres
          POSTGRES_DB: test
          TZ: Europe/Warsaw
        ports:
          - 5432:5432

    steps:
      - name: Instantiate package
        uses: actions/checkout@v2

      - name: Update composer
        run: COMPOSER_ROOT_VERSION=0.9.9 composer update

      - name: Setup environment
        run: cp env/postgres/* .

      - name: Clear config
        run: vendor/bin/testbench config:clear

      - name: Publish things
        run: vendor/bin/testbench migrate:fresh

      - name: Run tests
        run: vendor/bin/phpunit

  php81-laravel-latest-phpunit-postgres:
    runs-on: ubuntu-latest
    container:
      image: escolalms/php:8.1-work

    services:
      postgres:
        image: postgres:12
        env:
          POSTGRES_USER: postgres
          POSTGRES_PASSWORD: postgres
          POSTGRES_DB: test
          TZ: Europe/Warsaw
        ports:
          - 5432:5432

    steps:
      - name: Instantiate package
        uses: actions/checkout@v2

      - name: Update composer
        run: composer update

      - name: Setup environment
        run: cp env/postgres/* .

      - name: Clear config
        run: vendor/bin/testbench config:clear

      - name: Publish things
        run: vendor/bin/testbench migrate:fresh

      - name: Run tests
        run: vendor/bin/phpunit

### TODO add behat tests here