Files
yii2/.github/workflows/ci-mssql.yml
2025-10-14 12:40:35 +03:00

114 lines
3.2 KiB
YAML

---
name: ci-mssql
permissions:
contents: read
pull-requests: write
on:
pull_request: &ignore-paths
paths-ignore:
- ".appveyor.yml"
- ".dockerignore"
- ".editorconfig"
- ".git-blame-ignore-revs"
- ".gitattributes"
- ".github/CONTRIBUTING.md"
- ".github/FUNDING.yml"
- ".github/ISSUE_TEMPLATE.md"
- ".github/PULL_REQUEST_TEMPLATE.md"
- ".github/SECURITY.md"
- ".gitignore"
- ".gitlab-ci.yml"
- "code-of-conduct.md"
- "docs/**"
- "framework/.gitignore"
- "framework/.phpstorm.meta.php"
- "framework/CHANGELOG.md"
- "framework/LICENSE.md"
- "framework/README.md"
- "framework/UPGRADE.md"
- "eslint.config.js"
- "LICENSE.md"
- "README.md"
- "ROADMAP.md"
push: *ignore-paths
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
tests:
name: PHP ${{ matrix.php }}-mssql-${{ matrix.mssql.version }}
env:
COVERAGE_DRIVER: ${{ matrix.php == 7.4 && 'xdebug' || 'none' }}
PHP_EXTENSIONS: curl, intl, pdo, pdo_sqlsrv
PHP_INI_VALUES: apc.enabled=1,apc.shm_size=32M,apc.enable_cli=1, date.timezone='UTC'
PHPUNIT_GROUP: mssql
XDEBUG_MODE: coverage
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: [7.4, 8.0, 8.1, 8.2, 8.3, 8.4]
mssql:
- version: server:2022-latest
mssql-tool: /opt/mssql-tools18/bin/sqlcmd -C
include:
- php: 8.0
mssql:
version: server:2019-latest
mssql-tool: /opt/mssql-tools18/bin/sqlcmd -C
services:
mssql:
image: mcr.microsoft.com/mssql/${{ matrix.mssql.version }}
env:
SA_PASSWORD: YourStrong!Passw0rd
ACCEPT_EULA: Y
MSSQL_PID: Developer
ports:
- 1433:1433
options: >-
--name=mssql
--health-cmd="${{ matrix.mssql.mssql-tool }} -S localhost -U SA -P 'YourStrong!Passw0rd' -Q 'SELECT 1'"
--health-interval=10s
--health-retries=3
--health-timeout=5s
steps:
- name: Monitor action permissions.
if: runner.os != 'Windows'
uses: GitHubSecurityLab/actions-permissions/monitor@v1
- name: Checkout.
uses: actions/checkout@v5
- name: Install ODBC driver.
run: sudo ACCEPT_EULA=Y apt-get install -y msodbcsql18
- name: Create MS SQL Database.
run: docker exec -i mssql ${{ matrix.mssql.mssql-tool }} -S localhost -U SA -P 'YourStrong!Passw0rd' -Q 'CREATE DATABASE yiitest'
- name: Setup PHP with Composer.
uses: ./.github/actions/php-setup
with:
coverage-driver: ${{ env.COVERAGE_DRIVER }}
extensions: ${{ matrix.php < 8.0 && 'apc' || 'apcu' }}, ${{ env.PHP_EXTENSIONS }}
ini-values: ${{ env.PHP_INI_VALUES }}, session.save_path="${{ runner.temp }}"
php-version: ${{ matrix.php }}
- name: Run PHPUnit tests.
uses: ./.github/actions/phpunit
with:
coverage-driver: ${{ env.COVERAGE_DRIVER }}
coverage-token: ${{ secrets.CODECOV_TOKEN }}
group: ${{ env.PHPUNIT_GROUP }}