name: yii2-fractal
on:
push:
branches: [ master, dev ]
pull_request:
branches: [ master ]
paths-ignore:
- 'docs/**'
- '*.md'
jobs:
test:
if: "!contains(github.event.head_commit.message, 'skip ci') && !contains(github.event.head_commit.message, 'ci skip')"
name: yii2-fractal (PHP ${{ matrix.php-versions }})
runs-on: ubuntu-latest
env:
DB_USERNAME: dbuser
DB_PASSWORD: dbpass
TEST_DB_USERNAME: dbuser
TEST_DB_PASSWORD: dbpass
DB_CHARSET: utf8
services:
postgres:
image: postgres:12
env:
POSTGRES_USER: dbuser
POSTGRES_PASSWORD: dbpass
POSTGRES_DB: testdb
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3
strategy:
fail-fast: true
matrix:
php-versions: [ '7.1', '7.2', '7.3', '7.4']
steps:
- uses: actions/checkout@v2
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, intl, gd, imagick, zip, dom, pgsql
- name: Get composer cache directory
id: composercache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v2
with:
path: ${{ steps.composercache.outputs.dir }}
key: ${{ runner.os }}-php-${{ matrix.php-versions }}-${{ hashFiles('**/composer.json') }}
restore-keys: |
${{ runner.os }}-php-${{ matrix.php-versions }}
- name: Install deps
run: composer install --prefer-dist --no-progress --no-suggest --optimize-autoloader
- name: Prepare permissions
run: chmod -R 0777 tests/testapp/runtime
- name: Unit tests
run: php vendor/bin/codecept run unit --env github
- name: Api tests
run: |
nohup php tests/testapp/yii serve -p=8080 > tests/testapp/runtime/yii.log 2>&1 &
sleep 10 &&
curl http://localhost:8080/defaults &&
php vendor/bin/codecept run api --env github
|