diff --git a/.github/workflows/ci.yml.dist b/.github/workflows/ci.yml.dist deleted file mode 100644 index f2038016..00000000 --- a/.github/workflows/ci.yml.dist +++ /dev/null @@ -1,78 +0,0 @@ ---- - -on: # yamllint disable-line rule:truthy - push: - branches: - - master - pull_request: - branches: - - master - -name: ๐Ÿ” Continuous integration - -jobs: - integration: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: true - matrix: - os: ["ubuntu-22.04"] - php: ["8.2"] - steps: - - name: ๐Ÿ“ฆ Check out the codebase - uses: actions/checkout@v4 - - - name: ๐Ÿ› ๏ธ Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php }} - extensions: mbstring, fileinfo, pdo_mysql, pdo - ini-values: error_reporting=E_ALL - tools: composer:v2, pecl - coverage: xdebug - - - name: ๐Ÿ› ๏ธ Setup problem matchers - run: | - echo "::add-matcher::${{ runner.tool_cache }}/php.json" - echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" - - - name: โ™ป๏ธ Restore cached dependencies - id: cached-composer-dependencies - uses: actions/cache@v4 - with: - path: vendor - key: vendor-${{ runner.os }}-${{ hashFiles('**/composer.lock') }}-${{ matrix.php }} - - - name: ๐Ÿ“ฅ Install dependencies - if: steps.cached-composer-dependencies.outputs.cache-hit != 'true' - run: composer install - - - name: ๐Ÿ› ๏ธ Prepare environment - run: | - mkdir -p ./.build/php-cs-fixer - mkdir -p ./.build/phpstan - mkdir -p ./.build/phpunit - - - name: ๐Ÿšจ Run coding standards task - run: composer cs:diff - env: - PHP_CS_FIXER_IGNORE_ENV: true - - - name: ๐Ÿงช Execute phpunit and pest tests - env: - XDEBUG_MODE: coverage - DB_CONNECTION: sqlite - DB_DATABASE: ":memory:" - run: vendor/bin/pest --coverage-clover=coverage.xml - - - name: ๐Ÿ” Run static analysis using phpstan - run: composer stan:ci - - - name: ๐Ÿ“ค Upload coverage report to Codecov - uses: codecov/codecov-action@v4.4.0 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: ./coverage.xml - verbose: true - -... diff --git a/.github/workflows/dependency-analysis.yml b/.github/workflows/dependency-analysis.yml new file mode 100644 index 00000000..a69bda3c --- /dev/null +++ b/.github/workflows/dependency-analysis.yml @@ -0,0 +1,87 @@ +--- + +name: ๐Ÿ” Dependency analysis + +on: # yamllint disable-line rule:truthy + push: + branches: + - master + paths: + - 'config/**' + - 'src/**' + - 'tests/**' + - '.php-cs-fixer.dist.php' + - 'composer.json' + - 'composer.lock' + - 'composer-require-checker.json' + pull_request: + branches: + - master + paths: + - 'config/**' + - 'src/**' + - 'tests/**' + - '.php-cs-fixer.dist.php' + - 'composer.json' + - 'composer.lock' + - 'composer-require-checker.json' + +jobs: + dependency-analysis: + timeout-minutes: 4 + runs-on: ${{ matrix.os }} + concurrency: + cancel-in-progress: true + group: dependency-analysis-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + strategy: + fail-fast: true + matrix: + os: + - ubuntu-latest + php-version: + - '8.2' + dependencies: + - locked + + steps: + - name: ๐Ÿ“ฆ Check out the codebase + uses: actions/checkout@v4.1.6 + + - name: ๐Ÿ› ๏ธ Setup PHP + uses: shivammathur/setup-php@2.30.4 + with: + php-version: ${{ matrix.php-version }} + extensions: none, ctype, dom, json, mbstring, simplexml, tokenizer, xml, xmlwriter, pdo, curl, fileinfo, pdo_mysql + ini-values: error_reporting=E_ALL + coverage: none + tools: phive + + - name: ๐Ÿ› ๏ธ Setup problem matchers + run: echo "::add-matcher::${{ runner.tool_cache }}/php.json" + + - name: ๐Ÿค– Validate composer.json and composer.lock + run: composer validate --ansi --strict + + - name: ๐Ÿ” Get composer cache directory + uses: wayofdev/gh-actions/actions/composer/get-cache-directory@v3.1.0 + + - name: โ™ป๏ธ Restore cached dependencies installed with composer + uses: actions/cache@v4.0.2 + with: + path: ${{ env.COMPOSER_CACHE_DIR }} + key: php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }} + restore-keys: php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}- + + - name: ๐Ÿ“ฅ Install "${{ matrix.dependencies }}" dependencies + uses: wayofdev/gh-actions/actions/composer/install@v3.1.0 + with: + dependencies: ${{ matrix.dependencies }} + + - name: ๐Ÿ“ฅ Install dependencies with phive + uses: wayofdev/gh-actions/actions/phive/install@v3.1.0 + with: + phive-home: '.phive' + trust-gpg-keys: 0xC00543248C87FB13,0x033E5F8D801A2F8D + + - name: ๐Ÿ”ฌ Run maglnet/composer-require-checker + run: .phive/composer-require-checker check --ansi --config-file="$(pwd)/composer-require-checker.json" --verbose diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index e905a4ba..8411390c 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -9,6 +9,12 @@ on: # yamllint disable-line rule:truthy - 'src/**' - 'tests/**' - '.php-cs-fixer.dist.php' + - 'composer.json' + - 'composer.lock' + - 'phpstan.neon.dist' + - 'phpstan-baseline.neon' + - 'psalm.xml' + - 'psalm-baseline.xml' pull_request: branches: - master @@ -17,6 +23,12 @@ on: # yamllint disable-line rule:truthy - 'src/**' - 'tests/**' - '.php-cs-fixer.dist.php' + - 'composer.json' + - 'composer.lock' + - 'phpstan.neon.dist' + - 'phpstan-baseline.neon' + - 'psalm.xml' + - 'psalm-baseline.xml' name: ๐Ÿ” Static analysis diff --git a/.github/workflows/testing-mssql.yml b/.github/workflows/testing-mssql.yml new file mode 100644 index 00000000..1eb5d122 --- /dev/null +++ b/.github/workflows/testing-mssql.yml @@ -0,0 +1,94 @@ +--- + +on: # yamllint disable-line rule:truthy + pull_request: + branches: + - master + push: + branches: + - master + +name: ๐Ÿงช Testing (MSSQL - SQLServer) + +env: + DB_HOST: 127.0.0.1 + DB_PORT: 11433 + DB_USERNAME: SA + DB_PASSWORD: 'SSpaSS__1_123' + DB_CONNECTION: sqlserver + DB_DATABASE: tempdb + +jobs: + test-sqlserver: + timeout-minutes: 4 + runs-on: ${{ matrix.os }} + concurrency: + cancel-in-progress: true + group: test-sqlserver-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-${{ matrix.php-version }}-${{ matrix.dependencies }} + strategy: + fail-fast: true + matrix: + os: + - 'ubuntu-latest' + php-version: + - '8.2' + dependencies: + - locked + sqlserver-version: + - '2022-latest' + + services: + sqlserver: + image: mcr.microsoft.com/mssql/server:${{ matrix.sqlserver-version }} + env: + ACCEPT_EULA: 'Y' + SA_PASSWORD: 'SSpaSS__1_123' + options: >- + --health-cmd "/opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P 'SSpaSS__1_123' -l 30 -Q 'SELECT 1'" + --health-interval 3s + --health-timeout 1s + --health-retries 10 + ports: + - 11433:1433 + + steps: + - name: ๐Ÿ“ฆ Check out the codebase + uses: actions/checkout@v4.1.6 + + - name: ๐Ÿ› ๏ธ Setup PHP + uses: shivammathur/setup-php@2.30.4 + with: + php-version: ${{ matrix.php-version }} + extensions: none, ctype, dom, json, mbstring, simplexml, tokenizer, xml, xmlwriter, pdo, curl, fileinfo, pdo_mysql, pdo_sqlsrv + ini-values: error_reporting=E_ALL + coverage: none + + - name: ๐Ÿ› ๏ธ Setup problem matchers + run: | + echo "::add-matcher::${{ runner.tool_cache }}/php.json" + echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" + + - name: ๐Ÿค– Validate composer.json and composer.lock + run: composer validate --ansi --strict + + - name: ๐Ÿ” Get composer cache directory + uses: wayofdev/gh-actions/actions/composer/get-cache-directory@v3.1.0 + + - name: โ™ป๏ธ Restore cached dependencies installed with composer + uses: actions/cache@v4.0.2 + with: + path: ${{ env.COMPOSER_CACHE_DIR }} + key: php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }} + restore-keys: php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}- + + - name: ๐Ÿ—‘๏ธ Remove PHP platform configuration + if: "matrix.dependencies != 'locked'" + run: composer config platform.php --ansi --unset + + - name: ๐Ÿ“ฅ Install "${{ matrix.dependencies }}" dependencies + uses: wayofdev/gh-actions/actions/composer/install@v3.1.0 + with: + dependencies: ${{ matrix.dependencies }} + + - name: ๐Ÿงช Run phpunit tests with Pest + run: composer test diff --git a/.github/workflows/testing-mysql.yml b/.github/workflows/testing-mysql.yml new file mode 100644 index 00000000..5ef17d3c --- /dev/null +++ b/.github/workflows/testing-mysql.yml @@ -0,0 +1,97 @@ +--- + +on: # yamllint disable-line rule:truthy + pull_request: + branches: + - master + push: + branches: + - master + +name: ๐Ÿงช Testing (MySQL) + +env: + DB_HOST: 127.0.0.1 + DB_PORT: 13306 + DB_USERNAME: cycle + DB_PASSWORD: ${{ secrets.DB_PASSWORD }} + DB_CONNECTION: mysql + DB_DATABASE: default + +jobs: + test-mysql: + timeout-minutes: 4 + runs-on: ${{ matrix.os }} + concurrency: + cancel-in-progress: true + group: test-mysql-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-${{ matrix.php-version }}-${{ matrix.dependencies }} + strategy: + fail-fast: true + matrix: + os: + - 'ubuntu-latest' + php-version: + - '8.2' + dependencies: + - locked + mysql-version: + - latest + + services: + mysql: + image: mysql:${{ matrix.mysql-version }} + env: + MYSQL_ROOT_HOST: '%' + MYSQL_USER: 'cycle' + MYSQL_PASSWORD: ${{ secrets.DB_PASSWORD }} + MYSQL_ROOT_PASSWORD: ${{ secrets.DB_PASSWORD }} + MYSQL_DATABASE: 'default' + options: >- + --health-cmd="mysqladmin ping" + --health-interval 10s + --health-timeout 5s + --health-retries 5 + ports: + - 13306:3306 + + steps: + - name: ๐Ÿ“ฆ Check out the codebase + uses: actions/checkout@v4.1.6 + + - name: ๐Ÿ› ๏ธ Setup PHP + uses: shivammathur/setup-php@2.30.4 + with: + php-version: ${{ matrix.php-version }} + extensions: none, ctype, dom, json, mbstring, simplexml, tokenizer, xml, xmlwriter, pdo, curl, fileinfo, pdo_mysql + ini-values: error_reporting=E_ALL + coverage: none + + - name: ๐Ÿ› ๏ธ Setup problem matchers + run: | + echo "::add-matcher::${{ runner.tool_cache }}/php.json" + echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" + + - name: ๐Ÿค– Validate composer.json and composer.lock + run: composer validate --ansi --strict + + - name: ๐Ÿ” Get composer cache directory + uses: wayofdev/gh-actions/actions/composer/get-cache-directory@v3.1.0 + + - name: โ™ป๏ธ Restore cached dependencies installed with composer + uses: actions/cache@v4.0.2 + with: + path: ${{ env.COMPOSER_CACHE_DIR }} + key: php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }} + restore-keys: php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}- + + - name: ๐Ÿ—‘๏ธ Remove PHP platform configuration + if: "matrix.dependencies != 'locked'" + run: composer config platform.php --ansi --unset + + - name: ๐Ÿ“ฅ Install "${{ matrix.dependencies }}" dependencies + uses: wayofdev/gh-actions/actions/composer/install@v3.1.0 + with: + dependencies: ${{ matrix.dependencies }} + + - name: ๐Ÿงช Run phpunit tests with Pest + run: composer test diff --git a/.github/workflows/testing-pgsql.yml b/.github/workflows/testing-pgsql.yml new file mode 100644 index 00000000..27160c78 --- /dev/null +++ b/.github/workflows/testing-pgsql.yml @@ -0,0 +1,95 @@ +--- + +on: # yamllint disable-line rule:truthy + pull_request: + branches: + - master + push: + branches: + - master + +name: ๐Ÿงช Testing (PostgreSQL) + +env: + DB_HOST: 127.0.0.1 + DB_PORT: 15432 + DB_USERNAME: cycle + DB_PASSWORD: ${{ secrets.DB_PASSWORD }} + DB_CONNECTION: pgsql + DB_DATABASE: default + +jobs: + test-pgsql: + timeout-minutes: 4 + runs-on: ${{ matrix.os }} + concurrency: + cancel-in-progress: true + group: test-pgsql-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-${{ matrix.php-version }}-${{ matrix.dependencies }} + strategy: + fail-fast: true + matrix: + os: + - 'ubuntu-latest' + php-version: + - '8.2' + dependencies: + - locked + pgsql-version: + - '13-alpine' + + services: + mysql: + image: postgres:${{ matrix.pgsql-version }} + env: + POSTGRES_DB: 'default' + POSTGRES_USER: 'cycle' + POSTGRES_PASSWORD: ${{ secrets.DB_PASSWORD }} + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + ports: + - 15432:5432 + + steps: + - name: ๐Ÿ“ฆ Check out the codebase + uses: actions/checkout@v4.1.6 + + - name: ๐Ÿ› ๏ธ Setup PHP + uses: shivammathur/setup-php@2.30.4 + with: + php-version: ${{ matrix.php-version }} + extensions: none, ctype, dom, json, mbstring, simplexml, tokenizer, xml, xmlwriter, pdo, curl, fileinfo, pdo_mysql, pdo_pgsql + ini-values: error_reporting=E_ALL + coverage: none + + - name: ๐Ÿ› ๏ธ Setup problem matchers + run: | + echo "::add-matcher::${{ runner.tool_cache }}/php.json" + echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" + + - name: ๐Ÿค– Validate composer.json and composer.lock + run: composer validate --ansi --strict + + - name: ๐Ÿ” Get composer cache directory + uses: wayofdev/gh-actions/actions/composer/get-cache-directory@v3.1.0 + + - name: โ™ป๏ธ Restore cached dependencies installed with composer + uses: actions/cache@v4.0.2 + with: + path: ${{ env.COMPOSER_CACHE_DIR }} + key: php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }} + restore-keys: php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}- + + - name: ๐Ÿ—‘๏ธ Remove PHP platform configuration + if: "matrix.dependencies != 'locked'" + run: composer config platform.php --ansi --unset + + - name: ๐Ÿ“ฅ Install "${{ matrix.dependencies }}" dependencies + uses: wayofdev/gh-actions/actions/composer/install@v3.1.0 + with: + dependencies: ${{ matrix.dependencies }} + + - name: ๐Ÿงช Run phpunit tests with Pest + run: composer test diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 58d9575b..4337b570 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -1,6 +1,6 @@ --- -name: ๐Ÿงช Unit testing +name: ๐Ÿงช Testing (SQLite) on: # yamllint disable-line rule:truthy pull_request: