Skip to content

Commit

Permalink
ci: use common MySQL workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
roxblnfk committed Oct 23, 2024
1 parent 5c434ec commit c5aa164
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 89 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-mssql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on: # yamllint disable-line rule:truthy
- '*.*.*'
pull_request: null

name: MSSQL tests
name: MSSQL

jobs:
phpunit:
Expand Down
91 changes: 3 additions & 88 deletions .github/workflows/ci-mysql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,95 +8,10 @@ on: # yamllint disable-line rule:truthy
- '*.*.*'
pull_request: null

name: ci-mysql
name: MySQL

jobs:
tests:
name: PHP ${{ matrix.php-version }}-mysql-${{ matrix.mysql-version }}
env:
extensions: curl, intl, pdo, pdo_mysql
key: cache-v1

runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest

php-version:
- "8.0"
- "8.1"
- "8.2"
- "8.3"

mysql-version:
- "5.7"
- "8.0"

services:
mysql:
image: mysql:${{ matrix.mysql-version }}
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: spiral
MYSQL_AUTHENTICATION_PLUGIN: mysql_native_password
ports:
- 13306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup cache environment
id: cache-env
uses: shivammathur/cache-extensions@v1
with:
php-version: ${{ matrix.php-version }}
extensions: ${{ env.extensions }}
key: ${{ env.key }}

- name: Cache extensions
uses: actions/cache@v2
with:
path: ${{ steps.cache-env.outputs.dir }}
key: ${{ steps.cache-env.outputs.key }}
restore-keys: ${{ steps.cache-env.outputs.key }}

- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: ${{ env.extensions }}
ini-values: date.timezone='UTC'
coverage: pcov

- name: Determine composer cache directory
if: matrix.os == 'ubuntu-latest'
run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV

- name: Cache dependencies installed with composer
uses: actions/cache@v2
with:
path: ${{ env.COMPOSER_CACHE_DIR }}
key: php${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.json') }}
restore-keys: |
php${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-
- name: Install dependencies with composer
if: matrix.php-version != '8.3'
run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi

- name: Install dependencies with composer php 8.3
if: matrix.php-version == '8.3'
run: composer update --ignore-platform-reqs --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi

- name: Run mysql tests with phpunit
env:
DB: mysql
MYSQL: ${{ matrix.mysql-version }}
run: vendor/bin/phpunit --group driver-mysql --colors=always
phpunit:
uses: cycle/gh-actions/.github/workflows/db-mysql.yml@master

...

0 comments on commit c5aa164

Please sign in to comment.