-
Notifications
You must be signed in to change notification settings - Fork 2k
76 lines (63 loc) · 2.22 KB
/
reusable-coveralls.yml
File metadata and controls
76 lines (63 loc) · 2.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
name: Reusable Coveralls Upload
on:
workflow_call:
inputs:
php-version:
description: The PHP version the workflow should run
type: string
required: true
jobs:
coveralls:
runs-on: ubuntu-22.04
steps:
- name: Checkout base branch for PR
if: github.event_name == 'pull_request'
uses: actions/checkout@v6
with:
ref: ${{ github.base_ref }}
- name: Checkout
uses: actions/checkout@v6
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ inputs.php-version }}
tools: composer
coverage: xdebug
- name: Download coverage files
uses: actions/download-artifact@v6
with:
path: build/cov
- name: Display structure of downloaded files
run: ls -R
working-directory: build/cov
- name: Get composer cache directory
run: |
echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV
- name: Cache dependencies
uses: actions/cache@v4
with:
path: ${{ env.COMPOSER_CACHE_FILES_DIR }}
key: ${{ github.job }}-php-${{ inputs.php-version }}-${{ hashFiles('**/composer.*') }}
restore-keys: |
${{ github.job }}-php-${{ inputs.php-version }}-
${{ github.job }}-
- name: Cache PHPUnit's static analysis cache
uses: actions/cache@v4
with:
path: build/.phpunit.cache/code-coverage
key: phpunit-code-coverage-${{ hashFiles('**/phpunit.*') }}
restore-keys: |
phpunit-code-coverage-
- name: Install dependencies
run: composer update --ansi
- name: Merge coverage files
run: |
jq '.autoload."psr-4" += {"Config\\": "app/Config/"}' composer.json > temp.json && mv temp.json composer.json
composer dump-autoload
vendor/bin/phpcov merge --clover build/logs/clover.xml build/cov
- name: Upload coverage to Coveralls
run: |
composer global require php-coveralls/php-coveralls
php-coveralls --verbose --exclude-no-stmt --ansi
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}