Skip to content

wip: ocular upload 2 #1

wip: ocular upload 2

wip: ocular upload 2 #1

Workflow file for this run

name: gen-coverage
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
coverage:
runs-on: ubuntu-latest
name: Coverage
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, pcov
tools: composer:v2
coverage: pcov
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache composer dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies
run: |
composer install --no-interaction --no-progress --prefer-dist --optimize-autoloader
- name: Create tests database
run: |
mkdir -p database
touch database/database.sqlite
- name: Execute tests, generate code coverage report
env:
DB_CONNECTION: sqlite
DB_DATABASE: database/database.sqlite
run: vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover
- name: Upload code coverage report
run: |
composer global require scrutinizer/ocular
composer global config --list | grep "vendor-dir"
~/.composer/vendor/bin/ocular code-coverage:upload --format=php-clover coverage.clover