mirror of
https://github.com/yiisoft/yii2.git
synced 2026-02-20 00:32:19 +01:00
Refactor ci-mssql.yml to use yiisoft/yii2-actions. (#20728)
This commit is contained in:
125
.github/workflows/ci-mssql.yml
vendored
125
.github/workflows/ci-mssql.yml
vendored
@@ -1,4 +1,3 @@
|
||||
---
|
||||
name: ci-mssql
|
||||
|
||||
permissions:
|
||||
@@ -35,93 +34,45 @@ on:
|
||||
|
||||
push: *ignore-paths
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
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
|
||||
|
||||
jobs:
|
||||
tests:
|
||||
name: PHP ${{ matrix.php }}-mssql-${{ matrix.mssql }}
|
||||
|
||||
env:
|
||||
COVERAGE_DRIVER: xdebug
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
php: [7.4, 8.5]
|
||||
mssql:
|
||||
- server:2019-latest
|
||||
- server:2022-latest
|
||||
|
||||
services: &mssql-service
|
||||
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-tools18/bin/sqlcmd -C -S localhost -U SA -P 'YourStrong!Passw0rd' -Q 'SELECT 1'"
|
||||
--health-interval=10s
|
||||
--health-retries=3
|
||||
--health-timeout=5s
|
||||
|
||||
steps: &mssql-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 /opt/mssql-tools18/bin/sqlcmd -C -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 }}
|
||||
name: MSSQL tests with coverage
|
||||
uses: yiisoft/yii2-actions/.github/workflows/database.yml@master
|
||||
with:
|
||||
concurrency-group: mssql-${{ github.ref }}
|
||||
coverage-driver: xdebug
|
||||
database-env: '{"SA_PASSWORD":"YourStrong!Passw0rd","ACCEPT_EULA":"Y","MSSQL_PID":"Developer"}'
|
||||
database-health-cmd: /opt/mssql-tools18/bin/sqlcmd -C -S localhost -U SA -P 'YourStrong!Passw0rd' -Q 'SELECT 1'
|
||||
database-image: mcr.microsoft.com/mssql/server
|
||||
database-port: "1433"
|
||||
database-type: mssql
|
||||
database-versions: '["2019-latest","2022-latest"]'
|
||||
extensions: curl, intl, pdo, pdo_sqlsrv
|
||||
hook: |
|
||||
sudo ACCEPT_EULA=Y apt-get install -y msodbcsql18
|
||||
docker exec -i database /opt/mssql-tools18/bin/sqlcmd -C -S localhost -U SA -P 'YourStrong!Passw0rd' -Q "IF DB_ID(N'yiitest') IS NULL CREATE DATABASE yiitest;"
|
||||
os: '["ubuntu-latest"]'
|
||||
php-version: '["7.4","8.5"]'
|
||||
phpunit-group: mssql
|
||||
secrets:
|
||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||
|
||||
tests-dev:
|
||||
name: PHP ${{ matrix.php }}-mssql-${{ matrix.mssql }}
|
||||
|
||||
env:
|
||||
COVERAGE_DRIVER: none
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
php: [8.0, 8.1, 8.2, 8.3, 8.4]
|
||||
mssql:
|
||||
- server:2022-latest
|
||||
|
||||
services: *mssql-service
|
||||
|
||||
steps: *mssql-steps
|
||||
name: MSSQL tests
|
||||
uses: yiisoft/yii2-actions/.github/workflows/database.yml@master
|
||||
with:
|
||||
concurrency-group: mssql-dev-${{ github.ref }}
|
||||
coverage-driver: none
|
||||
database-env: '{"SA_PASSWORD":"YourStrong!Passw0rd","ACCEPT_EULA":"Y","MSSQL_PID":"Developer"}'
|
||||
database-health-cmd: /opt/mssql-tools18/bin/sqlcmd -C -S localhost -U SA -P 'YourStrong!Passw0rd' -Q 'SELECT 1'
|
||||
database-image: mcr.microsoft.com/mssql/server
|
||||
database-port: "1433"
|
||||
database-type: mssql
|
||||
database-versions: '["2022-latest"]'
|
||||
extensions: curl, intl, pdo, pdo_sqlsrv
|
||||
hook: |
|
||||
sudo ACCEPT_EULA=Y apt-get install -y msodbcsql18
|
||||
docker exec -i database /opt/mssql-tools18/bin/sqlcmd -C -S localhost -U SA -P 'YourStrong!Passw0rd' -Q "IF DB_ID(N'yiitest') IS NULL CREATE DATABASE yiitest;"
|
||||
os: '["ubuntu-latest"]'
|
||||
php-version: '["8.0","8.1","8.2","8.3","8.4"]'
|
||||
phpunit-group: mssql
|
||||
|
||||
Reference in New Issue
Block a user