chore(release): 1.1.1 #34
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: | |
push: | |
pull_request: | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
tests: | |
name: Unit Tests | |
runs-on: ubuntu-latest | |
env: | |
extensions: xdebug | |
strategy: | |
matrix: | |
include: | |
- php: '8.1' | |
phpunit: 'latest' | |
phpunit_config: 'phpunit.xml' | |
- php: '8.2' | |
phpunit: 'latest' | |
phpunit_config: 'phpunit.xml' | |
fail-fast: false | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 2 | |
- name: Cache Composer dependencies | |
uses: actions/cache@v3 | |
with: | |
path: /tmp/composer-cache | |
key: ${{ runner.os }}-{{ matrix.php }}-${{ hashFiles('**/composer.lock') }} | |
- name: Setup Code Climate | |
uses: remarkablemark/setup-codeclimate@v2 | |
if: ${{ github.event_name == 'push' && matrix.php == '8.2' }} | |
- name: Setup PHP | |
uses: php-actions/composer@v6 | |
with: | |
memory_limit: 256M | |
php_version: "${{ matrix.php }}" | |
php_extensions: "${{ env.extensions }}" | |
- name: CodeClimate Before Build | |
if: ${{ github.event_name == 'push' && matrix.php == '8.2' }} | |
env: | |
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} | |
run: cc-test-reporter before-build | |
- name: Run Tests | |
uses: php-actions/phpunit@v3 | |
env: | |
XDEBUG_MODE: coverage | |
with: | |
memory_limit: 256M | |
configuration: "${{ matrix.phpunit_config }}" | |
version: "${{ matrix.phpunit }}" | |
coverage_clover: "clover.xml" | |
coverage_text: true | |
php_version: "${{ matrix.php }}" | |
php_extensions: "${{ env.extensions }}" | |
- name: Fix file paths in clover.xml | |
shell: bash | |
run: | | |
sed -i 's#/app#'"$PWD"'#g' clover.xml | |
- name: CodeClimate After Build | |
if: ${{ github.event_name == 'push' && matrix.php == '8.2' }} | |
env: | |
COVERAGE_FILE: clover.xml | |
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} | |
run: cc-test-reporter after-build -t clover | |
- name: Make code coverage badge | |
if: ${{ github.event_name == 'push' && matrix.php == '8.2' }} | |
uses: timkrase/phpunit-coverage-badge@v1.2.1 | |
with: | |
coverage_badge_path: output/coverage.svg | |
push_badge: false | |
- name: Push code coverage badge | |
if: ${{ github.event_name == 'push' && matrix.php == '8.2' }} | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
publish_dir: ./output | |
publish_branch: gh-images | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
user_name: 'github-actions[bot]' | |
user_email: 'github-actions[bot]@users.noreply.github.com' |