add coveralls package #41
Workflow file for this run
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: Test | |
on: [push] | |
jobs: | |
test: | |
name: Test PHP ${{ matrix.php-versions }} | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
php-versions: ['8.0', '8.1', '8.2', '8.3'] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
# Fetch 10 commits or Scrutinizer will throw ("Failed to retrieve commit parents. | |
# If you use a shallow git checkout, please checkout at least a depth of one."), | |
# see: RepositoryIntrospector at scrutinizer-ci/ocular GitHub repository | |
fetch-depth: 10 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-versions }} | |
extensions: curl, mbstring, intl, libxml, simplexml | |
coverage: xdebug | |
- name: Get composer cache directory | |
id: composer-cache-dir | |
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- name: Cache Composer packages | |
id: composer-cache-restore | |
uses: actions/cache@v4 | |
with: | |
path: ${{ steps.composer-cache-dir.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} | |
restore-keys: ${{ runner.os }}-composer- | |
- name: Install dependencies | |
run: (test -d vendor && echo vendor directory exists) || composer install --prefer-dist --no-progress --no-suggest | |
- name: Run PHPUnit | |
run: vendor/bin/phpunit --coverage-text --coverage-clover clover.xml | |
- name: "[Coveralls] Extract branch name" | |
if: matrix.php-versions == '8.3' | |
shell: bash | |
run: echo "branch=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_OUTPUT | |
id: extract_branch | |
- name: "[Coveralls] Checkout branch" | |
if: matrix.php-versions == '8.3' | |
shell: bash | |
run: git fetch && git checkout ${{ steps.extract_branch.outputs.branch }} | |
- name: "[Coveralls] Send report" | |
if: matrix.php-versions == '8.3' | |
run: ./vendor/bin/php-coveralls -v -x clover.xml -o coveralls-upload.json | |
env: | |
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} |