From d6965ac9c4652b640cf6dd7cd1b0700923408d7c Mon Sep 17 00:00:00 2001 From: Tigrov Date: Tue, 26 Nov 2024 19:27:12 +0700 Subject: [PATCH 1/8] Update workflow --- .github/workflows/bc.yml | 26 ++--- .github/workflows/build.yml | 53 +++++++---- .../workflows/composer-require-checker.yml | 34 ++++--- .github/workflows/mariadb.yml | 94 ------------------- .github/workflows/mssql.yml | 67 ++++++------- .github/workflows/mutation.yml | 48 +++++----- .github/workflows/mysql.yml | 66 +++++++------ .github/workflows/oracle.yml | 74 ++++++++------- .github/workflows/pgsql.yml | 72 +++++++------- .github/workflows/rector.yml | 14 ++- .github/workflows/sqlite.yml | 63 ++++++++----- .github/workflows/static.yml | 80 ++++------------ psalm.xml | 4 - 13 files changed, 292 insertions(+), 403 deletions(-) diff --git a/.github/workflows/bc.yml b/.github/workflows/bc.yml index 85232cc3..902c5d33 100644 --- a/.github/workflows/bc.yml +++ b/.github/workflows/bc.yml @@ -1,25 +1,15 @@ on: pull_request: - paths-ignore: - - 'docs/**' - - 'README.md' - - 'CHANGELOG.md' - - '.gitignore' - - '.gitattributes' - - 'infection.json.dist' - - 'phpunit.xml.dist' - - 'psalm.xml' + paths: + - 'src/**' + - '.github/workflows/bc.yml' + - 'composer.json' push: branches: ['master'] - paths-ignore: - - 'docs/**' - - 'README.md' - - 'CHANGELOG.md' - - '.gitignore' - - '.gitattributes' - - 'infection.json.dist' - - 'phpunit.xml.dist' - - 'psalm.xml' + paths: + - 'src/**' + - '.github/workflows/bc.yml' + - 'composer.json' name: backwards compatibility diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3c2fd2be..b1d87728 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,24 +1,26 @@ on: pull_request: - paths-ignore: - - 'docs/**' - - 'README.md' - - 'CHANGELOG.md' - - '.gitignore' - - '.gitattributes' - - 'infection.json.dist' - - 'psalm.xml' + paths: + - 'bin/**' + - 'config/**' + - 'resources/**' + - 'src/**' + - 'tests/**' + - '.github/workflows/build.yml' + - 'composer.json' + - 'phpunit.xml.dist' push: branches: ['master'] - paths-ignore: - - 'docs/**' - - 'README.md' - - 'CHANGELOG.md' - - '.gitignore' - - '.gitattributes' - - 'infection.json.dist' - - 'psalm.xml' + paths: + - 'bin/**' + - 'config/**' + - 'resources/**' + - 'src/**' + - 'tests/**' + - '.github/workflows/build.yml' + - 'composer.json' + - 'phpunit.xml.dist' name: build @@ -30,6 +32,9 @@ jobs: tests: name: PHP ${{ matrix.php }}-${{ matrix.os }} + env: + COMPOSER_ROOT_VERSION: dev-master + runs-on: ${{ matrix.os }} strategy: @@ -44,7 +49,7 @@ jobs: steps: - name: Checkout. - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Install PHP with extensions. uses: shivammathur/setup-php@v2 @@ -52,20 +57,28 @@ jobs: php-version: ${{ matrix.php }} ini-values: date.timezone='UTC', pcov.directory=$GITHUB_WORKSPACE, pcov.exclude=#^(?!($GITHUB_WORKSPACE/config/|$GITHUB_WORKSPACE/src/)).*# coverage: pcov - tools: composer:v2 - name: Update composer. run: composer self-update + - name: Set environment variables pull request linux. + uses: yiisoft/actions/db/environment-linux@master + - name: Install db-sqlite. - run: composer require yiisoft/db-sqlite:^1.0 --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi + uses: yiisoft/actions/db/subpackage-install@master + with: + BRANCH_NAME: ${{ env.BRANCH_NAME }} + COMPOSER_ROOT_VERSION: ${{ env.COMPOSER_ROOT_VERSION }} + CURRENT_PACKAGE: db-sqlite + FULL_BRANCH_NAME: ${{ env.FULL_BRANCH_NAME }} + WORK_PACKAGE_URL: ${{ env.WORK_PACKAGE_URL }} - name: Run tests with phpunit. run: vendor/bin/phpunit --testsuite=Migration --coverage-clover=coverage.xml --colors=always - name: Upload coverage to Codecov. if: matrix.php == '8.3' - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v5 with: token: ${{ secrets.CODECOV_TOKEN }} files: ./coverage.xml diff --git a/.github/workflows/composer-require-checker.yml b/.github/workflows/composer-require-checker.yml index a857bce6..2928840c 100644 --- a/.github/workflows/composer-require-checker.yml +++ b/.github/workflows/composer-require-checker.yml @@ -1,26 +1,24 @@ on: pull_request: - paths-ignore: - - 'docs/**' - - 'README.md' - - 'CHANGELOG.md' - - '.gitignore' - - '.gitattributes' - - 'infection.json.dist' - - 'phpunit.xml.dist' - - 'psalm.xml' + paths: + - 'bin/**' + - 'config/**' + - 'resources/**' + - 'src/**' + - '.github/workflows/composer-require-checker.yml' + - 'composer.json' + - 'composer-require-checker.json' push: branches: ['master'] - paths-ignore: - - 'docs/**' - - 'README.md' - - 'CHANGELOG.md' - - '.gitignore' - - '.gitattributes' - - 'infection.json.dist' - - 'phpunit.xml.dist' - - 'psalm.xml' + paths: + - 'bin/**' + - 'config/**' + - 'resources/**' + - 'src/**' + - '.github/workflows/composer-require-checker.yml' + - 'composer.json' + - 'composer-require-checker.json' name: Composer require checker diff --git a/.github/workflows/mariadb.yml b/.github/workflows/mariadb.yml index 234b7248..e69de29b 100644 --- a/.github/workflows/mariadb.yml +++ b/.github/workflows/mariadb.yml @@ -1,94 +0,0 @@ -on: - pull_request: - paths-ignore: - - 'docs/**' - - 'README.md' - - 'CHANGELOG.md' - - '.gitignore' - - '.gitattributes' - - 'infection.json.dist' - - 'psalm.xml' - - push: - branches: ['master'] - paths-ignore: - - 'docs/**' - - 'README.md' - - 'CHANGELOG.md' - - '.gitignore' - - '.gitattributes' - - 'infection.json.dist' - - 'psalm.xml' - -name: mariadb - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - tests: - name: PHP ${{ matrix.php }}-${{ matrix.mariadb }} - - env: - extensions: pdo, pdo_mysql - - runs-on: ${{ matrix.os }} - - strategy: - matrix: - os: - - ubuntu-latest - - php: - - '8.1' - - '8.2' - - '8.3' - - mariadb: - - mariadb:10.4 - - mariadb:10.5 - - mariadb:10.6 - - mariadb:10.7 - - mariadb:10.8 - - mariadb:10.9 - - mariadb:latest - - services: - mariadb: - image: ${{ matrix.mariadb }} - env: - MYSQL_ALLOW_EMPTY_PASSWORD: true - MYSQL_PASSWORD: '' - MYSQL_DATABASE: yiitest - ports: - - 3306:3306 - options: --health-cmd="mariadb-admin ping" --health-interval=10s --health-timeout=5s --health-retries=3 - - steps: - - name: Checkout. - uses: actions/checkout@v3 - - - name: Install PHP with extensions. - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php }} - extensions: ${{ env.extensions }} - ini-values: date.timezone='UTC' - coverage: pcov - - - name: Update composer. - run: composer self-update - - - name: Install db-mysql. - run: composer require yiisoft/db-mysql:^1.0 --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi - - - name: Run tests with phpunit. - run: vendor/bin/phpunit --testsuite=Mysql --coverage-clover=coverage.xml --colors=always - - - name: Upload coverage to Codecov. - if: matrix.php == '8.3' - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: ./coverage.xml diff --git a/.github/workflows/mssql.yml b/.github/workflows/mssql.yml index 447158ee..0a70b043 100644 --- a/.github/workflows/mssql.yml +++ b/.github/workflows/mssql.yml @@ -1,24 +1,22 @@ on: pull_request: - paths-ignore: - - 'docs/**' - - 'README.md' - - 'CHANGELOG.md' - - '.gitignore' - - '.gitattributes' - - 'infection.json.dist' - - 'psalm.xml' + paths: + - 'resources/**' + - '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: + - 'resources/**' + - 'src/**' + - 'tests/**' + - '.github/workflows/mssql.yml' + - 'composer.json' + - 'phpunit.xml.dist' name: mssql @@ -31,27 +29,21 @@ jobs: name: PHP ${{ matrix.php }}-mssql-${{ matrix.mssql }} env: + COMPOSER_ROOT_VERSION: dev-master extensions: pdo, pdo_sqlsrv - 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 + - 8.1 + - 8.2 + - 8.3 services: mssql: - image: mcr.microsoft.com/mssql/${{ matrix.mssql }} + image: mcr.microsoft.com/mssql/server:2022-latest env: SA_PASSWORD: YourStrong!Passw0rd ACCEPT_EULA: Y @@ -67,7 +59,7 @@ jobs: sudo ACCEPT_EULA=Y apt-get install -y msodbcsql18 - name: Checkout. - uses: actions/checkout@v3 + uses: actions/checkout@v4 - 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' @@ -79,20 +71,31 @@ jobs: extensions: ${{ env.extensions }} ini-values: date.timezone='UTC' coverage: pcov - tools: composer:v2, pecl - name: Update composer. run: composer self-update + - name: Set environment variables pull request linux. + uses: yiisoft/actions/db/environment-linux@master + - name: Install db-mssql. - run: composer require yiisoft/db-mssql:^1.0 --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi + uses: yiisoft/actions/db/subpackage-install@master + with: + BRANCH_NAME: ${{ env.BRANCH_NAME }} + COMPOSER_ROOT_VERSION: ${{ env.COMPOSER_ROOT_VERSION }} + CURRENT_PACKAGE: db-mssql + FULL_BRANCH_NAME: ${{ env.FULL_BRANCH_NAME }} + WORK_PACKAGE_URL: ${{ env.WORK_PACKAGE_URL }} + + - name: Install dependencies with composer. + 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 - name: Upload coverage to Codecov. if: matrix.php == '8.3' - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v5 with: token: ${{ secrets.CODECOV_TOKEN }} files: ./coverage.xml diff --git a/.github/workflows/mutation.yml b/.github/workflows/mutation.yml index c4dc4f86..c051837e 100644 --- a/.github/workflows/mutation.yml +++ b/.github/workflows/mutation.yml @@ -1,23 +1,18 @@ on: pull_request: - paths-ignore: - - 'docs/**' - - 'README.md' - - 'CHANGELOG.md' - - '.gitignore' - - '.gitattributes' - - 'psalm.xml' + paths: + - 'src/**' + - '.github/workflows/mutation.yml' + - 'composer.json' + - 'infection.json.dist' push: - branches: - - master - paths-ignore: - - 'docs/**' - - 'README.md' - - 'CHANGELOG.md' - - '.gitignore' - - '.gitattributes' - - 'psalm.xml' + branches: ['master'] + paths: + - 'src/**' + - '.github/workflows/mutation.yml' + - 'composer.json' + - 'infection.json.dist' name: mutation test @@ -44,7 +39,7 @@ jobs: services: postgres: - image: postgres:15 + image: postgres:16 env: POSTGRES_USER: root POSTGRES_PASSWORD: root @@ -55,7 +50,7 @@ jobs: steps: - name: Checkout. - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install PHP. uses: shivammathur/setup-php@v2 @@ -64,13 +59,24 @@ jobs: extensions: ${{ env.extensions }} ini-values: date.timezone='UTC' coverage: pcov - tools: composer:v2 - name: Update composer. run: composer self-update - - name: Install dependencies. - run: composer require yiisoft/db-pgsql:^1.1 yiisoft/db-sqlite:^1.0 --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi + - name: Set environment variables pull request linux. + uses: yiisoft/actions/db/environment-linux@master + + - name: Install db-pgsql. + uses: yiisoft/actions/db/subpackage-install@master + with: + BRANCH_NAME: ${{ env.BRANCH_NAME }} + COMPOSER_ROOT_VERSION: ${{ env.COMPOSER_ROOT_VERSION }} + CURRENT_PACKAGE: db-pgsql + FULL_BRANCH_NAME: ${{ env.FULL_BRANCH_NAME }} + WORK_PACKAGE_URL: ${{ env.WORK_PACKAGE_URL }} + + - name: Install dependencies with composer. + run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi - name: Run infection. run: | diff --git a/.github/workflows/mysql.yml b/.github/workflows/mysql.yml index ce54cc21..a38951d4 100644 --- a/.github/workflows/mysql.yml +++ b/.github/workflows/mysql.yml @@ -1,24 +1,22 @@ on: pull_request: - paths-ignore: - - 'docs/**' - - 'README.md' - - 'CHANGELOG.md' - - '.gitignore' - - '.gitattributes' - - 'infection.json.dist' - - 'psalm.xml' + paths: + - 'resources/**' + - 'src/**' + - 'tests/**' + - '.github/workflows/mysql.yml' + - 'composer.json' + - 'phpunit.xml.dist' push: branches: ['master'] - paths-ignore: - - 'docs/**' - - 'README.md' - - 'CHANGELOG.md' - - '.gitignore' - - '.gitattributes' - - 'infection.json.dist' - - 'psalm.xml' + paths: + - 'resources/**' + - 'src/**' + - 'tests/**' + - '.github/workflows/mysql.yml' + - 'composer.json' + - 'phpunit.xml.dist' name: mysql @@ -31,27 +29,21 @@ jobs: name: PHP ${{ matrix.php }}-${{ matrix.mysql }} env: + COMPOSER_ROOT_VERSION: dev-master extensions: pdo, pdo_mysql - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest strategy: matrix: - os: - - ubuntu-latest - php: - - '8.1' - - '8.2' - - '8.3' - - mysql: - - mysql:5.7 - - mysql:latest + - 8.1 + - 8.2 + - 8.3 services: mysql: - image: ${{ matrix.mysql }} + image: mysql:latest env: MYSQL_ALLOW_EMPTY_PASSWORD: true MYSQL_PASSWORD: '' @@ -62,7 +54,7 @@ jobs: steps: - name: Checkout. - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install PHP with extensions. uses: shivammathur/setup-php@v2 @@ -75,15 +67,27 @@ jobs: - name: Update composer. run: composer self-update + - name: Set environment variables pull request linux. + uses: yiisoft/actions/db/environment-linux@master + - name: Install db-mysql. - run: composer require yiisoft/db-mysql:^1.0 --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi + uses: yiisoft/actions/db/subpackage-install@master + with: + BRANCH_NAME: ${{ env.BRANCH_NAME }} + COMPOSER_ROOT_VERSION: ${{ env.COMPOSER_ROOT_VERSION }} + CURRENT_PACKAGE: db-mysql + FULL_BRANCH_NAME: ${{ env.FULL_BRANCH_NAME }} + WORK_PACKAGE_URL: ${{ env.WORK_PACKAGE_URL }} + + - name: Install dependencies with composer. + run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi - name: Run tests with phpunit. run: vendor/bin/phpunit --testsuite=Mysql --coverage-clover=coverage.xml --colors=always - name: Upload coverage to Codecov. if: matrix.php == '8.3' - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v5 with: token: ${{ secrets.CODECOV_TOKEN }} files: ./coverage.xml diff --git a/.github/workflows/oracle.yml b/.github/workflows/oracle.yml index 84cec14e..a84798ae 100644 --- a/.github/workflows/oracle.yml +++ b/.github/workflows/oracle.yml @@ -1,24 +1,22 @@ on: pull_request: - paths-ignore: - - 'docs/**' - - 'README.md' - - 'CHANGELOG.md' - - '.gitignore' - - '.gitattributes' - - 'infection.json.dist' - - 'psalm.xml' + paths: + - 'resources/**' + - 'src/**' + - 'tests/**' + - '.github/workflows/oracle.yml' + - 'composer.json' + - 'phpunit.xml.dist' push: branches: ['master'] - paths-ignore: - - 'docs/**' - - 'README.md' - - 'CHANGELOG.md' - - '.gitignore' - - '.gitattributes' - - 'infection.json.dist' - - 'psalm.xml' + paths: + - 'resources/**' + - 'src/**' + - 'tests/**' + - '.github/workflows/oracle.yml' + - 'composer.json' + - 'phpunit.xml.dist' name: oracle @@ -31,26 +29,21 @@ jobs: name: PHP ${{ matrix.php }}-${{ matrix.oracle }} env: - EXTENSIONS: pdo, pdo_oci + COMPOSER_ROOT_VERSION: dev-master + extensions: pdo, pdo_oci - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest strategy: matrix: - os: - - ubuntu-latest - php: - - '8.1' - - '8.2' - - '8.3' - - oracle: - - 21 + - 8.1 + - 8.2 + - 8.3 services: oci: - image: gvenzl/oracle-xe:${{ matrix.oracle }} + image: gvenzl/oracle-xe:latest ports: - 1521:1521 env: @@ -65,29 +58,40 @@ jobs: steps: - name: Checkout. - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install PHP with extensions. uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php }} - extensions: ${{ env.EXTENSIONS }} + extensions: ${{ env.extensions }} ini-values: date.timezone='UTC' coverage: pcov - tools: composer:v2, pecl - name: Update composer. run: composer self-update + - name: Set environment variables pull request linux. + uses: yiisoft/actions/db/environment-linux@master + - name: Install db-oracle. - run: composer require yiisoft/db-oracle:^1.1 --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi + uses: yiisoft/actions/db/subpackage-install@master + with: + BRANCH_NAME: ${{ env.BRANCH_NAME }} + COMPOSER_ROOT_VERSION: ${{ env.COMPOSER_ROOT_VERSION }} + CURRENT_PACKAGE: db-oracle + FULL_BRANCH_NAME: ${{ env.FULL_BRANCH_NAME }} + WORK_PACKAGE_URL: ${{ env.WORK_PACKAGE_URL }} + + - name: Install dependencies with composer. + run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi - - name: Run oracle tests with phpunit and code coverage. - run: vendor/bin/phpunit --testsuite Oracle --coverage-clover=coverage.xml --colors=always + - name: Run tests with phpunit. + run: vendor/bin/phpunit --testsuite=Oracle --coverage-clover=coverage.xml --colors=always - name: Upload coverage to Codecov. if: matrix.php == '8.3' - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v5 with: token: ${{ secrets.CODECOV_TOKEN }} files: ./coverage.xml diff --git a/.github/workflows/pgsql.yml b/.github/workflows/pgsql.yml index 94227c95..b8683a37 100644 --- a/.github/workflows/pgsql.yml +++ b/.github/workflows/pgsql.yml @@ -1,24 +1,22 @@ on: pull_request: - paths-ignore: - - 'docs/**' - - 'README.md' - - 'CHANGELOG.md' - - '.gitignore' - - '.gitattributes' - - 'infection.json.dist' - - 'psalm.xml' + paths: + - 'resources/**' + - 'src/**' + - 'tests/**' + - '.github/workflows/pgsql.yml' + - 'composer.json' + - 'phpunit.xml.dist' push: branches: ['master'] - paths-ignore: - - 'docs/**' - - 'README.md' - - 'CHANGELOG.md' - - '.gitignore' - - '.gitattributes' - - 'infection.json.dist' - - 'psalm.xml' + paths: + - 'resources/**' + - 'src/**' + - 'tests/**' + - '.github/workflows/pgsql.yml' + - 'composer.json' + - 'phpunit.xml.dist' name: pgsql @@ -31,32 +29,21 @@ jobs: name: PHP ${{ matrix.php }}-pgsql-${{ matrix.pgsql }} env: + COMPOSER_ROOT_VERSION: dev-master extensions: pdo, pdo_pgsql - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest strategy: matrix: - os: - - ubuntu-latest - php: - - '8.1' - - '8.2' - - '8.3' - - pgsql: - - 9 - - 10 - - 11 - - 12 - - 13 - - 14 - - 15 + - 8.1 + - 8.2 + - 8.3 services: postgres: - image: postgres:${{ matrix.pgsql }} + image: postgres:16 env: POSTGRES_USER: root POSTGRES_PASSWORD: root @@ -67,7 +54,7 @@ jobs: steps: - name: Checkout. - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install PHP with extensions. uses: shivammathur/setup-php@v2 @@ -76,20 +63,31 @@ jobs: extensions: ${{ env.extensions }} ini-values: date.timezone='UTC' coverage: pcov - tools: composer:v2 - name: Update composer. run: composer self-update + - name: Set environment variables pull request linux. + uses: yiisoft/actions/db/environment-linux@master + - name: Install db-pgsql. - run: composer require yiisoft/db-pgsql:^1.1 --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi + uses: yiisoft/actions/db/subpackage-install@master + with: + BRANCH_NAME: ${{ env.BRANCH_NAME }} + COMPOSER_ROOT_VERSION: ${{ env.COMPOSER_ROOT_VERSION }} + CURRENT_PACKAGE: db-pgsql + FULL_BRANCH_NAME: ${{ env.FULL_BRANCH_NAME }} + WORK_PACKAGE_URL: ${{ env.WORK_PACKAGE_URL }} + + - name: Install dependencies with composer. + run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi - name: Run tests with phpunit. run: vendor/bin/phpunit --testsuite=Pgsql --coverage-clover=coverage.xml --colors=always - name: Upload coverage to Codecov. if: matrix.php == '8.3' - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v5 with: token: ${{ secrets.CODECOV_TOKEN }} files: ./coverage.xml diff --git a/.github/workflows/rector.yml b/.github/workflows/rector.yml index 35411d0a..5fb961be 100644 --- a/.github/workflows/rector.yml +++ b/.github/workflows/rector.yml @@ -1,13 +1,11 @@ on: pull_request: - paths-ignore: - - 'docs/**' - - 'README.md' - - 'CHANGELOG.md' - - '.gitignore' - - '.gitattributes' - - 'infection.json.dist' - - 'psalm.xml' + paths: + - 'src/**' + - 'tests/**' + - '.github/workflows/rector.yml' + - 'composer.json' + - 'rector.php' name: rector diff --git a/.github/workflows/sqlite.yml b/.github/workflows/sqlite.yml index 55f98823..8244423a 100644 --- a/.github/workflows/sqlite.yml +++ b/.github/workflows/sqlite.yml @@ -1,24 +1,22 @@ on: pull_request: - paths-ignore: - - 'docs/**' - - 'README.md' - - 'CHANGELOG.md' - - '.gitignore' - - '.gitattributes' - - 'infection.json.dist' - - 'psalm.xml' + paths: + - 'resources/**' + - 'src/**' + - 'tests/**' + - '.github/workflows/sqlite.yml' + - 'composer.json' + - 'phpunit.xml.dist' push: branches: ['master'] - paths-ignore: - - 'docs/**' - - 'README.md' - - 'CHANGELOG.md' - - '.gitignore' - - '.gitattributes' - - 'infection.json.dist' - - 'psalm.xml' + paths: + - 'resources/**' + - 'src/**' + - 'tests/**' + - '.github/workflows/sqlite.yml' + - 'composer.json' + - 'phpunit.xml.dist' name: sqlite @@ -28,9 +26,10 @@ concurrency: jobs: tests: - name: PHP ${{ matrix.php }}-${{ matrix.os }} + name: PHP ${{ matrix.php }}-sqlite-${{ matrix.os }} env: + COMPOSER_ROOT_VERSION: dev-master extensions: pdo, pdo_sqlite runs-on: ${{ matrix.os }} @@ -42,13 +41,13 @@ jobs: - windows-latest php: - - '8.1' - - '8.2' - - '8.3' + - 8.1 + - 8.2 + - 8.3 steps: - name: Checkout. - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Install PHP with extensions. uses: shivammathur/setup-php@v2 @@ -57,20 +56,36 @@ jobs: extensions: ${{ env.extensions }} ini-values: date.timezone='UTC' coverage: pcov - tools: composer:v2 - name: Update composer. run: composer self-update + - name: Set environment variables pull request linux. + if: matrix.os == 'ubuntu-latest' + uses: yiisoft/actions/db/environment-linux@master + + - name: Set environment variables pull request windows. + if: matrix.os == 'windows-latest' + uses: yiisoft/actions/db/environment-windows@master + - name: Install db-sqlite. - run: composer require yiisoft/db-sqlite:^1.0 --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi + uses: yiisoft/actions/db/subpackage-install@master + with: + BRANCH_NAME: ${{ env.BRANCH_NAME }} + COMPOSER_ROOT_VERSION: ${{ env.COMPOSER_ROOT_VERSION }} + CURRENT_PACKAGE: db-sqlite + FULL_BRANCH_NAME: ${{ env.FULL_BRANCH_NAME }} + WORK_PACKAGE_URL: ${{ env.WORK_PACKAGE_URL }} + + - name: Install dependencies with composer. + run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi - name: Run tests with phpunit. run: vendor/bin/phpunit --testsuite=Sqlite --coverage-clover=coverage.xml --colors=always - name: Upload coverage to Codecov. if: matrix.php == '8.3' - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v5 with: token: ${{ secrets.CODECOV_TOKEN }} files: ./coverage.xml diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml index 9c9b94f9..20297a49 100644 --- a/.github/workflows/static.yml +++ b/.github/workflows/static.yml @@ -1,70 +1,28 @@ on: pull_request: - paths-ignore: - - 'docs/**' - - 'README.md' - - 'CHANGELOG.md' - - '.gitignore' - - '.gitattributes' - - 'infection.json.dist' - - 'phpunit.xml.dist' + paths: + - 'bin/**' + - 'src/**' + - '.github/workflows/static.yml' + - 'psalm*.xml' + - 'composer.json' push: branches: ['master'] - paths-ignore: - - 'docs/**' - - 'README.md' - - 'CHANGELOG.md' - - '.gitignore' - - '.gitattributes' - - 'infection.json.dist' - - 'phpunit.xml.dist' + paths: + - 'bin/**' + - 'src/**' + - '.github/workflows/static.yml' + - 'psalm*.xml' + - 'composer.json' name: static analysis jobs: - mutation: - name: PHP ${{ matrix.php }}-${{ matrix.os }} - - runs-on: ${{ matrix.os }} - - strategy: - matrix: - os: - - ubuntu-latest - - php: - - '8.1' - - '8.2' - - '8.3' - - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Install PHP - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php }} - tools: composer:v2, cs2pr - coverage: pcov - - - name: Determine composer cache directory - 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: Static analysis - run: vendor/bin/psalm --shepherd --stats --output-format=checkstyle --php-version=${{ matrix.php }} | cs2pr --graceful-warnings --colorize + psalm: + uses: yiisoft/actions/.github/workflows/psalm.yml@master + with: + os: >- + ['ubuntu-latest'] + php: >- + ['8.1', '8.2', '8.3'] diff --git a/psalm.xml b/psalm.xml index fb64a3a4..7bf8621f 100644 --- a/psalm.xml +++ b/psalm.xml @@ -10,10 +10,6 @@ - - - - From fae7d34a22c02f9d02b143db3dc164d8a8442a29 Mon Sep 17 00:00:00 2001 From: Tigrov Date: Tue, 26 Nov 2024 20:11:28 +0700 Subject: [PATCH 2/8] Update --- .github/workflows/build.yml | 13 +++++-------- .github/workflows/mariadb.yml | 0 .github/workflows/mssql.yml | 2 +- .github/workflows/mutation.yml | 7 ++----- .github/workflows/mysql.yml | 2 +- .github/workflows/oracle.yml | 2 +- .github/workflows/pgsql.yml | 2 +- 7 files changed, 11 insertions(+), 17 deletions(-) delete mode 100644 .github/workflows/mariadb.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b1d87728..fe73189f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -30,22 +30,19 @@ concurrency: jobs: tests: - name: PHP ${{ matrix.php }}-${{ matrix.os }} + name: PHP ${{ matrix.php }} env: COMPOSER_ROOT_VERSION: dev-master - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest strategy: matrix: - os: - - ubuntu-latest - php: - - '8.1' - - '8.2' - - '8.3' + - 8.1 + - 8.2 + - 8.3 steps: - name: Checkout. diff --git a/.github/workflows/mariadb.yml b/.github/workflows/mariadb.yml deleted file mode 100644 index e69de29b..00000000 diff --git a/.github/workflows/mssql.yml b/.github/workflows/mssql.yml index 0a70b043..c529c53a 100644 --- a/.github/workflows/mssql.yml +++ b/.github/workflows/mssql.yml @@ -26,7 +26,7 @@ concurrency: jobs: tests: - name: PHP ${{ matrix.php }}-mssql-${{ matrix.mssql }} + name: PHP ${{ matrix.php }}-mssql env: COMPOSER_ROOT_VERSION: dev-master diff --git a/.github/workflows/mutation.yml b/.github/workflows/mutation.yml index c051837e..d5d4707a 100644 --- a/.github/workflows/mutation.yml +++ b/.github/workflows/mutation.yml @@ -22,18 +22,15 @@ concurrency: jobs: mutation: - name: PHP ${{ matrix.php }}-${{ matrix.os }} + name: PHP ${{ matrix.php }} env: extensions: pdo, pdo_pgsql, pdo_sqlite - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest strategy: matrix: - os: - - ubuntu-latest - php: - 8.3 diff --git a/.github/workflows/mysql.yml b/.github/workflows/mysql.yml index a38951d4..98ab01d9 100644 --- a/.github/workflows/mysql.yml +++ b/.github/workflows/mysql.yml @@ -26,7 +26,7 @@ concurrency: jobs: tests: - name: PHP ${{ matrix.php }}-${{ matrix.mysql }} + name: PHP ${{ matrix.php }} env: COMPOSER_ROOT_VERSION: dev-master diff --git a/.github/workflows/oracle.yml b/.github/workflows/oracle.yml index a84798ae..8c1c10dc 100644 --- a/.github/workflows/oracle.yml +++ b/.github/workflows/oracle.yml @@ -26,7 +26,7 @@ concurrency: jobs: tests: - name: PHP ${{ matrix.php }}-${{ matrix.oracle }} + name: PHP ${{ matrix.php }} env: COMPOSER_ROOT_VERSION: dev-master diff --git a/.github/workflows/pgsql.yml b/.github/workflows/pgsql.yml index b8683a37..723576ed 100644 --- a/.github/workflows/pgsql.yml +++ b/.github/workflows/pgsql.yml @@ -26,7 +26,7 @@ concurrency: jobs: tests: - name: PHP ${{ matrix.php }}-pgsql-${{ matrix.pgsql }} + name: PHP ${{ matrix.php }}-pgsql env: COMPOSER_ROOT_VERSION: dev-master From 80b951d32f81621752d8e15fc55a960a9454c26c Mon Sep 17 00:00:00 2001 From: Tigrov Date: Wed, 27 Nov 2024 09:44:43 +0700 Subject: [PATCH 3/8] Change `yiisoft/db` to `dev-master` --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 3fdbea33..2ab2a1b4 100644 --- a/composer.json +++ b/composer.json @@ -34,7 +34,7 @@ "php": "^8.1", "ext-filter": "*", "symfony/console": "^6.0|^7.0", - "yiisoft/db": "^1.3", + "yiisoft/db": "dev-master", "yiisoft/injector": "^1.2" }, "require-dev": { @@ -44,7 +44,7 @@ "roave/infection-static-analysis-plugin": "^1.35", "spatie/phpunit-watcher": "^1.23", "vimeo/psalm": "^5.25", - "yiisoft/db-sqlite": "^1.1", + "yiisoft/db-sqlite": "dev-master", "yiisoft/di": "^1.2", "yiisoft/files": "^2.0", "yiisoft/test-support": "^3.0", From f7b9c32225351f797e50ede4aa2705e9f6451122 Mon Sep 17 00:00:00 2001 From: Tigrov Date: Wed, 27 Nov 2024 09:58:05 +0700 Subject: [PATCH 4/8] Fix psalm --- src/AbstractMigrationBuilder.php | 50 +++++++++++++++++--------------- src/MigrationBuilder.php | 6 ++-- 2 files changed, 30 insertions(+), 26 deletions(-) diff --git a/src/AbstractMigrationBuilder.php b/src/AbstractMigrationBuilder.php index 3634138a..f24b2c14 100644 --- a/src/AbstractMigrationBuilder.php +++ b/src/AbstractMigrationBuilder.php @@ -4,6 +4,8 @@ namespace Yiisoft\Db\Migration; +use Yiisoft\Db\Constant\ColumnType; +use Yiisoft\Db\Constant\PseudoType; use Yiisoft\Db\Schema\Builder\ColumnInterface; use Yiisoft\Db\Schema\SchemaInterface; @@ -30,6 +32,8 @@ * ], * ); * ``` + * + * @psalm-suppress DeprecatedMethod */ abstract class AbstractMigrationBuilder { @@ -48,7 +52,7 @@ public function __construct(private SchemaInterface $schema) */ public function bigInteger(int $length = null): ColumnInterface { - return $this->schema->createColumn(SchemaInterface::TYPE_BIGINT, $length); + return $this->schema->createColumn(ColumnType::BIGINT, $length); } /** @@ -62,7 +66,7 @@ public function bigInteger(int $length = null): ColumnInterface */ public function bigPrimaryKey(int $length = null): ColumnInterface { - return $this->schema->createColumn(SchemaInterface::TYPE_BIGPK, $length); + return $this->schema->createColumn(PseudoType::BIGPK, $length); } /** @@ -74,7 +78,7 @@ public function bigPrimaryKey(int $length = null): ColumnInterface */ public function uuidPrimaryKey(): ColumnInterface { - return $this->schema->createColumn(SchemaInterface::TYPE_UUID_PK); + return $this->schema->createColumn(PseudoType::UUID_PK); } /** @@ -86,7 +90,7 @@ public function uuidPrimaryKey(): ColumnInterface */ public function uuidPrimaryKeySequenced(): ColumnInterface { - return $this->schema->createColumn(SchemaInterface::TYPE_UUID_PK_SEQ); + return $this->schema->createColumn(PseudoType::UUID_PK_SEQ); } /** @@ -98,7 +102,7 @@ public function uuidPrimaryKeySequenced(): ColumnInterface */ public function uuid(): ColumnInterface { - return $this->schema->createColumn(SchemaInterface::TYPE_UUID); + return $this->schema->createColumn(ColumnType::UUID); } /** @@ -112,7 +116,7 @@ public function uuid(): ColumnInterface */ public function binary(int $length = null): ColumnInterface { - return $this->schema->createColumn(SchemaInterface::TYPE_BINARY, $length); + return $this->schema->createColumn(ColumnType::BINARY, $length); } /** @@ -122,7 +126,7 @@ public function binary(int $length = null): ColumnInterface */ public function boolean(): ColumnInterface { - return $this->schema->createColumn(SchemaInterface::TYPE_BOOLEAN); + return $this->schema->createColumn(ColumnType::BOOLEAN); } /** @@ -136,7 +140,7 @@ public function boolean(): ColumnInterface */ public function char(int $length = null): ColumnInterface { - return $this->schema->createColumn(SchemaInterface::TYPE_CHAR, $length); + return $this->schema->createColumn(ColumnType::CHAR, $length); } /** @@ -146,7 +150,7 @@ public function char(int $length = null): ColumnInterface */ public function date(): ColumnInterface { - return $this->schema->createColumn(SchemaInterface::TYPE_DATE); + return $this->schema->createColumn(ColumnType::DATE); } /** @@ -161,7 +165,7 @@ public function date(): ColumnInterface */ public function dateTime(int $precision = null): ColumnInterface { - return $this->schema->createColumn(SchemaInterface::TYPE_DATETIME, $precision); + return $this->schema->createColumn(ColumnType::DATETIME, $precision); } /** @@ -190,7 +194,7 @@ public function decimal(int $precision = null, int $scale = null): ColumnInterfa $length[] = $scale; } - return $this->schema->createColumn(SchemaInterface::TYPE_DECIMAL, $length); + return $this->schema->createColumn(ColumnType::DECIMAL, $length); } /** @@ -205,7 +209,7 @@ public function decimal(int $precision = null, int $scale = null): ColumnInterfa */ public function double(int $precision = null): ColumnInterface { - return $this->schema->createColumn(SchemaInterface::TYPE_DOUBLE, $precision); + return $this->schema->createColumn(ColumnType::DOUBLE, $precision); } /** @@ -220,7 +224,7 @@ public function double(int $precision = null): ColumnInterface */ public function float(int $precision = null): ColumnInterface { - return $this->schema->createColumn(SchemaInterface::TYPE_FLOAT, $precision); + return $this->schema->createColumn(ColumnType::FLOAT, $precision); } /** @@ -234,7 +238,7 @@ public function float(int $precision = null): ColumnInterface */ public function integer(int $length = null): ColumnInterface { - return $this->schema->createColumn(SchemaInterface::TYPE_INTEGER, $length); + return $this->schema->createColumn(ColumnType::INTEGER, $length); } /** @@ -244,7 +248,7 @@ public function integer(int $length = null): ColumnInterface */ public function json(): ColumnInterface { - return $this->schema->createColumn(SchemaInterface::TYPE_JSON); + return $this->schema->createColumn(ColumnType::JSON); } /** @@ -273,7 +277,7 @@ public function money(int $precision = null, int $scale = null): ColumnInterface $length[] = $scale; } - return $this->schema->createColumn(SchemaInterface::TYPE_MONEY, $length); + return $this->schema->createColumn(ColumnType::MONEY, $length); } /** @@ -287,7 +291,7 @@ public function money(int $precision = null, int $scale = null): ColumnInterface */ public function primaryKey(int $length = null): ColumnInterface { - return $this->schema->createColumn(SchemaInterface::TYPE_PK, $length); + return $this->schema->createColumn(PseudoType::PK, $length); } /** @@ -301,7 +305,7 @@ public function primaryKey(int $length = null): ColumnInterface */ public function smallInteger(int $length = null): ColumnInterface { - return $this->schema->createColumn(SchemaInterface::TYPE_SMALLINT, $length); + return $this->schema->createColumn(ColumnType::SMALLINT, $length); } /** @@ -315,7 +319,7 @@ public function smallInteger(int $length = null): ColumnInterface */ public function string(int $length = null): ColumnInterface { - return $this->schema->createColumn(SchemaInterface::TYPE_STRING, $length); + return $this->schema->createColumn(ColumnType::STRING, $length); } /** @@ -325,7 +329,7 @@ public function string(int $length = null): ColumnInterface */ public function text(): ColumnInterface { - return $this->schema->createColumn(SchemaInterface::TYPE_TEXT); + return $this->schema->createColumn(ColumnType::TEXT); } /** @@ -340,7 +344,7 @@ public function text(): ColumnInterface */ public function time(int $precision = null): ColumnInterface { - return $this->schema->createColumn(SchemaInterface::TYPE_TIME, $precision); + return $this->schema->createColumn(ColumnType::TIME, $precision); } /** @@ -355,7 +359,7 @@ public function time(int $precision = null): ColumnInterface */ public function timestamp(int $precision = null): ColumnInterface { - return $this->schema->createColumn(SchemaInterface::TYPE_TIMESTAMP, $precision); + return $this->schema->createColumn(ColumnType::TIMESTAMP, $precision); } /** @@ -369,6 +373,6 @@ public function timestamp(int $precision = null): ColumnInterface */ public function tinyInteger(int $length = null): ColumnInterface { - return $this->schema->createColumn(SchemaInterface::TYPE_TINYINT, $length); + return $this->schema->createColumn(ColumnType::TINYINT, $length); } } diff --git a/src/MigrationBuilder.php b/src/MigrationBuilder.php index 7f453738..69848e98 100644 --- a/src/MigrationBuilder.php +++ b/src/MigrationBuilder.php @@ -89,10 +89,10 @@ public function insert(string $table, array $columns): void * The method will properly escape the column names and bind the values to be inserted. * * @param string $table The table that new rows will be inserted into. - * @param array $columns The column names. + * @param string[] $columns The column names. * @param iterable $rows The rows to be batch inserted into the table * - * @psalm-param iterable> $rows + * @psalm-param iterable> $rows * * @throws Exception * @throws InvalidConfigException @@ -101,7 +101,7 @@ public function insert(string $table, array $columns): void public function batchInsert(string $table, array $columns, iterable $rows): void { $time = $this->beginCommand("Insert into $table"); - $this->db->createCommand()->batchInsert($table, $columns, $rows)->execute(); + $this->db->createCommand()->insertBatch($table, $rows, $columns)->execute(); $this->endCommand($time); } From b816284c249fbcdb7c57112030a4d1400b0a313f Mon Sep 17 00:00:00 2001 From: Tigrov Date: Wed, 27 Nov 2024 10:06:37 +0700 Subject: [PATCH 5/8] Fix tests --- tests/Driver/Mssql/MigrationBuilderTest.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/Driver/Mssql/MigrationBuilderTest.php b/tests/Driver/Mssql/MigrationBuilderTest.php index 31b2ff19..0e3080d4 100644 --- a/tests/Driver/Mssql/MigrationBuilderTest.php +++ b/tests/Driver/Mssql/MigrationBuilderTest.php @@ -20,6 +20,12 @@ public function setUp(): void parent::setUp(); } + public function tearDown(): void + { + parent::tearDown(); + MssqlFactory::clearDatabase($this->container); + } + public function testCreateTableAnotherSchema(): void { $db = $this->container->get(ConnectionInterface::class); From e52c23ac046d60ced3b4bc83e47aad2a7fb22f74 Mon Sep 17 00:00:00 2001 From: Tigrov Date: Wed, 27 Nov 2024 10:12:13 +0700 Subject: [PATCH 6/8] Fix mssql tests --- tests/Common/AbstractMigrationBuilderTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Common/AbstractMigrationBuilderTest.php b/tests/Common/AbstractMigrationBuilderTest.php index 2902c98c..ee7bbd56 100644 --- a/tests/Common/AbstractMigrationBuilderTest.php +++ b/tests/Common/AbstractMigrationBuilderTest.php @@ -211,7 +211,7 @@ public function testAddColumn(string $type, string $expectedComment = null): voi } } - if ($expectedComment === null && in_array($this->db->getDriverName(), ['mysql', 'sqlsrv'], true)) { + if ($expectedComment === null && $this->db->getDriverName() === 'mysql') { $expectedComment = ''; } @@ -291,7 +291,7 @@ public function testAlterColumn(string $type, string|null $defaultValue = null, } } - if ($expectedComment === null && in_array($this->db->getDriverName(), ['mysql', 'sqlsrv'], true)) { + if ($expectedComment === null && $this->db->getDriverName() === 'mysql') { $expectedComment = ''; } From 36c4228628141af5d44c3834e04e82365443b787 Mon Sep 17 00:00:00 2001 From: Tigrov Date: Wed, 27 Nov 2024 10:16:21 +0700 Subject: [PATCH 7/8] Update CHANGELOG.md [skip ci] --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b8e740a..8233bcf9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - Enh #268: Don't use Yii DB deprecated methods in `Migrator` (@BaBL86, @vjik) - Enh #272: Raise minimum PHP version to `^8.1` with minor refactoring (@Tigrov) +- Enh #274: Refactor for compatibility with `yiisoft/db` package (@Tigrov) ## 1.1.0 December 24, 2023 From 1b2c14160f90f4d0d8fe202cd72bdb126f9ed788 Mon Sep 17 00:00:00 2001 From: Sergei Predvoditelev Date: Wed, 27 Nov 2024 14:39:24 +0300 Subject: [PATCH 8/8] Update CHANGELOG.md --- CHANGELOG.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c796aba7..f3581634 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,13 +2,12 @@ ## 1.2.1 under development -- no changes in this release. +- Enh #274: Refactor for compatibility with `yiisoft/db` package (@Tigrov) ## 1.2.0 November 27, 2024 - Enh #268: Don't use Yii DB deprecated methods in `Migrator` (@BaBL86, @vjik) - Enh #272: Raise minimum PHP version to `^8.1` with minor refactoring (@Tigrov) -- Enh #274: Refactor for compatibility with `yiisoft/db` package (@Tigrov) ## 1.1.0 December 24, 2023