Merge pull request #6 from DigitalCoreHub/dependabot/composer/phpstan… #19
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| php: [8.3] | |
| laravel: [12.x] | |
| name: PHP ${{ matrix.php }} with Laravel ${{ matrix.laravel }} | |
| steps: | |
| - name: Checkout code | |
| 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, pcov | |
| coverage: pcov | |
| - name: Get composer cache directory | |
| id: composer-cache | |
| run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
| - name: Cache composer dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ steps.composer-cache.outputs.dir }} | |
| key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
| restore-keys: ${{ runner.os }}-composer- | |
| - name: Install dependencies | |
| run: composer install --prefer-dist --no-progress --no-suggest | |
| - name: Execute tests with coverage | |
| run: composer test-coverage | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| files: ./coverage/coverage.xml | |
| fail_ci_if_error: false | |
| verbose: true | |
| code-quality: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: 8.3 | |
| extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv | |
| - name: Install dependencies | |
| run: composer install --prefer-dist --no-progress --no-suggest | |
| - name: Run PHP CS Fixer | |
| run: composer fix-style | |
| - name: Run PHPStan | |
| run: composer analyse | |
| pint: | |
| runs-on: ubuntu-latest | |
| name: Laravel Pint Code Style | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: 8.3 | |
| extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv | |
| - name: Install dependencies | |
| run: composer install --prefer-dist --no-progress --no-suggest | |
| - name: Run Laravel Pint (Test Mode) | |
| run: composer pint-test | |
| - name: Run Laravel Pint (Fix Mode) | |
| run: composer pint | |
| - name: Check for changes | |
| run: | | |
| if [ -n "$(git status --porcelain)" ]; then | |
| echo "::error::Code style issues found. Please run 'composer pint' to fix them." | |
| echo "::error::The following files have been modified:" | |
| git diff --name-only | |
| echo "::error::Changes:" | |
| git diff | |
| exit 1 | |
| else | |
| echo "✅ Code style is correct!" | |
| fi | |
| security: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: 8.3 | |
| extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv | |
| - name: Install dependencies | |
| run: composer install --prefer-dist --no-progress --no-suggest | |
| - name: Run security audit | |
| run: composer security-audit |