diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d833ab6..a2b0650 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,6 +1,6 @@ name: CI -on: [push, pull_request] +on: [pull_request] jobs: tests: @@ -8,7 +8,7 @@ jobs: 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..c1c7da7 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,63 @@ +name: Automated release +on: + push: + branches: + - main +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 }} + tools: phpcs, phpstan + + - name: Validate composer.json + run: composer validate + + - name: Install dependencies + run: composer install + + - name: Code style + run: phpcs src/ tests/ + + - name: Static analysis + run: phpstan + + - name: Run tests + run: ./vendor/bin/phpunit tests/ + 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 b0b9b38..88d8d8d 100644 --- a/composer.json +++ b/composer.json @@ -13,10 +13,10 @@ ], "homepage": "https://codeception.com/", "require": { - "php": "^8.1", + "php": "^8.2", "ext-mbstring": "*", "guzzlehttp/psr7": "^2.0", - "phpunit/phpunit": "^9.5 | ^10.0 | ^11.0 | ^12", + "phpunit/phpunit": "^11.5 | ^12", "symfony/css-selector": ">=4.4.24 <8.0" }, "require-dev": { diff --git a/phpstan.neon b/phpstan.neon new file mode 100644 index 0000000..c40b1db --- /dev/null +++ b/phpstan.neon @@ -0,0 +1,5 @@ +parameters: + paths: + - ./src + - ./tests + level: 5 \ No newline at end of file