From 122622d569460f5c66433396b0f45c5d275e6763 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 4 May 2026 13:17:29 +0000 Subject: [PATCH 1/2] Initial plan From a60fbddcbd2a87d77dbd4d0bbdd80514836d873a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 4 May 2026 13:22:48 +0000 Subject: [PATCH 2/2] feat: add comprehensive CI/CD workflows for testing, code quality, and releases Agent-Logs-Url: https://github.com/barsch123/activity/sessions/b0429cdc-0cbb-47bb-b3ed-a295c4b46d48 Co-authored-by: barsch123 <140614710+barsch123@users.noreply.github.com> --- .github/workflows/code-quality.yml | 113 +++++++++++++++++++++++ .github/workflows/fix-php-code-style.yml | 47 ++++++++++ .github/workflows/release.yml | 42 +++++++++ .github/workflows/run-tests.yml | 36 ++++++-- README.md | 1 + composer.json | 1 + phpstan.neon.dist | 12 +++ 7 files changed, 244 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/code-quality.yml create mode 100644 .github/workflows/fix-php-code-style.yml create mode 100644 .github/workflows/release.yml create mode 100644 phpstan.neon.dist diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml new file mode 100644 index 0000000..f12fc6e --- /dev/null +++ b/.github/workflows/code-quality.yml @@ -0,0 +1,113 @@ +name: code-quality + +on: + push: + paths: + - '**.php' + - '.github/workflows/code-quality.yml' + - 'composer.json' + - 'composer.lock' + - 'phpstan.neon.dist' + pull_request: + paths: + - '**.php' + - '.github/workflows/code-quality.yml' + - 'composer.json' + - 'composer.lock' + - 'phpstan.neon.dist' + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + phpstan: + name: PHPStan + runs-on: ubuntu-latest + timeout-minutes: 5 + permissions: + contents: read + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: 8.4 + extensions: dom, curl, libxml, mbstring, zip, pdo, sqlite, pdo_sqlite, bcmath, intl, fileinfo + coverage: none + + - name: Install dependencies + run: composer update --prefer-stable --prefer-dist --no-interaction + + - name: Run PHPStan + run: composer analyse -- --error-format=github + + pint: + name: PHP Code Style (Pint) + runs-on: ubuntu-latest + timeout-minutes: 5 + permissions: + contents: read + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: 8.4 + extensions: dom, curl, libxml, mbstring, zip, pdo, sqlite, pdo_sqlite, bcmath, intl, fileinfo + coverage: none + + - name: Install dependencies + run: composer update --prefer-stable --prefer-dist --no-interaction + + - name: Check code style + run: vendor/bin/pint --test + + composer-validate: + name: Validate composer.json + runs-on: ubuntu-latest + timeout-minutes: 5 + permissions: + contents: read + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: 8.4 + coverage: none + + - name: Validate composer.json + run: composer validate --strict + + security-audit: + name: Security Audit + runs-on: ubuntu-latest + timeout-minutes: 5 + permissions: + contents: read + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: 8.4 + coverage: none + + - name: Install dependencies + run: composer update --prefer-stable --prefer-dist --no-interaction + + - name: Check for security vulnerabilities + run: composer audit diff --git a/.github/workflows/fix-php-code-style.yml b/.github/workflows/fix-php-code-style.yml new file mode 100644 index 0000000..8933b71 --- /dev/null +++ b/.github/workflows/fix-php-code-style.yml @@ -0,0 +1,47 @@ +name: fix-php-code-style + +on: + pull_request: + paths: + - '**.php' + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + fix-code-style: + name: Fix PHP Code Style + runs-on: ubuntu-latest + timeout-minutes: 5 + permissions: + contents: write + # Only run on PRs from the same repository (not forks), since we need write access + if: github.event.pull_request.head.repo.full_name == github.repository + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref }} + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: 8.4 + extensions: dom, curl, libxml, mbstring, zip, pdo, sqlite, pdo_sqlite, bcmath, intl, fileinfo + coverage: none + + - name: Install dependencies + run: composer update --prefer-stable --prefer-dist --no-interaction + + - name: Run Pint (auto-fix) + run: vendor/bin/pint + + - name: Commit style fixes + uses: stefanzweifel/git-auto-commit-action@v5 + with: + commit_message: "style: apply automatic PHP code style fixes" + commit_author: "github-actions[bot] " + skip_dirty_check: false diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..a785311 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,42 @@ +name: release + +on: + push: + tags: + - 'v*.*.*' + +permissions: + contents: write + +jobs: + release: + name: Create Release + runs-on: ubuntu-latest + timeout-minutes: 10 + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: 8.4 + extensions: dom, curl, libxml, mbstring, zip, pdo, sqlite, pdo_sqlite, bcmath, intl, fileinfo + coverage: none + + - name: Install dependencies + run: composer update --prefer-stable --prefer-dist --no-interaction + + - name: Run tests before release + run: vendor/bin/pest --ci + + - name: Create GitHub Release + uses: softprops/action-gh-release@v2 + with: + generate_release_notes: true + make_latest: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index dfbfa5e..00721f2 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -22,33 +22,36 @@ concurrency: jobs: test: - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest timeout-minutes: 5 + permissions: + contents: read strategy: fail-fast: true matrix: - os: [ubuntu-latest, windows-latest] - php: [8.4, 8.3] - laravel: [12.*, 11.*] + php: [8.4, 8.3, 8.2] + laravel: [13.*, 12.*, 11.*] stability: [prefer-lowest, prefer-stable] include: + - laravel: 13.* + testbench: 11.* - laravel: 12.* testbench: 10.* - laravel: 11.* testbench: 9.* - name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} + name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} steps: - name: Checkout code - uses: actions/checkout@v5 + uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php }} - extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo - coverage: none + extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, fileinfo + coverage: xdebug - name: Setup problem matchers run: | @@ -63,3 +66,20 @@ jobs: - name: List Installed Dependencies run: composer show -D + - name: Execute tests + run: vendor/bin/pest --ci --coverage --coverage-clover=coverage.xml + + - name: Upload coverage to Codecov + if: matrix.php == '8.4' && matrix.laravel == '13.*' && matrix.stability == 'prefer-stable' + uses: codecov/codecov-action@v5 + with: + files: coverage.xml + fail_ci_if_error: false + + - name: Upload test results artifact + if: always() + uses: actions/upload-artifact@v4 + with: + name: test-results-php${{ matrix.php }}-laravel${{ matrix.laravel }}-${{ matrix.stability }} + path: coverage.xml + retention-days: 7 diff --git a/README.md b/README.md index e37602f..3248893 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # Logger [![Tests](https://github.com/barsch123/activity/actions/workflows/run-tests.yml/badge.svg)](https://github.com/barsch123/activity/actions/workflows/run-tests.yml) +[![Code Quality](https://github.com/barsch123/activity/actions/workflows/code-quality.yml/badge.svg)](https://github.com/barsch123/activity/actions/workflows/code-quality.yml) [![Packagist Version](https://img.shields.io/packagist/v/gottvergessen/activity.svg?style=flat-square)](https://packagist.org/packages/gottvergessen/activity) [![License](https://img.shields.io/packagist/l/gottvergessen/activity.svg?style=flat-square)](LICENSE.md) diff --git a/composer.json b/composer.json index 278fc73..5015cfe 100644 --- a/composer.json +++ b/composer.json @@ -22,6 +22,7 @@ "spatie/laravel-package-tools": "^1.16" }, "require-dev": { + "larastan/larastan": "^3.0", "laravel/pint": "^1.14", "nunomaduro/collision": "^8.8", "orchestra/testbench": "^11.0.0||^10.0.0||^9.0.0", diff --git a/phpstan.neon.dist b/phpstan.neon.dist new file mode 100644 index 0000000..b34fde0 --- /dev/null +++ b/phpstan.neon.dist @@ -0,0 +1,12 @@ +includes: + - vendor/larastan/larastan/extension.neon + +parameters: + paths: + - src + + level: 9 + + ignoreErrors: + + excludePaths: