Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
rowasc committed Apr 24, 2020
2 parents ee5d9f7 + 985f24d commit 3b92d34
Showing 1 changed file with 85 additions and 0 deletions.
85 changes: 85 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Test

on:
- push
- pull_request

env:
MYSQL_ROOT_PASSWORD: root

jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 15

strategy:
matrix:
php_version:
- 7.2
- 7.3

steps:
- uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@master
with:
php-version: ${{ matrix.php_version }}

- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Setup environment
run: |
set -e;
cp .env.testing .env ;
. .env ;
. docker/common.sh ;
wait_for_mysql ;
cat > $HOME/.my.cnf <<EOF
[client]
host=${DB_HOST}
port=${DB_PORT}
database=mysql
user=root
password=${MYSQL_ROOT_PASSWORD}
EOF
mysql -e "SELECT version();" ;
mysql -e "SET GLOBAL sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'" ;
composer install --no-interaction ;
- name: Run tests
run: |
set -e;
composer pre-test;
mysql -e 'SET @@GLOBAL.wait_timeout=1800';
( cd httpdocs/; php -S localhost:8000 -t . index.php &)
composer test ;
services:
mysql:
image: mysql:5.7
env:
MYSQL_DATABASE: ushahidi
MYSQL_USER: ushahidi
MYSQL_PASSWORD: ushahidi
MYSQL_ROOT_PASSWORD: ${{ env.MYSQL_ROOT_PASSWORD }}
ports:
- 3306:3306
options: --health-cmd "mysqladmin ping -h localhost"
--health-interval 10s --health-timeout 5s
--health-retries 60

0 comments on commit 3b92d34

Please sign in to comment.