Skip to content

Commit

Permalink
Add separate workflow for MSSQL
Browse files Browse the repository at this point in the history
  • Loading branch information
terabytesoftw authored Feb 8, 2021
1 parent ad6daec commit 920fda1
Show file tree
Hide file tree
Showing 4 changed files with 116 additions and 28 deletions.
28 changes: 1 addition & 27 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,6 @@ jobs:
ports:
- 5432:5432
options: --name=postgres --health-cmd="pg_isready" --health-interval=10s --health-timeout=5s --health-retries=3
mssql:
image: mcr.microsoft.com/mssql/server:2017-latest
env:
SA_PASSWORD: YourStrong!Passw0rd
ACCEPT_EULA: Y
MSSQL_PID: Developer
ports:
- 1433:1433
options: --name=mssql --health-cmd="/opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P 'YourStrong!Passw0rd' -Q 'SELECT 1'" --health-interval=10s --health-timeout=5s --health-retries=3
strategy:
fail-fast: false
matrix:
Expand All @@ -47,8 +38,6 @@ jobs:
steps:
- name: Generate french locale
run: sudo locale-gen fr_FR.UTF-8
- name: Create MS SQL Database
run: docker exec -i mssql /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P 'YourStrong!Passw0rd' -Q 'CREATE DATABASE yiitest'
- name: Checkout
uses: actions/checkout@v2
- name: Install PHP
Expand All @@ -58,21 +47,6 @@ jobs:
tools: pecl
extensions: apc, curl, dom, imagick, intl, mbstring, mcrypt, memcached, mysql, pdo, pdo_mysql, pdo_pgsql, pdo_sqlite, pgsql, sqlite
ini-values: date.timezone='UTC', session.save_path="${{ runner.temp }}"
- name: Install php-sqlsrv
run: |
curl -sSL https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add - >/dev/null 2>&1
curl -sSL https://packages.microsoft.com/config/ubuntu/16.04/mssql-server-2017.list | sudo tee /etc/apt/sources.list.d/mssql-server-2017.list >/dev/null 2>&1
printf "\033[32;1m✓ \033[0m\033[90;1madd microsoft keys & repository\n"
sudo apt-get -q update >/dev/null 2>&1
printf "\033[32;1m✓ \033[0m\033[90;1mapt-get update\n"
sudo pecl -q install pdo_sqlsrv > /dev/null 2>&1
printf "\033[32;1m✓ \033[0m\033[90;1mpecl install pdo_sqlsrv\n"
if (php -m | grep -i -q -w "pdo_sqlsrv"); then
printf "\033[32;1mpdo_sqlsrv installed correct\n"
else
printf "\033[31;1mpdo_sqlsrv not installed :-(\n"
fi
if: matrix.php == '7.4' || matrix.php == '7.3' || matrix.php == '7.2'
- name: Install Memcached
uses: niden/actions-memcached@v7
- name: Get composer cache directory
Expand All @@ -87,7 +61,7 @@ jobs:
- name: Install dependencies
run: composer update $DEFAULT_COMPOSER_FLAGS
- name: PHP Unit tests for PHP 7.1
run: vendor/bin/phpunit --verbose --coverage-clover=coverage.clover --exclude-group oci,wincache,xcache,zenddata,cubrid --colors=always
run: vendor/bin/phpunit --verbose --coverage-clover=coverage.clover --exclude-group $PHPUNIT_EXCLUDE_GROUP --colors=always
if: matrix.php == '7.1'
- name: PHP Unit tests for PHP >= 7.2
run: vendor/bin/phpunit --verbose --exclude-group $PHPUNIT_EXCLUDE_GROUP --colors=always
Expand Down
103 changes: 103 additions & 0 deletions .github/workflows/ci-mssql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
on:
- pull_request
- push

name: ci-mssql

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

env:
key: cache

runs-on: ubuntu-latest

strategy:
matrix:
include:
- php: '7.0'
extensions: pdo, pdo_sqlsrv-5.8.1
mssql: 'server:2017-latest'
- php: '7.1'
extensions: pdo, pdo_sqlsrv-5.8.1
mssql: 'server:2017-latest'
- 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: YourStrong!Passw0rd
ACCEPT_EULA: Y
MSSQL_PID: Developer
ports:
- 1433:1433
options: --name=mssql --health-cmd="/opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P 'YourStrong!Passw0rd' -Q 'SELECT 1'" --health-interval=10s --health-timeout=5s --health-retries=3

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

- name: Create MS SQL Database
run: docker exec -i mssql /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P 'YourStrong!Passw0rd' -Q 'CREATE DATABASE yiitest'

- 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: PHP Unit tests for PHP 7.1
run: vendor/bin/phpunit --coverage-clover=coverage.clover --group mssql --colors=always
if: matrix.php == '7.1'

- name: Run tests with phpunit without coverage
run: vendor/bin/phpunit --group mssql --colors=always

- name: Code coverage
run: |
wget https://scrutinizer-ci.com/ocular.phar
php ocular.phar code-coverage:upload --format=php-clover coverage.clover
if: matrix.php == '7.1'
continue-on-error: true # if is fork
12 changes: 11 additions & 1 deletion .github/workflows/ci-oracle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,16 @@ jobs:
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
- name: PHP Unit tests for PHP 7.4
run: vendor/bin/phpunit --coverage-clover=coverage.clover --group oci --colors=always
if: matrix.php == '7.4'

- name: Run tests with phpunit without coverage
run: vendor/bin/phpunit --group oci --colors=always

- name: Code coverage
run: |
wget https://scrutinizer-ci.com/ocular.phar
php ocular.phar code-coverage:upload --format=php-clover coverage.clover
if: matrix.php == '7.4'
continue-on-error: true # if is fork
1 change: 1 addition & 0 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ filter:

tools:
external_code_coverage:
runs: 3
timeout: 2100 # Timeout in seconds.

0 comments on commit 920fda1

Please sign in to comment.