Skip to content

Commit 01bd716

Browse files
committed
Reuse cycle testing workflows
1 parent 94fc28b commit 01bd716

File tree

112 files changed

+485
-293
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+485
-293
lines changed

.github/workflows/ci-mssql.yml

Lines changed: 7 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -1,96 +1,16 @@
1-
on:
1+
---
2+
3+
on: # yamllint disable-line rule:truthy
24
push:
35
branches:
4-
- master
56
- '*.*'
67
- '*.*.*'
78
pull_request: null
89

9-
name: ci-mssql
10+
name: MSSQL
1011

1112
jobs:
12-
tests:
13-
name: PHP ${{ matrix.php }}-mssql-${{ matrix.mssql }}
14-
15-
env:
16-
key: cache
17-
18-
runs-on: ubuntu-latest
19-
20-
strategy:
21-
fail-fast: false
22-
matrix:
23-
include:
24-
- php: '8.0'
25-
extensions: pdo, pdo_sqlsrv
26-
mssql: 'server:2017-latest'
27-
- php: '8.0'
28-
extensions: pdo, pdo_sqlsrv
29-
mssql: 'server:2019-latest'
30-
odbc-version: 18
31-
flag: "-C"
32-
- php: '8.1'
33-
extensions: pdo, pdo_sqlsrv
34-
mssql: 'server:2019-latest'
35-
odbc-version: 18
36-
flag: "-C"
37-
- php: '8.2'
38-
extensions: pdo, pdo_sqlsrv
39-
mssql: 'server:2019-latest'
40-
odbc-version: 18
41-
flag: "-C"
42-
- php: '8.3'
43-
extensions: pdo, pdo_sqlsrv
44-
mssql: 'server:2019-latest'
45-
odbc-version: 18
46-
flag: "-C"
47-
48-
services:
49-
mssql:
50-
image: mcr.microsoft.com/mssql/${{ matrix.mssql }}
51-
env:
52-
SA_PASSWORD: SSpaSS__1
53-
ACCEPT_EULA: Y
54-
MSSQL_PID: Developer
55-
ports:
56-
- 11433:1433
57-
options: --name=mssql --health-cmd="/opt/mssql-tools${{ matrix.odbc-version }}/bin/sqlcmd ${{ matrix.flag }} -S localhost -U SA -P 'SSpaSS__1' -Q 'SELECT 1'" --health-interval=10s --health-timeout=5s --health-retries=5
58-
59-
steps:
60-
- name: Checkout
61-
uses: actions/checkout@v2.3.4
62-
63-
- name: Install PHP with extensions
64-
uses: shivammathur/setup-php@v2
65-
with:
66-
php-version: ${{ matrix.php }}
67-
extensions: ${{ matrix.extensions }}
68-
ini-values: date.timezone='UTC'
69-
tools: composer:v2, pecl
70-
71-
- name: Determine composer cache directory on Linux
72-
run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV
73-
74-
- name: Cache dependencies installed with composer
75-
uses: actions/cache@v2
76-
with:
77-
path: ${{ env.COMPOSER_CACHE_DIR }}
78-
key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}
79-
restore-keys: |
80-
php${{ matrix.php }}-composer-
81-
82-
- name: Update composer
83-
run: composer self-update
84-
85-
- name: Install dependencies with composer
86-
if: matrix.php != '8.3'
87-
run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
88-
89-
- name: Install dependencies with composer php 8.3
90-
if: matrix.php == '8.3'
91-
run: composer update --ignore-platform-reqs --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
13+
phpunit:
14+
uses: cycle/gh-actions/.github/workflows/db-mssql.yml@master
9215

93-
- name: Run tests with phpunit without coverage
94-
env:
95-
DB: sqlserver
96-
run: vendor/bin/phpunit tests/Schema/Driver/SQLServer --colors=always
16+
...

.github/workflows/ci-mysql.yml

Lines changed: 7 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -1,98 +1,16 @@
1-
on:
1+
---
2+
3+
on: # yamllint disable-line rule:truthy
24
push:
35
branches:
4-
- master
56
- '*.*'
67
- '*.*.*'
78
pull_request: null
89

9-
name: ci-mysql
10+
name: MySQL
1011

