-
Notifications
You must be signed in to change notification settings - Fork 2k
83 lines (69 loc) · 2.67 KB
/
reusable-coveralls.yml
File metadata and controls
83 lines (69 loc) · 2.67 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
77
78
79
80
81
82
83
name: Reusable Coveralls Upload
on:
workflow_call:
inputs:
php-version:
description: The PHP version the workflow should run
type: string
required: true
permissions:
contents: read
jobs:
coveralls:
runs-on: ubuntu-24.04
steps:
- name: Checkout base branch for PR
if: github.event_name == 'pull_request'
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ github.base_ref }}
persist-credentials: false
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Setup PHP
uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f # 2.37.0
with:
php-version: ${{ inputs.php-version }}
tools: composer
coverage: xdebug
- name: Download coverage files
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
path: build/cov
- name: Display structure of downloaded files
run: ls -R
working-directory: build/cov
- name: Get composer cache directory
id: composer-cache
run: |
echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: ${{ steps.composer-cache.outputs.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@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
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 }}