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
This commit is contained in:
79
.github/workflows/php.yml
vendored
Normal file
79
.github/workflows/php.yml
vendored
Normal file
@ -0,0 +1,79 @@
|
||||
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
|
||||
|
||||
|
||||
65
.travis.yml
65
.travis.yml
@ -1,65 +0,0 @@
|
||||
|
||||
# faster builds on new travis setup not using sudo
|
||||
sudo: false
|
||||
|
||||
language: php
|
||||
|
||||
php:
|
||||
- 5.6
|
||||
- 7.1
|
||||
- 7.2
|
||||
- 7.3
|
||||
- 7.4
|
||||
- nightly
|
||||
|
||||
services:
|
||||
- mysql
|
||||
|
||||
matrix:
|
||||
fast_finish: true
|
||||
allow_failures:
|
||||
- php: nightly
|
||||
|
||||
# cache vendor dirs
|
||||
# cache:
|
||||
# directories:
|
||||
# - vendor
|
||||
# - $HOME/.composer/cache
|
||||
|
||||
install:
|
||||
- |
|
||||
if [[ $TRAVIS_PHP_VERSION != '7.1' && $TRAVIS_PHP_VERSION != '7.2' && $TRAVIS_PHP_VERSION != hhv* ]]; then
|
||||
# disable xdebug for performance reasons when code coverage is not needed
|
||||
# note: xdebug on hhvm is disabled by default
|
||||
phpenv config-rm xdebug.ini || echo "xdebug is not installed"
|
||||
fi
|
||||
- travis_retry composer self-update && composer --version
|
||||
- export PATH="$HOME/.composer/vendor/bin:$PATH"
|
||||
- COMPOSER_MEMORY_LIMIT=-1 travis_retry composer install --prefer-dist --no-interaction
|
||||
|
||||
before_script:
|
||||
- php -r "echo INTL_ICU_VERSION . \"\n\";"
|
||||
- php -r "echo INTL_ICU_DATA_VERSION . \"\n\";"
|
||||
- mysql --version
|
||||
|
||||
# initialize database
|
||||
- mysql -e 'CREATE DATABASE `yii2-usuario-test`;';
|
||||
- php tests/_app/yii.php migrate/up --interactive=0
|
||||
- php tests/_app/yii.php migrate/up --interactive=0 --migrationPath=@yii/rbac/migrations
|
||||
|
||||
# enable code coverage on PHP 7.2, only one PHP version needs to generate coverage data
|
||||
- |
|
||||
if [ $TRAVIS_PHP_VERSION = '7.2' ]; then
|
||||
CODECEPTION_FLAGS="--coverage-xml"
|
||||
fi
|
||||
|
||||
script:
|
||||
- composer validate --no-check-lock
|
||||
- vendor/bin/codecept run $CODECEPTION_FLAGS
|
||||
|
||||
after_script:
|
||||
- |
|
||||
if [ $TRAVIS_PHP_VERSION = '7.2' ]; then
|
||||
travis_retry wget https://scrutinizer-ci.com/ocular.phar
|
||||
php ocular.phar code-coverage:upload --format=php-clover tests/_output/coverage.xml
|
||||
fi
|
||||
@ -1,6 +1,7 @@
|
||||
# CHANGELOG
|
||||
|
||||
## work in progress
|
||||
- Fix replace non-working travis build with working github actions build (TonisOrmisson)
|
||||
- Fix user login events not triggered on ajax requests (TonisOrmisson)
|
||||
- Enh: Added minimum requirements when a new password is automatically generated (MatteoF96)
|
||||
- Fix #380: Avoid rewriting AccessRule::matchRole (maxxer)
|
||||
|
||||
@ -6,7 +6,8 @@ Yii 2 Usuario Extension
|
||||
[](https://packagist.org/packages/2amigos/yii2-usuario)
|
||||
[](https://packagist.org/packages/2amigos/yii2-usuario)
|
||||
[](https://packagist.org/packages/2amigos/yii2-usuario)
|
||||
[](https://travis-ci.org/2amigos/yii2-usuario)
|
||||
[](https://github.com/2amigos/yii2-usuario/actions/)
|
||||
|
||||
[](//packagist.org/packages/2amigos/yii2-usuario)
|
||||
[](https://scrutinizer-ci.com/g/2amigos/yii2-usuario/?branch=master)
|
||||
|
||||
|
||||
@ -4,8 +4,8 @@ paths:
|
||||
log: tests/_output
|
||||
data: tests/_data
|
||||
helpers: tests/_support
|
||||
bootstrap: _bootstrap.php
|
||||
settings:
|
||||
bootstrap: _bootstrap.php
|
||||
colors: true
|
||||
memory_limit: 1024M
|
||||
modules:
|
||||
@ -13,11 +13,12 @@ modules:
|
||||
Db:
|
||||
dsn: 'mysql:host=127.0.0.1;dbname=yii2-usuario-test'
|
||||
user: 'root'
|
||||
password: ''
|
||||
password: 'password'
|
||||
dump: tests/_data/schema.sql
|
||||
Yii2:
|
||||
configFile: 'tests/_app/config/test.php'
|
||||
cleanup: false
|
||||
transaction: false
|
||||
coverage:
|
||||
enabled: true
|
||||
whitelist:
|
||||
|
||||
@ -87,6 +87,7 @@ class UserCreateService implements ServiceInterface
|
||||
$model->addError('username', $error_msg);
|
||||
}
|
||||
$transaction->rollBack();
|
||||
Yii::error($error_msg, 'usuario');
|
||||
return false;
|
||||
}
|
||||
$transaction->commit();
|
||||
|
||||
@ -2,9 +2,9 @@
|
||||
|
||||
$db = [
|
||||
'class' => 'yii\db\Connection',
|
||||
'dsn' => 'mysql:host=localhost;dbname=yii2-usuario-test',
|
||||
'dsn' => 'mysql:host=127.0.0.1;dbname=yii2-usuario-test',
|
||||
'username' => 'root',
|
||||
'password' => '',
|
||||
'password' => 'password',
|
||||
'charset' => 'utf8',
|
||||
];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user