EscolaLMS/Mattermost

View on GitHub
.github/workflows/test.yml

Summary

Maintainability
Test Coverage
name: Tests PHPUnit in environments

on:
  # Trigger the workflow on push or pull request,
  # but only for the main branch
  push:
    branches:
      - main
      - master
  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
        run: apt-get install git -y

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

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

      - name: Update composer
        run: composer update

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

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

      - name: Generate keys
        run: |
          vendor/bin/testbench passport:keys --force
          vendor/bin/testbench passport:client --personal --no-interaction

      - 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 update

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

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

      - name: Generate keys
        run: |
          vendor/bin/testbench passport:keys --force
          vendor/bin/testbench passport:client --personal --no-interaction

      - 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 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: Generate keys
        run: |
          vendor/bin/testbench passport:keys --force
          vendor/bin/testbench passport:client --personal --no-interaction

      - 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: Generate keys
        run: |
          vendor/bin/testbench passport:keys --force
          vendor/bin/testbench passport:client --personal --no-interaction

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