mirror of
https://github.com/shivammathur/setup-php.git
synced 2026-03-22 15:45:54 +07:00
Update examples
This commit is contained in:
78
examples/yii3-mysql.yml
Normal file
78
examples/yii3-mysql.yml
Normal file
@@ -0,0 +1,78 @@
|
||||
# GitHub Action for Yii3 web application with MySQL
|
||||
# Tested with https://github.com/yiisoft/app
|
||||
name: Testing Yii3 with MySQL
|
||||
on: [push, pull_request]
|
||||
jobs:
|
||||
yii:
|
||||
name: Yii3 (PHP ${{ matrix.php-versions }})
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
APP_C3: true
|
||||
APP_ENV: test
|
||||
APP_DEBUG: false
|
||||
|
||||
# Docs: https://docs.github.com/en/actions/using-containerized-services
|
||||
services:
|
||||
mysql:
|
||||
image: mysql:8.4
|
||||
env:
|
||||
MYSQL_ALLOW_EMPTY_PASSWORD: false
|
||||
MYSQL_ROOT_PASSWORD: password
|
||||
MYSQL_DATABASE: app
|
||||
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.4', '8.5']
|
||||
# The latest yiisoft/app release resolves Symfony 8.0 packages that require PHP 8.4+.
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
|
||||
# Docs: https://github.com/shivammathur/setup-php
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: ${{ matrix.php-versions }}
|
||||
extensions: fileinfo, intl, pdo_mysql
|
||||
ini-values: date.timezone='UTC', register_argc_argv=On
|
||||
coverage: none
|
||||
|
||||
- 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@v5
|
||||
with:
|
||||
path: ${{ steps.composer-cache.outputs.dir }}
|
||||
# Use composer.json for key, if composer.lock is not committed.
|
||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||
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: Run migrations
|
||||
run: php yii migrate:up --no-interaction
|
||||
env:
|
||||
DB_HOST: 127.0.0.1
|
||||
DB_PORT: ${{ job.services.mysql.ports['3306'] }}
|
||||
DB_NAME: app
|
||||
DB_USERNAME: root
|
||||
DB_PASSWORD: password
|
||||
|
||||
- name: Run codeception build
|
||||
run: vendor/bin/codecept build
|
||||
|
||||
- name: Run tests with Codeception
|
||||
run: vendor/bin/codecept run
|
||||
env:
|
||||
DB_HOST: 127.0.0.1
|
||||
DB_PORT: ${{ job.services.mysql.ports['3306'] }}
|
||||
DB_NAME: app
|
||||
DB_USERNAME: root
|
||||
DB_PASSWORD: password
|
||||
Reference in New Issue
Block a user