Fixed tests #33
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
jobs: | |
yii: | |
name: CI (PHP ${{ matrix.php-versions }}) | |
runs-on: ubuntu-latest | |
# Docs: https://docs.github.com/en/actions/using-containerized-services | |
services: | |
mysql: | |
image: mysql:latest | |
env: | |
MYSQL_ALLOW_EMPTY_PASSWORD: true | |
MYSQL_DATABASE: yii2_skeleton_test | |
ports: | |
- 3306/tcp | |
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | |
strategy: | |
fail-fast: false | |
matrix: | |
php-versions: [ '8.1', '8.3' ] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
# Docs: https://github.com/shivammathur/setup-php | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-versions }} | |
extensions: mbstring, intl, gd, imagick, zip, dom, mysql | |
coverage: xdebug | |
- name: Get composer cache directory | |
id: composer-cache | |
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- name: Cache composer dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
restore-keys: ${{ runner.os }}-composer- | |
- name: Install Composer dependencies | |
run: composer install --no-progress --prefer-dist --optimize-autoloader | |
- name: Prepare the application | |
run: php tests/yii migrate --interactive=0 | |
env: | |
MYSQL_DSN: mysql:host=127.0.0.1;port=${{ job.services.mysql.ports['3306'] }};dbname=yii2_skeleton_test | |
- name: Run Tests | |
run: composer test | |
env: | |
MYSQL_DSN: mysql:host=127.0.0.1;port=${{ job.services.mysql.ports['3306'] }};dbname=yii2_skeleton_test | |
- name: Coding Standards | |
run: composer check-cs | |
- name: Run Static Code Analysis | |
run: composer phpstan |