Files
yii2-usuario/.github/workflows/php.yml
Tõnis Ormisson 422a17d8dc Use GitHub actions (#447)
* init github actions

* init github actions: test run on feature branch

* github actions: remove alternative mysql port

* github actions: expose mysql port

* github actions: install & try migrations

* github actions: adjust test db configuration for github actions

* github actions: run tests

* github actions: fix codeception db connection add actions badge

* github actions: try only php8

* github actions: add php 7.4

* github actions: dont fail fast

* github actions: save test-outputs as artifacts

* github actions: save test-outputs only on fail

* github actions: save runtime folder in artifacts on failed build

* github actions: save runtime folder in artifacts on failed build

* github actions: save error  logs for tests

* github actions: log error if unable to send email on new user creation

* github actions: change log conf

* github actions: add tests yii2:transaction=false to pass tests on php < 8

* github actions: add tests yii2:transaction=false to pass tests on php < 8

* github actions: remove travis

* github actions: add changelog
2022-02-17 13:45:34 +01:00

80 lines
2.4 KiB
YAML

name: Build
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
operating-system: ['ubuntu-latest']
php-versions: ['8.1', '8.0','7.4','7.3', '7.2','7.1','7.0', '5.6']
services:
mariadb:
image: mariadb:latest
ports:
- 3306:3306
env:
MYSQL_USER: user
MYSQL_PASSWORD: password
MYSQL_DATABASE: yii2-usuario-test
MYSQL_ROOT_PASSWORD: password
options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, intl, gd
ini-values: post_max_size=256M, max_execution_time=180
coverage: xdebug
- uses: actions/checkout@v2
- name: Verify MariaDB connection
run: |
while ! mysqladmin ping -h"127.0.0.1" --silent; do
sleep 1
done
- name: Validate PHP version
run: php -v
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v2
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Verify db connection & databases
run: mysql -e "SHOW DATABASES;" -h127.0.0.1 -uroot -ppassword
- name: Install
run: composer install --prefer-dist --no-interaction
- name: Run migrations
run: php tests/_app/yii.php migrate/up --interactive=0 --migrationPath=@yii/rbac/migrations
- name: Run tests
run: XDEBUG_MODE=coverage php vendor/bin/codecept run --coverage --coverage-xml
- name: Archive failed tests artifacts - test output & log
uses: actions/upload-artifact@v2
if: failure()
with:
name: test-outputs-php-${{ matrix.php-versions }}
path: tests/_output