Merge pull request #25 from heroespatchnotes/dependabot/github_action… #57
This file contains 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: PHPUnit | |
on: | |
pull_request: | |
branches: | |
- develop | |
push: | |
branches: | |
- develop | |
jobs: | |
main: | |
name: PHP ${{ matrix.php-versions }} Unit Tests | |
strategy: | |
matrix: | |
php-versions: ['7.3', '7.4', '8.0'] | |
runs-on: ubuntu-latest | |
if: "!contains(github.event.head_commit.message, '[ci skip]')" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup PHP, with composer and extensions | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-versions }} | |
tools: composer, pecl, phpunit | |
extensions: intl, json, mbstring, xdebug, xml | |
coverage: xdebug | |
- name: Get composer cache directory | |
id: composer-cache | |
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | |
- name: Cache composer dependencies | |
uses: actions/cache@v2 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} | |
restore-keys: ${{ runner.os }}-composer- | |
- name: Install dependencies | |
run: composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader | |
env: | |
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }} | |
- name: Test with PHPUnit | |
run: vendor/bin/phpunit --verbose --coverage-text | |
- if: matrix.php-versions == '7.4' | |
name: Run Coveralls | |
run: | | |
composer global require php-coveralls/php-coveralls:^2.4 | |
php-coveralls --coverage_clover=build/logs/clover.xml -v | |
env: | |
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
COVERALLS_PARALLEL: true | |
COVERALLS_FLAG_NAME: PHP ${{ matrix.php-versions }} - ${{ matrix.db-platforms }} | |
coveralls: | |
needs: [main] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Coveralls Finished | |
uses: coverallsapp/github-action@master | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
parallel-finished: true |