From 7acbfac2d89bd5953063630c01da64b11f3fe54a Mon Sep 17 00:00:00 2001 From: Sam Mousa Date: Thu, 4 Sep 2025 16:58:37 +0200 Subject: [PATCH 1/2] feat!: drop old phpunit, automated releases --- .github/workflows/main.yml | 5 +- .github/workflows/release.yml | 68 ++++++++++++++++++++++++++++ .releaserc.json | 11 +++++ composer.json | 4 +- phpstan.neon | 5 ++ src/Codeception/Lib/Framework.php | 8 ---- src/Codeception/Lib/InnerBrowser.php | 9 ++++ 7 files changed, 96 insertions(+), 14 deletions(-) create mode 100644 .github/workflows/release.yml create mode 100644 .releaserc.json create mode 100644 phpstan.neon diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f19b0fe..0a8c8d2 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -6,12 +6,9 @@ jobs: tests: runs-on: ubuntu-latest - env: - COMPOSER_ROOT_VERSION: 4.99.99 - strategy: matrix: - php: [8.1, 8.2, 8.3, 8.4] + php: [8.2, 8.3, 8.4] steps: - name: Checkout code diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..39b0080 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,68 @@ +name: Automated release +on: + push: + branches: + - master +jobs: + tests: + runs-on: ubuntu-latest + + strategy: + matrix: + php: [ 8.2, 8.3, 8.4 ] + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: none + + - name: Validate composer.json and composer.lock + run: composer validate + + - name: Install dependencies + run: composer install --prefer-dist --no-progress --no-interaction --no-suggest + + - name: Execute Code Sniffer + run: vendor/bin/phpcs + + - name: Execute PHP Stan + run: vendor/bin/phpstan + + - name: Run test suite + run: | + php -S 127.0.0.1:8000 -t tests/data/app >/dev/null 2>&1 & + php -S 127.0.0.1:8010 -t tests/data/rest >/dev/null 2>&1 & + php vendor/bin/codecept run + + + release: + name: Automated release + needs: + - tests + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + persist-credentials: false + - uses: actions/setup-node@v4 + with: + node-version: 22 + - run: > + npx + -p "@semantic-release/commit-analyzer" + -p "@semantic-release/release-notes-generator" + -p conventional-changelog-conventionalcommits + -p semantic-release + -- semantic-release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +permissions: + packages: write + contents: write + pull-requests: write \ No newline at end of file diff --git a/.releaserc.json b/.releaserc.json new file mode 100644 index 0000000..8492546 --- /dev/null +++ b/.releaserc.json @@ -0,0 +1,11 @@ +{ + "branches": ["master"], + "tagFormat": "${version}", + "plugins": [ + ["@semantic-release/commit-analyzer", { + "preset": "conventionalcommits", + "presetConfig": {} + }], + "@semantic-release/github", + "@semantic-release/release-notes-generator"] +} \ No newline at end of file diff --git a/composer.json b/composer.json index b4955aa..82ad1ad 100644 --- a/composer.json +++ b/composer.json @@ -18,13 +18,13 @@ ], "homepage": "https://codeception.com/", "require": { - "php": "^8.1", + "php": "^8.2", "ext-dom": "*", "ext-json": "*", "ext-mbstring": "*", "codeception/codeception": "^5.0.8", "codeception/lib-web": "^1.0.1", - "phpunit/phpunit": "^10.0 || ^11.0 || ^12.0", + "phpunit/phpunit": "^11.5 || ^12.0", "symfony/browser-kit": "^4.4.24 || ^5.4 || ^6.0 || ^7.0", "symfony/dom-crawler": "^4.4.30 || ^5.4 || ^6.0 || ^7.0" }, diff --git a/phpstan.neon b/phpstan.neon new file mode 100644 index 0000000..f1f9077 --- /dev/null +++ b/phpstan.neon @@ -0,0 +1,5 @@ +parameters: + paths: + - ./src + - ./tests + level: 1 \ No newline at end of file diff --git a/src/Codeception/Lib/Framework.php b/src/Codeception/Lib/Framework.php index 9fcee63..60dc76e 100644 --- a/src/Codeception/Lib/Framework.php +++ b/src/Codeception/Lib/Framework.php @@ -11,14 +11,6 @@ */ abstract class Framework extends InnerBrowser { - /** - * Returns a list of recognized domain names - */ - protected function getInternalDomains(): array - { - return []; - } - public function _beforeSuite($settings = []) { /** diff --git a/src/Codeception/Lib/InnerBrowser.php b/src/Codeception/Lib/InnerBrowser.php index 20cd4f9..09a6946 100644 --- a/src/Codeception/Lib/InnerBrowser.php +++ b/src/Codeception/Lib/InnerBrowser.php @@ -248,6 +248,7 @@ protected function clientRequest( protected function isInternalDomain(string $domain): bool { if ($this->internalDomains === null) { + $this->internalDomains = $this->getInternalDomains(); } @@ -260,6 +261,14 @@ protected function isInternalDomain(string $domain): bool return false; } + /** + * Returns a list of recognized domain names + */ + protected function getInternalDomains(): array + { + return []; + } + /** * Opens a page with arbitrary request parameters. * Useful for testing multi-step forms on a specific step. From 3b8a07fb52b99c8c1dc3e92ad757c12ad7c75dc0 Mon Sep 17 00:00:00 2001 From: Sam Mousa Date: Thu, 4 Sep 2025 17:03:14 +0200 Subject: [PATCH 2/2] fix(ci): use phpstan --- .github/workflows/main.yml | 7 ++++++- .github/workflows/release.yml | 17 +++++------------ 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0a8c8d2..99a08b2 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,6 +1,7 @@ name: CI -on: [push, pull_request] +on: + pull_request: jobs: tests: @@ -18,6 +19,7 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php }} + tools: phpstan - name: Validate composer.json and composer.lock run: composer validate @@ -27,3 +29,6 @@ jobs: - name: Run test suite run: php vendor/bin/codecept run + + - name: Execute PHPStan + run: phpstan diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 39b0080..9c2fed2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,7 +9,7 @@ jobs: strategy: matrix: - php: [ 8.2, 8.3, 8.4 ] + php: [8.2, 8.3, 8.4] steps: - name: Checkout code @@ -19,7 +19,7 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php }} - coverage: none + tools: phpstan - name: Validate composer.json and composer.lock run: composer validate @@ -27,19 +27,12 @@ jobs: - name: Install dependencies run: composer install --prefer-dist --no-progress --no-interaction --no-suggest - - name: Execute Code Sniffer - run: vendor/bin/phpcs - - - name: Execute PHP Stan - run: vendor/bin/phpstan - name: Run test suite - run: | - php -S 127.0.0.1:8000 -t tests/data/app >/dev/null 2>&1 & - php -S 127.0.0.1:8010 -t tests/data/rest >/dev/null 2>&1 & - php vendor/bin/codecept run - + run: php vendor/bin/codecept run + - name: Execute PHPStan + run: phpstan release: name: Automated release needs: