Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

Commit

Permalink
Merge pull request #65 from roxblnfk/feature/fix-ci
Browse files Browse the repository at this point in the history
Fix github actions
  • Loading branch information
SerafimArts authored Mar 16, 2021
2 parents a729662 + 9473f06 commit 4818807
Show file tree
Hide file tree
Showing 87 changed files with 618 additions and 124 deletions.
86 changes: 86 additions & 0 deletions .github/workflows/ci-mssql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
on:
- pull_request
- push

name: ci-mssql

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

env:
key: cache

runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
include:
- php: '7.2'
extensions: pdo, pdo_sqlsrv-5.8.1
mssql: 'server:2017-latest'
- php: '7.3'
extensions: pdo, pdo_sqlsrv-5.8.1
mssql: 'server:2017-latest'
- php: '7.4'
extensions: pdo, pdo_sqlsrv
mssql: 'server:2017-latest'
- php: '7.4'
extensions: pdo, pdo_sqlsrv
mssql: 'server:2019-latest'
- php: '8.0'
extensions: pdo, pdo_sqlsrv
mssql: 'server:2017-latest'
- php: '8.0'
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/[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
run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi

- name: Install dependencies with composer php 8.0
if: matrix.php == '8.0'
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 --colors=always
87 changes: 87 additions & 0 deletions .github/workflows/ci-mysql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
on:
- pull_request
- push

name: ci-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:
- "7.4"
- "8.0"

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@v1
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@v1
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
run: composer update --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
90 changes: 90 additions & 0 deletions .github/workflows/ci-pgsql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
on:
- pull_request
- push

name: ci-pgsql

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:
- "7.2"
- "7.3"
- "7.4"
- "8.0"

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@v1
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@v1
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
run: composer update --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 --colors=always
89 changes: 17 additions & 72 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ jobs:
run: vendor/bin/spiral-cs check src tests
test:
needs: lint
name: Test PHP ${{ matrix.php-versions }}
name: Test PHP ${{ matrix.php-versions }} with Code Coverage
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ['7.2', '7.3', '7.4']
php-versions: ['7.2', '7.4', '8.0']
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -38,18 +38,12 @@ jobs:
docker-compose up -d
cd ..
- name: Setup PHP ${{ matrix.php-versions }}
uses: shivammathur/setup-php@v1
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
coverage: pcov
tools: pecl
extensions: mbstring, pdo, pdo_sqlsrv
- name: Install MS SQL Server deps
run: |
bash ./tests/install-sqlsrv.sh
sudo sed -i.bak '/^extension="pdo_sqlsrv.so"/d' /etc/php/${{ matrix.php-versions }}/cli/php.ini
sudo bash -c 'printf "; priority=30\nextension=pdo_sqlsrv.so\n" > /etc/php/${{ matrix.php-versions }}/mods-available/pdo_sqlsrv.ini'
sudo phpenmod -s cli -v ${{ matrix.php-versions }} pdo_sqlsrv
extensions: mbstring, pdo, pdo_sqlite, pdo_pgsql, pdo_sqlsrv, pdo_mysql
- name: Get Composer Cache Directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
Expand All @@ -65,77 +59,29 @@ jobs:
run: |
vendor/bin/phpunit --coverage-clover=coverage.xml
- name: Upload coverage to Codecov
continue-on-error: true # if is fork
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
test_postgres:

sqlite:
needs: lint
name: Test PostgreSQL ${{ matrix.configs.postgres-version }}
name: SQLite PHP ${{ matrix.php-versions }}
runs-on: ubuntu-latest
strategy:
matrix:
configs: [
{php-version: 7.2, postgres-version: 9.6},
{php-version: 7.3, postgres-version: 10},
{php-version: 7.3, postgres-version: 11}
]
services:
postgres:
image: postgres:${{ matrix.configs.postgres-version }}
ports:
- 5432:5432
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: spiral
options: --health-cmd="pg_isready" --health-interval=10s --health-timeout=5s --health-retries=3
php-versions: ['7.2', '7.3', '7.4', '8.0']
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP ${{ matrix.configs.php-version }}
run: sudo update-alternatives --set php /usr/bin/php${{ matrix.configs.php-version }}
- name: Get Composer Cache Directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Restore Composer Cache
uses: actions/cache@v1
- name: Setup PHP ${{ matrix.php-versions }}
uses: shivammathur/setup-php@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install Dependencies
run: composer install --no-interaction --prefer-dist
- name: Execute Tests
env:
DB: postgres
POSTGRES: ${{ matrix.configs.postgres-version }}
run: |
vendor/bin/phpunit tests/Database/Driver/Postgres
test_mariadb:
needs: lint
name: Test MariaDB ${{ matrix.configs.mariadb-version }}
runs-on: ubuntu-latest
strategy:
matrix:
configs: [
# {php-version: 7.2, mariadb-version: 10.2},
{php-version: 7.3, mariadb-version: 10.4}
]
services:
mariadb:
image: mariadb:${{ matrix.configs.mariadb-version }}
ports:
- 23306:3306
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: spiral
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP ${{ matrix.configs.php-version }}
run: sudo update-alternatives --set php /usr/bin/php${{ matrix.configs.php-version }}
php-version: ${{ matrix.php-versions }}
coverage: pcov
tools: pecl
extensions: mbstring, pdo, pdo_sqlite
- name: Get Composer Cache Directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
Expand All @@ -149,7 +95,6 @@ jobs:
run: composer install --no-interaction --prefer-dist
- name: Execute Tests
env:
DB: mariadb
MARIADB: ${{ matrix.configs.mariadb-version }}
DB: sqlite
run: |
vendor/bin/phpunit tests/Database/Driver/MySQL
vendor/bin/phpunit --group driver-sqlite --colors=always
Loading

0 comments on commit 4818807

Please sign in to comment.