Skip to content

Commit

Permalink
Merge pull request #6 from elvanto/gh-actions
Browse files Browse the repository at this point in the history
Add GitHub Actions test workflow
  • Loading branch information
bensinclair authored Nov 26, 2020
2 parents 33ff07e + 37a5110 commit 5947445
Show file tree
Hide file tree
Showing 14 changed files with 363 additions and 107 deletions.
136 changes: 136 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
name: Run Tests

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

jobs:
test_mysql57:

runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
matrix:
php-versions: [ '7.0', '7.1', '7.2', '7.3', '7.4' ]
name: PHP ${{ matrix.php-versions }} with MySQL 5.7 & Postgres 10

services:
mysql:
image: mysql:5.7
env:
MYSQL_USER: root
MYSQL_DATABASE: picodb
MYSQL_ROOT_PASSWORD: rootpassword
MYSQL_HOST: 127.0.0.1
ports:
[ '3306:3306' ]
options: --health-cmd "mysqladmin ping" --health-interval 10s --health-timeout 5s --health-retries 10

postgres:
image: postgres:10
env:
POSTGRES_USER: root
POSTGRES_PASSWORD: rootpassword
POSTGRES_DB: picodb
ports:
[ '5432:5432' ]
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v2
name: Check Out Code

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: pdo_mysql, pdo_pgsql, pdo_sqlite

- name: Validate composer.json and composer.lock
run: composer validate

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v2
with:
path: vendor
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Install dependencies
if: steps.composer-cache.outputs.cache-hit != 'true'
run: composer install --prefer-dist --no-progress --no-suggest

- name: Run test suite
run: ./vendor/bin/phpunit

test_mysql80:

runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
matrix:
php-versions: [ '7.4' ]
name: PHP ${{ matrix.php-versions }} with MySQL 8.0 & Postgres 11

services:
mysql:
image: mysql:8.0
env:
MYSQL_USER: root
MYSQL_DATABASE: picodb
MYSQL_ROOT_PASSWORD: rootpassword
MYSQL_HOST: 127.0.0.1
ports:
[ '3306:3306' ]
options: --health-cmd "mysqladmin ping" --health-interval 10s --health-timeout 5s --health-retries 10

postgres:
image: postgres:11
env:
POSTGRES_USER: root
POSTGRES_PASSWORD: rootpassword
POSTGRES_DB: picodb
ports:
[ '5432:5432' ]
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v2
name: Check Out Code

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: pdo_mysql, pdo_pgsql, pdo_sqlite

- name: Validate composer.json and composer.lock
run: composer validate

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v2
with:
path: vendor
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Install dependencies
if: steps.composer-cache.outputs.cache-hit != 'true'
run: composer install --prefer-dist --no-progress --no-suggest

- name: Run test suite
run: ./vendor/bin/phpunit
21 changes: 0 additions & 21 deletions .travis.yml

This file was deleted.

5 changes: 5 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
"homepage": "https://github.com/fguillot/"
}
],
"config": {
"platform": {
"php": "7.0"
}
},
"require": {
"php": ">=7.0"
},
Expand Down
Loading

0 comments on commit 5947445

Please sign in to comment.