name: Build on: push: pull_request: types: [opened, reopened, synchronize, edited] jobs: build: runs-on: ubuntu-latest strategy: fail-fast: false matrix: operating-system: ['ubuntu-latest'] php-versions: ['8.1', '8.0','7.4'] services: mariadb: image: mariadb:10 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: Run static code analysis run: vendor/bin/phpstan analyse - name: Archive failed tests artifacts - test output & log uses: actions/upload-artifact@v4 if: failure() with: name: test-outputs-php-${{ matrix.php-versions }} path: tests/_output