Skip to content

Commit

Permalink
Merge pull request #20: update metafiles and CI
Browse files Browse the repository at this point in the history
  • Loading branch information
roxblnfk authored Dec 23, 2024
2 parents 54bea9f + b08961a commit f09c739
Show file tree
Hide file tree
Showing 38 changed files with 393 additions and 627 deletions.
18 changes: 18 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[*.{yml,yaml}]
indent_size = 2

[Makefile]
indent_style = tab
12 changes: 7 additions & 5 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/.github export-ignore
/.editorconfig export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/tests export-ignore
/.* export-ignore
/.phpstorm.meta.php -export-ignore
/tests export-ignore
/*.xml export-ignore
/*.yml export-ignore
/*.lock export-ignore
/*.dist export-ignore
3 changes: 3 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# These are supported funding model platforms

github: cycle
83 changes: 15 additions & 68 deletions .github/workflows/ci-mssql.yml
Original file line number Diff line number Diff line change
@@ -1,72 +1,19 @@
on:
- pull_request
- push
---

name: ci-mssql
on: # yamllint disable-line rule:truthy
push:
branches:
- master
- '*.*'
- '*.*.*'
pull_request: null

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

env:
key: cache

runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
include:
- php: '8.1'
extensions: pdo, pdo_sqlsrv
mssql: 'server:2019-latest'

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/checkout@v2
name: MSSQL

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

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

- name: Run tests with phpunit without coverage
env:
DB: sqlserver
run: vendor/bin/phpunit --group driver-sqlserver
jobs:
phpunit:
uses: cycle/gh-actions/.github/workflows/db-mssql.yml@master
with:
php: '["8.1","8.2","8.3","8.4"]'
...
103 changes: 15 additions & 88 deletions .github/workflows/ci-mysql.yml
Original file line number Diff line number Diff line change
@@ -1,91 +1,18 @@
on:
- pull_request
- push
---

name: ci-mysql
on: # yamllint disable-line rule:truthy
push:
branches:
- master
- '*.*'
- '*.*.*'
pull_request: null

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.1"

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: MySQL

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

- name: Install dependencies with composer php 8.2
if: matrix.php-version == '8.2'
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
jobs:
phpunit:
uses: cycle/gh-actions/.github/workflows/db-mysql.yml@master
with:
php: '["8.1","8.2","8.3","8.4"]'
...
104 changes: 15 additions & 89 deletions .github/workflows/ci-pgsql.yml
Original file line number Diff line number Diff line change
@@ -1,92 +1,18 @@
on:
- pull_request
- push
---

name: ci-pgsql
on: # yamllint disable-line rule:truthy
push:
branches:
- master
- '*.*'
- '*.*.*'
pull_request: null

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.1"

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: Postgres

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

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

- name: Run pgsql tests with phpunit
env:
DB: postgres
POSTGRES: ${{ matrix.pgsql-version }}
run: vendor/bin/phpunit --group driver-postgres
jobs:
phpunit:
uses: cycle/gh-actions/.github/workflows/db-pgsql.yml@master
with:
php: '["8.1","8.2","8.3","8.4"]'
...
16 changes: 16 additions & 0 deletions .github/workflows/cs-fix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---

on: # yamllint disable-line rule:truthy
push:
branches:
- '*'

name: Fix Code Style

jobs:
cs-fix:
permissions:
contents: write
uses: spiral/gh-actions/.github/workflows/cs-fix.yml@master

...
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Setup DB services
run: |
cd tests
docker-compose up -d
docker compose up -d
cd ..
- name: Setup PHP ${{ matrix.php-versions }}
uses: shivammathur/setup-php@v2
Expand Down
15 changes: 15 additions & 0 deletions .github/workflows/psalm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
on:
pull_request: null
push:
branches:
- master
- '*.*'

name: static analysis

jobs:
psalm:
uses: spiral/gh-actions/.github/workflows/psalm.yml@master
with:
os: >-
['ubuntu-latest']
8 changes: 5 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
.idea/
/.*
!/.github/
/runtime/
/vendor/
.env
composer.lock
vendor/
*.db
clover.xml
/.phpunit.result.cache
docker-compose.override.yml
Loading

0 comments on commit f09c739

Please sign in to comment.