-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ad6daec
commit 920fda1
Showing
4 changed files
with
116 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,4 +16,5 @@ filter: | |
|
||
tools: | ||
external_code_coverage: | ||
runs: 3 | ||
timeout: 2100 # Timeout in seconds. |