name: Tests

on: [push, pull_request]

jobs:
  build:
    runs-on: ubuntu-16.04
    services:

      mariadb:
        image: mariadb/server:10.0
        env:
          MARIADB_USER: opendominion
          MARIADB_PASSWORD: secret
          MARIADB_DATABASE: opendominion
        ports:
          - 3306
#        options: --health-cmd="mysqladmin ping --silent" --health-interval=10s --health-timeout=5s --health-retries=3

    steps:

    - uses: actions/checkout@v1

    - name: Install PHP dependencies
      run: composer install --no-interaction --prefer-dist

    - name: Setup .env file
      run: |
        cp .env.ci .env
        sed -i 's/DB_PORT=/DB_PORT=${{ job.services.mariadb.ports['3306'] }}/' .env
        php artisan key:generate

    - name: Run database migrations
      run: php artisan migrate

    - name: Seed database
      run: php artisan db:seed

    - name: Sync game data
      run: php artisan game:data:sync

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

name: Tests

on: [push, pull_request]

jobs:
  build:
    runs-on: ubuntu-16.04
    services:

      mariadb:
        image: mariadb:10.0
        env:
          MYSQL_USER: opendominion
          MYSQL_PASSWORD: secret
          MYSQL_DATABASE: opendominion
        ports:
          - 3306
#        options: --health-cmd="mysqladmin ping --silent" --health-interval=10s --health-timeout=5s --health-retries=3

    steps:

    - uses: actions/checkout@v1

    - name: Install PHP dependencies
      run: composer install --no-interaction --prefer-dist

    - name: Setup .env file
      run: |
        cp .env.ci .env
        sed -i 's/DB_PORT=/DB_PORT=${{ job.services.mariadb.ports['3306'] }}/' .env
        php artisan key:generate

    - name: Run database migrations
      run: php artisan migrate

    - name: Seed database
      run: php artisan db:seed

    - name: Sync game data
      run: php artisan game:data:sync

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

Revert changing service image and env vars
Revert changing service image and env vars
