From 138874f42acf74259e6be2b618cf7aa7ac429e02 Mon Sep 17 00:00:00 2001 From: Tigrov Date: Fri, 13 Sep 2024 12:53:03 +0700 Subject: [PATCH 1/6] Fix mssql tests --- .github/workflows/mssql.yml | 68 ++++++++++++++++++++----------------- 1 file changed, 36 insertions(+), 32 deletions(-) diff --git a/.github/workflows/mssql.yml b/.github/workflows/mssql.yml index c552c61..7736f5c 100644 --- a/.github/workflows/mssql.yml +++ b/.github/workflows/mssql.yml @@ -1,67 +1,72 @@ on: pull_request: - paths-ignore: - - 'docs/**' - - 'README.md' - - 'CHANGELOG.md' - - '.gitignore' - - '.gitattributes' - - 'infection.json.dist' - - 'psalm.xml' + paths: + - 'src/**' + - 'tests/**' + - '.github/workflows/mssql.yml' + - 'composer.json' + - 'phpunit.xml.dist' push: branches: ['master'] - paths-ignore: - - 'docs/**' - - 'README.md' - - 'CHANGELOG.md' - - '.gitignore' - - '.gitattributes' - - 'infection.json.dist' - - 'psalm.xml' + paths: + - 'src/**' + - 'tests/**' + - '.github/workflows/mssql.yml' + - 'composer.json' + - 'phpunit.xml.dist' name: mssql jobs: tests: - name: PHP ${{ matrix.php }}-mssql-${{ matrix.mssql }} + name: PHP ${{ matrix.php }} env: extensions: pdo, pdo_sqlsrv-5.11.1 + SA_PASSWORD: YourStrong!Passw0rd - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest strategy: matrix: - os: - - ubuntu-latest - php: - 8.1 - 8.2 - 8.3 mssql: - - server:2019-latest - - server:2022-latest + - server: 2022-latest + odbc-version: 18 + flag: "-C" + + include: + - php: 8.3 + mssql: + server: 2017-latest + - php: 8.3 + mssql: + server: 2019-latest + odbc-version: 18 + flag: "-C" services: mssql: - image: mcr.microsoft.com/mssql/${{ matrix.mssql }} + image: mcr.microsoft.com/mssql/server:${{ matrix.mssql.server }} env: - SA_PASSWORD: YourStrong!Passw0rd + SA_PASSWORD: ${{ env.SA_PASSWORD }} 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 + options: --name=mssql --health-cmd="/opt/mssql-tools${{ matrix.mssql.odbc-version }}/bin/sqlcmd ${{ matrix.mssql.flag }} -S localhost -U SA -P '${{ env.SA_PASSWORD }}' -Q 'SELECT 1'" --health-interval=10s --health-timeout=5s --health-retries=3 steps: - name: Checkout uses: actions/checkout@v3 - 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' + run: docker exec -i mssql /opt/mssql-tools${{ matrix.mssql.odbc-version }}/bin/sqlcmd ${{ matrix.mssql.flag }} -S localhost -U SA -P '${{ env.SA_PASSWORD }}' -Q 'CREATE DATABASE yiitest' - name: Install PHP with extensions uses: shivammathur/setup-php@v2 @@ -73,11 +78,10 @@ jobs: tools: composer:v2, pecl - 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@v3 + uses: actions/cache@v4 with: path: ${{ env.COMPOSER_CACHE_DIR }} key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }} @@ -94,17 +98,17 @@ jobs: run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi - name: Run tests with phpunit - run: vendor/bin/phpunit --testsuite Mssql --coverage-clover=coverage.xml --colors=always + run: vendor/bin/phpunit --testsuite=Mssql --coverage-clover=coverage.xml --colors=always env: ENVIRONMENT: ci YII_MSSQL_DATABASE: yiitest YII_MSSQL_HOST: 127.0.0.1 YII_MSSQL_PORT: 1433 YII_MSSQL_USER: SA - YII_MSSQL_PASSWORD: YourStrong!Passw0rd + YII_MSSQL_PASSWORD: ${{ env.SA_PASSWORD }} - name: Upload coverage to Codecov - if: matrix.os == 'ubuntu-latest' uses: codecov/codecov-action@v3 with: + token: ${{ secrets.CODECOV_TOKEN }} files: ./coverage.xml From 3c64f183a73c6f973990dc09d75400d2a2054203 Mon Sep 17 00:00:00 2001 From: Tigrov Date: Fri, 13 Sep 2024 12:54:53 +0700 Subject: [PATCH 2/6] Fix mssql tests --- .github/workflows/mssql.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/mssql.yml b/.github/workflows/mssql.yml index 7736f5c..e9f8a30 100644 --- a/.github/workflows/mssql.yml +++ b/.github/workflows/mssql.yml @@ -20,7 +20,7 @@ name: mssql jobs: tests: - name: PHP ${{ matrix.php }} + name: PHP ${{ matrix.php }}-mssql-${{ matrix.mssql }} env: extensions: pdo, pdo_sqlsrv-5.11.1 From f6dc43f2e902c83419f953479fa70d0ebca486d2 Mon Sep 17 00:00:00 2001 From: Tigrov Date: Fri, 13 Sep 2024 13:12:05 +0700 Subject: [PATCH 3/6] Fix mssql tests --- .github/workflows/mssql.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/mssql.yml b/.github/workflows/mssql.yml index e9f8a30..96576a6 100644 --- a/.github/workflows/mssql.yml +++ b/.github/workflows/mssql.yml @@ -59,7 +59,7 @@ jobs: MSSQL_PID: Developer ports: - 1433:1433 - options: --name=mssql --health-cmd="/opt/mssql-tools${{ matrix.mssql.odbc-version }}/bin/sqlcmd ${{ matrix.mssql.flag }} -S localhost -U SA -P '${{ env.SA_PASSWORD }}' -Q 'SELECT 1'" --health-interval=10s --health-timeout=5s --health-retries=3 + options: --name=mssql --health-cmd="/opt/mssql-tools${{ matrix.mssql.odbc-version }}/bin/sqlcmd ${{ matrix.mssql.flag }} -S localhost -U SA -P '${{ job.services.mssql.env.SA_PASSWORD }}' -Q 'SELECT 1'" --health-interval=10s --health-timeout=5s --health-retries=3 steps: - name: Checkout From 975fdfad0d4c96fcc86cd4ba5826a51b0b8d045e Mon Sep 17 00:00:00 2001 From: Tigrov Date: Fri, 13 Sep 2024 13:23:17 +0700 Subject: [PATCH 4/6] Fix mssql tests --- .github/workflows/mssql.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/mssql.yml b/.github/workflows/mssql.yml index 96576a6..29a3acb 100644 --- a/.github/workflows/mssql.yml +++ b/.github/workflows/mssql.yml @@ -59,7 +59,7 @@ jobs: MSSQL_PID: Developer ports: - 1433:1433 - options: --name=mssql --health-cmd="/opt/mssql-tools${{ matrix.mssql.odbc-version }}/bin/sqlcmd ${{ matrix.mssql.flag }} -S localhost -U SA -P '${{ job.services.mssql.env.SA_PASSWORD }}' -Q 'SELECT 1'" --health-interval=10s --health-timeout=5s --health-retries=3 + options: --name=mssql --health-cmd="/opt/mssql-tools${{ matrix.mssql.odbc-version }}/bin/sqlcmd ${{ matrix.mssql.flag }} -S localhost -U SA -P '${{ mssql.env.SA_PASSWORD }}' -Q 'SELECT 1'" --health-interval=10s --health-timeout=5s --health-retries=3 steps: - name: Checkout From b83e57994e37f6b7bca2ef3fca308eaac7815681 Mon Sep 17 00:00:00 2001 From: Tigrov Date: Fri, 13 Sep 2024 13:24:12 +0700 Subject: [PATCH 5/6] Fix mssql tests --- .github/workflows/mssql.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/mssql.yml b/.github/workflows/mssql.yml index 29a3acb..7e8dd75 100644 --- a/.github/workflows/mssql.yml +++ b/.github/workflows/mssql.yml @@ -59,7 +59,7 @@ jobs: MSSQL_PID: Developer ports: - 1433:1433 - options: --name=mssql --health-cmd="/opt/mssql-tools${{ matrix.mssql.odbc-version }}/bin/sqlcmd ${{ matrix.mssql.flag }} -S localhost -U SA -P '${{ mssql.env.SA_PASSWORD }}' -Q 'SELECT 1'" --health-interval=10s --health-timeout=5s --health-retries=3 + options: --name=mssql --health-cmd="/opt/mssql-tools${{ matrix.mssql.odbc-version }}/bin/sqlcmd ${{ matrix.mssql.flag }} -S localhost -U SA -P '${{ SA_PASSWORD }}' -Q 'SELECT 1'" --health-interval=10s --health-timeout=5s --health-retries=3 steps: - name: Checkout From aa7d3d585be905c8434a8bd2fa29058567622854 Mon Sep 17 00:00:00 2001 From: Tigrov Date: Fri, 13 Sep 2024 13:25:26 +0700 Subject: [PATCH 6/6] Fix mssql tests --- .github/workflows/mssql.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/mssql.yml b/.github/workflows/mssql.yml index 7e8dd75..c768adc 100644 --- a/.github/workflows/mssql.yml +++ b/.github/workflows/mssql.yml @@ -24,7 +24,6 @@ jobs: env: extensions: pdo, pdo_sqlsrv-5.11.1 - SA_PASSWORD: YourStrong!Passw0rd runs-on: ubuntu-latest @@ -54,19 +53,19 @@ jobs: mssql: image: mcr.microsoft.com/mssql/server:${{ matrix.mssql.server }} env: - SA_PASSWORD: ${{ env.SA_PASSWORD }} + SA_PASSWORD: YourStrong!Passw0rd ACCEPT_EULA: Y MSSQL_PID: Developer ports: - 1433:1433 - options: --name=mssql --health-cmd="/opt/mssql-tools${{ matrix.mssql.odbc-version }}/bin/sqlcmd ${{ matrix.mssql.flag }} -S localhost -U SA -P '${{ SA_PASSWORD }}' -Q 'SELECT 1'" --health-interval=10s --health-timeout=5s --health-retries=3 + options: --name=mssql --health-cmd="/opt/mssql-tools${{ matrix.mssql.odbc-version }}/bin/sqlcmd ${{ matrix.mssql.flag }} -S localhost -U SA -P 'YourStrong!Passw0rd' -Q 'SELECT 1'" --health-interval=10s --health-timeout=5s --health-retries=3 steps: - name: Checkout uses: actions/checkout@v3 - name: Create MS SQL Database - run: docker exec -i mssql /opt/mssql-tools${{ matrix.mssql.odbc-version }}/bin/sqlcmd ${{ matrix.mssql.flag }} -S localhost -U SA -P '${{ env.SA_PASSWORD }}' -Q 'CREATE DATABASE yiitest' + run: docker exec -i mssql /opt/mssql-tools${{ matrix.mssql.odbc-version }}/bin/sqlcmd ${{ matrix.mssql.flag }} -S localhost -U SA -P 'YourStrong!Passw0rd' -Q 'CREATE DATABASE yiitest' - name: Install PHP with extensions uses: shivammathur/setup-php@v2 @@ -105,7 +104,7 @@ jobs: YII_MSSQL_HOST: 127.0.0.1 YII_MSSQL_PORT: 1433 YII_MSSQL_USER: SA - YII_MSSQL_PASSWORD: ${{ env.SA_PASSWORD }} + YII_MSSQL_PASSWORD: YourStrong!Passw0rd - name: Upload coverage to Codecov uses: codecov/codecov-action@v3