Skip to content

Commit

Permalink
Reuse common CI; add PHP 8.4
Browse files Browse the repository at this point in the history
  • Loading branch information
roxblnfk committed Dec 10, 2024
1 parent a78807f commit 1dad933
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 267 deletions.
88 changes: 9 additions & 79 deletions .github/workflows/ci-mssql.yml
Original file line number Diff line number Diff line change
@@ -1,86 +1,16 @@
on:
---

on: # yamllint disable-line rule:truthy
push:
branches:
- '2.*'
- '*.*'
- '*.*.*'
pull_request: null

name: ci-mssql
name: MSSQL

jobs:
tests:
name: PHP ${{ matrix.php }}-mssql-${{ matrix.mssql }}

env:
key: cache

runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
include:
- php: '8.0'
extensions: pdo, pdo_sqlsrv
mssql: 'server:2017-latest'
- php: '8.0'
extensions: pdo, pdo_sqlsrv
mssql: 'server:2019-CU25-ubuntu-20.04'
- php: '8.1'
extensions: pdo, pdo_sqlsrv
mssql: 'server:2019-CU25-ubuntu-20.04'
- php: '8.2'
extensions: pdo, pdo_sqlsrv
mssql: 'server:2019-CU25-ubuntu-20.04'
- php: '8.3'
extensions: pdo, pdo_sqlsrv
mssql: 'server:2019-CU25-ubuntu-20.04'

services:
mssql:
image: mcr.microsoft.com/mssql/${{ matrix.mssql }}
env:
SA_PASSWORD: SSpaSS__1
ACCEPT_EULA: Y
MSSQL_PID: Developer
ports:
- 11433:1433
options: --name=mssql --health-cmd="/opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P 'SSpaSS__1' -Q 'SELECT 1'" --health-interval=10s --health-timeout=5s --health-retries=3

steps:
- name: Checkout
uses: actions/[email protected]

- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: ${{ matrix.extensions }}
ini-values: date.timezone='UTC'
tools: composer:v2, pecl

- name: Determine composer cache directory on Linux
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 }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: |
php${{ matrix.php }}-composer-
- name: Update composer
run: composer self-update

- name: Install dependencies with composer
if: matrix.php != '8.4'
run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi

- name: Install dependencies with composer php 8.4
if: matrix.php == '8.4'
run: composer update --ignore-platform-reqs --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
phpunit:
uses: cycle/gh-actions/.github/workflows/db-mssql.yml@master

- name: Run tests with phpunit without coverage
env:
DB: sqlserver
run: vendor/bin/phpunit --group driver-sqlserver --colors=always
...
101 changes: 9 additions & 92 deletions .github/workflows/ci-mysql.yml
Original file line number Diff line number Diff line change
@@ -1,99 +1,16 @@
on:
---

on: # yamllint disable-line rule:truthy
push:
branches:
- '2.*'
- '*.*'
- '*.*.*'
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: Show databases for root user
run: mysql --protocol=tcp -h localhost -P 13306 -u root -proot -e "ALTER DATABASE spiral CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"

- 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.4'
run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi

- name: Install dependencies with composer php 8.4
if: matrix.php-version == '8.4'
run: composer update --ignore-platform-reqs --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
phpunit:
uses: cycle/gh-actions/.github/workflows/db-mysql.yml@master

- name: Run mysql tests with phpunit
env:
DB: mysql
MYSQL: ${{ matrix.mysql-version }}
run: vendor/bin/phpunit --group driver-mysql --colors=always
...
99 changes: 9 additions & 90 deletions .github/workflows/ci-pgsql.yml
Original file line number Diff line number Diff line change
@@ -1,97 +1,16 @@
on:
---

on: # yamllint disable-line rule:truthy
push:
branches:
- '2.*'
- '*.*'
- '*.*.*'
pull_request: null

name: ci-pgsql
name: Postgres

jobs:
tests:
name: PHP ${{ matrix.php-version }}-pgsql-${{ matrix.pgsql-version }}
env:
extensions: curl, intl, pdo, pdo_pgsql
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"

pgsql-version:
- "10"
- "11"
- "12"
- "13"

services:
postgres:
image: postgres:${{ matrix.pgsql-version }}
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: spiral
ports:
- 15432:5432
options: --name=postgres --health-cmd="pg_isready" --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.4'
run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi

- name: Install dependencies with composer php 8.4
if: matrix.php-version == '8.4'
run: composer update --ignore-platform-reqs --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
phpunit:
uses: cycle/gh-actions/.github/workflows/db-pgsql.yml@master

- name: Run pgsql tests with phpunit
env:
DB: postgres
POSTGRES: ${{ matrix.pgsql-version }}
run: vendor/bin/phpunit --group driver-postgres --colors=always
...
2 changes: 2 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jobs:
- "8.1"
- "8.2"
- "8.3"
- "8.4"
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down Expand Up @@ -81,6 +82,7 @@ jobs:
- "8.1"
- "8.2"
- "8.3"
- "8.4"
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down
6 changes: 3 additions & 3 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
port: 13306,
charset: 'utf8mb4',
user: 'root',
password: 'root',
password: 'YourStrong!Passw0rd',
),
queryCache: true,
options: [
Expand All @@ -37,7 +37,7 @@
host: '127.0.0.1',
port: 15432,
user: 'postgres',
password: 'postgres',
password: 'YourStrong!Passw0rd',
),
schema: 'public',
queryCache: true,
Expand All @@ -49,7 +49,7 @@
connection: new Config\SQLServer\DsnConnectionConfig(
'sqlsrv:Server=127.0.0.1,11433;Database=tempdb;TrustServerCertificate=true',
user: 'SA',
password: 'SSpaSS__1'
password: 'YourStrong!Passw0rd'
),
queryCache: true,
options: [
Expand Down
6 changes: 3 additions & 3 deletions tests/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ services:
ports:
- "11433:1433"
environment:
SA_PASSWORD: "SSpaSS__1"
SA_PASSWORD: "YourStrong!Passw0rd"
ACCEPT_EULA: "Y"

cycle-mysql_latest:
Expand All @@ -20,7 +20,7 @@ services:
- "13306:3306"
environment:
MYSQL_DATABASE: "spiral"
MYSQL_ROOT_PASSWORD: "root"
MYSQL_ROOT_PASSWORD: "YourStrong!Passw0rd"
MYSQL_ROOT_HOST: "%"

cycle-postgres:
Expand All @@ -31,4 +31,4 @@ services:
environment:
POSTGRES_DB: "spiral"
POSTGRES_USER: "postgres"
POSTGRES_PASSWORD: "postgres"
POSTGRES_PASSWORD: "YourStrong!Passw0rd"

0 comments on commit 1dad933

Please sign in to comment.