Merge pull request #2 from phenixphp/feature/improve-worker-handling-… #21
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: run-tests | |
| on: | |
| push: | |
| branches: [main, develop] | |
| pull_request: | |
| branches: [main, develop] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest] | |
| php: [8.2] | |
| stability: [prefer-stable] | |
| name: P${{ matrix.php }} - ${{ matrix.stability }} - ${{ matrix.os }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php }} | |
| coverage: xdebug | |
| extensions: mbstring pdo sqlite3 pdo_sqlite intl json fileinfo pcntl dom xml openssl zip xdebug | |
| tools: composer:v2 | |
| - name: Get composer cache directory | |
| id: composer-cache | |
| run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
| - name: Cache dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ steps.composer-cache.outputs.dir }} | |
| key: ${{ runner.os }}-composer-${{ matrix.stability }}-${{ hashFiles('**/composer.json') }} | |
| restore-keys: ${{ runner.os }}-composer- | |
| - name: Setup problem matchers | |
| run: | | |
| echo "::add-matcher::${{ runner.tool_cache }}/php.json" | |
| echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" | |
| - name: Install dependencies | |
| run: composer update --${{ matrix.stability }} --prefer-dist --no-interaction | |
| - name: Check code formatting with PHP CS Fixer | |
| run: vendor/bin/php-cs-fixer fix --dry-run --diff --ansi | |
| - name: Analyze code statically with PHPStan | |
| run: vendor/bin/phpstan | |
| - name: Execute tests | |
| run: | | |
| cp phpunit.xml.dist phpunit.xml | |
| vendor/bin/phpunit | |
| - name: Prepare paths for SonarQube analysis | |
| run: | | |
| sed -i "s|$GITHUB_WORKSPACE|/github/workspace|g" build/logs/clover.xml | |
| sed -i "s|$GITHUB_WORKSPACE|/github/workspace|g" build/report.junit.xml | |
| - name: Run SonarQube analysis | |
| uses: sonarsource/sonarqube-scan-action@master | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |