Unit Tests #1855
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: Unit Tests | |
| on: | |
| schedule: | |
| - cron: '0 0 * * *' | |
| pull_request: | |
| paths: | |
| - '**.php' | |
| - .github/workflows/test-phpunit.yml | |
| - composer.json | |
| - phpunit.dist.xml | |
| push: | |
| paths: | |
| - '**.php' | |
| - .github/workflows/test-phpunit.yml | |
| - composer.json | |
| - phpunit.dist.xml | |
| jobs: | |
| unit-tests: | |
| name: PHPUnit Tests [PHP ${{ matrix.php-version }}] | |
| runs-on: ubuntu-24.04 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| php-version: | |
| - '8.2' | |
| - '8.3' | |
| - '8.4' | |
| - '8.5' | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f # v2.37.0 | |
| with: | |
| php-version: ${{ matrix.php-version }} | |
| extensions: tokenizer | |
| coverage: xdebug | |
| - name: Get composer cache directory | |
| id: composer-cache | |
| run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
| - name: Cache composer dependencies | |
| uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 | |
| with: | |
| path: ${{ steps.composer-cache.outputs.COMPOSER_CACHE_FILES_DIR }} | |
| key: composer-${{ matrix.php-version }}-${{ hashFiles('**/composer.*') }} | |
| restore-keys: | | |
| composer-${{ matrix.php-version }}- | |
| composer- | |
| - name: Setup Composer's GitHub OAuth access | |
| run: composer config --global github-oauth.github.com ${{ secrets.GITHUB_TOKEN }} | |
| - name: Install dependencies | |
| run: | | |
| composer update --ansi | |
| composer audit --ansi | |
| - name: Run Coding Standards Test Suite | |
| run: vendor/bin/phpunit --colors=always | |
| - name: Upload coverage results to Coveralls | |
| uses: coverallsapp/github-action@5cbfd81b66ca5d10c19b062c04de0199c215fb6e # v2.37.0 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| file: build/phpunit/logs/clover.xml | |
| parallel: true | |
| flag-name: PHP ${{ matrix.php-version }} | |
| coveralls-upload: | |
| name: Trigger parallel build webhook on Coveralls | |
| runs-on: ubuntu-latest | |
| needs: | |
| - unit-tests | |
| steps: | |
| - name: Upload to Coveralls API | |
| uses: coverallsapp/github-action@5cbfd81b66ca5d10c19b062c04de0199c215fb6e # v2.37.0 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| parallel-finished: true |