1112
jobs:
12-
tests:
13-
name: PHP ${{ matrix.php-version }}-mysql-${{ matrix.mysql-version }}
14-
env:
15-
extensions: curl, intl, pdo, pdo_mysql
16-
key: cache-v1
17-
18-
runs-on: ${{ matrix.os }}
19-
20-
strategy:
21-
fail-fast: false
22-
matrix:
23-
os:
24-
- ubuntu-latest
25-
26-
php-version:
27-
- "8.0"
28-
- "8.1"
29-
- "8.2"
30-
- "8.3"
31-
32-
mysql-version:
33-
- "5.7"
34-
- "8.0"
35-
36-
services:
37-
mysql:
38-
image: mysql:${{ matrix.mysql-version }}
39-
env:
40-
MYSQL_ROOT_PASSWORD: root
41-
MYSQL_DATABASE: spiral
42-
MYSQL_AUTHENTICATION_PLUGIN: mysql_native_password
43-
ports:
44-
- 13306:3306
45-
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
46-
47-
steps:
48-
- name: Checkout
49-
uses: actions/checkout@v2
50-
51-
- name: Setup cache environment
52-
id: cache-env
53-
uses: shivammathur/cache-extensions@v1
54-
with:
55-
php-version: ${{ matrix.php-version }}
56-
extensions: ${{ env.extensions }}
57-
key: ${{ env.key }}
58-
59-
- name: Cache extensions
60-
uses: actions/cache@v2
61-
with:
62-
path: ${{ steps.cache-env.outputs.dir }}
63-
key: ${{ steps.cache-env.outputs.key }}
64-
restore-keys: ${{ steps.cache-env.outputs.key }}
65-
66-
- name: Install PHP with extensions
67-
uses: shivammathur/setup-php@v2
68-
with:
69-
php-version: ${{ matrix.php-version }}
70-
extensions: ${{ env.extensions }}
71-
ini-values: date.timezone='UTC'
72-
coverage: pcov
73-
74-
- name: Determine composer cache directory
75-
if: matrix.os == 'ubuntu-latest'
76-
run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV
77-
78-
- name: Cache dependencies installed with composer
79-
uses: actions/cache@v2
80-
with:
81-
path: ${{ env.COMPOSER_CACHE_DIR }}
82-
key: php${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.json') }}
83-
restore-keys: |
84-
php${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-
85-
86-
- name: Install dependencies with composer
87-
if: matrix.php-version != '8.3'
88-
run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
89-
90-
- name: Install dependencies with composer php 8.3
91-
if: matrix.php-version == '8.3'
92-
run: composer update --ignore-platform-reqs --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
13+
phpunit:
14+
uses: cycle/gh-actions/.github/workflows/db-mysql.yml@master
9315

94-
- name: Run mysql tests with phpunit
95-
env:
96-
DB: mysql
97-
MYSQL: ${{ matrix.mysql-version }}
98-
run: vendor/bin/phpunit tests/Schema/Driver/MySQL --colors=always
16+
...

.github/workflows/ci-pgsql.yml

Lines changed: 7 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -1,99 +1,16 @@
1-
on:
1+
---
2+
3+
on: # yamllint disable-line rule:truthy
24
push:
35
branches:
4-
- master
56
- '*.*'
67
- '*.*.*'
78
pull_request: null
89

9-
name: ci-pgsql
10+
name: Postgres
1011

1112
jobs:
12-
tests:
13-
name: PHP ${{ matrix.php-version }}-pgsql-${{ matrix.pgsql-version }}
14-
env:
15-
extensions: curl, intl, pdo, pdo_pgsql
16-
key: cache-v1
17-
18-
runs-on: ${{ matrix.os }}
19-
20-
strategy:
21-
fail-fast: false
22-
matrix:
23-
os:
24-
- ubuntu-latest
25-
php-version:
26-
- "8.0"
27-
- "8.1"
28-
- "8.2"
29-
- "8.3"
30-
31-
pgsql-version:
32-
- "10"
33-
- "11"
34-
- "12"
35-
- "13"
36-
37-
services:
38-
postgres:
39-
image: postgres:${{ matrix.pgsql-version }}
40-
env:
41-
POSTGRES_USER: postgres
42-
POSTGRES_PASSWORD: postgres
43-
POSTGRES_DB: spiral
44-
ports:
45-
- 15432:5432
46-
options: --name=postgres --health-cmd="pg_isready" --health-interval=10s --health-timeout=5s --health-retries=3
47-
48-
steps:
49-
- name: Checkout
50-
uses: actions/checkout@v2
51-
52-
- name: Setup cache environment
53-
id: cache-env
54-
uses: shivammathur/cache-extensions@v1
55-
with:
56-
php-version: ${{ matrix.php-version }}
57-
extensions: ${{ env.extensions }}
58-
key: ${{ env.key }}
59-
60-
- name: Cache extensions
61-
uses: actions/cache@v2
62-
with:
63-
path: ${{ steps.cache-env.outputs.dir }}
64-
key: ${{ steps.cache-env.outputs.key }}
65-
restore-keys: ${{ steps.cache-env.outputs.key }}
66-
67-
- name: Install PHP with extensions
68-
uses: shivammathur/setup-php@v2
69-
with:
70-
php-version: ${{ matrix.php-version }}
71-
extensions: ${{ env.extensions }}
72-
ini-values: date.timezone='UTC'
73-
coverage: pcov
74-
75-
- name: Determine composer cache directory
76-
if: matrix.os == 'ubuntu-latest'
77-
run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV
78-
79-
- name: Cache dependencies installed with composer
80-
uses: actions/cache@v2
81-
with:
82-
path: ${{ env.COMPOSER_CACHE_DIR }}
83-
key: php${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.json') }}
84-
restore-keys: |
85-
php${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-
86-
87-
- name: Install dependencies with composer
88-
if: matrix.php-version != '8.3'
89-
run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
90-
91-
- name: Install dependencies with composer php 8.3
92-
if: matrix.php-version == '8.3'
93-
run: composer update --ignore-platform-reqs --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
13+
phpunit:
14+
uses: cycle/gh-actions/.github/workflows/db-pgsql.yml@master
9415

95-
- name: Run pgsql tests with phpunit
96-
env:
97-
DB: postgres
98-
POSTGRES: ${{ matrix.pgsql-version }}
99-
run: vendor/bin/phpunit tests/Schema/Driver/Postgres --colors=always
16+
...

.github/workflows/cs-fix.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
3+
on: # yamllint disable-line rule:truthy
4+
push:
5+
branches:
6+
- '*'
7+
8+
name: Fix Code Style
9+
10+
jobs:
11+
cs-fix:
12+
permissions:
13+
contents: write
14+
uses: spiral/gh-actions/.github/workflows/cs-fix.yml@master
15+
16+
...

.github/workflows/psalm.yml

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
11
on:
2-
pull_request:
3-
push:
4-
branches:
5-
- master
6-
- '*.*'
7-
- '*.*.*'
2+
pull_request: null
3+
push:
4+
branches:
5+
- master
6+
- '*.*'
87

98
name: static analysis
109

1110
jobs:
12-
psalm:
13-
uses: spiral/gh-actions/.github/workflows/psalm.yml@master
14-
with:
15-
os: >-
16-
['ubuntu-latest']
17-
php: >-
18-
['8.3']
11+
psalm:
12+
uses: spiral/gh-actions/.github/workflows/psalm.yml@master
13+
with:
14+
os: >-
15+
['ubuntu-latest']

tests/Schema/Driver/MySQL/BelongsToMorphedRelationCompositePKTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66

77
use Cycle\Schema\Tests\Relation\Morphed\BelongsToMorphedRelationCompositePKTest as BaseTest;
88

9+
/**
10+
* @group driver
11+
* @group driver-mysql
12+
*/
913
class BelongsToMorphedRelationCompositePKTest extends BaseTest
1014
{
1115
public const DRIVER = 'mysql';

tests/Schema/Driver/MySQL/BelongsToMorphedRelationTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66

77
use Cycle\Schema\Tests\Relation\Morphed\BelongsToMorphedRelationTest as BaseTest;
88

9+
/**
10+
* @group driver
11+
* @group driver-mysql
12+
*/
913
class BelongsToMorphedRelationTest extends BaseTest
1014
{
1115
public const DRIVER = 'mysql';

tests/Schema/Driver/MySQL/BelongsToRelationCompositePKTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66

77
use Cycle\Schema\Tests\Relation\BelongsToRelationCompositePKTest as BaseTest;
88

9+
/**
10+
* @group driver
11+
* @group driver-mysql
12+
*/
913
class BelongsToRelationCompositePKTest extends BaseTest
1014
{
1115
public const DRIVER = 'mysql';

0 commit comments

Comments
 (0)