Skip to content

Commit 701f59f

Browse files
committed
ci(merge-coverage): add workflow to prove it works
1 parent 16159ba commit 701f59f

File tree

2 files changed

+71
-0
lines changed

2 files changed

+71
-0
lines changed
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: "Merge Coverage"
2+
3+
on: [pull_request]
4+
5+
jobs:
6+
unit:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v4
10+
- uses: shivammathur/setup-php@v2
11+
with:
12+
php-version: '8.1'
13+
tools: composer, phpunit:10
14+
coverage: xdebug
15+
env:
16+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
17+
- run: composer install
18+
- run: phpunit --testsuite unit --coverage-php reports/unit.php
19+
- uses: actions/cache/save@v4
20+
with:
21+
path: reports
22+
key: reports-unit-${{ github.run_id }}
23+
24+
integration:
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@v4
28+
- uses: shivammathur/setup-php@v2
29+
with:
30+
php-version: '8.1'
31+
tools: composer, phpunit:10
32+
coverage: xdebug
33+
env:
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+
- run: composer install
36+
- run: phpunit --testsuite integration --coverage-php reports/integration.php
37+
- uses: actions/cache/save@v4
38+
with:
39+
path: reports
40+
key: reports-integration-${{ github.run_id }}
41+
42+
coverage:
43+
runs-on: ubuntu-latest
44+
needs: [integration, unit]
45+
46+
steps:
47+
- uses: actions/checkout@v4
48+
- uses: actions/cache/restore@v4
49+
with:
50+
path: reports
51+
key: reports-unit-${{ github.run_id }}
52+
- uses: actions/cache/restore@v4
53+
with:
54+
path: reports
55+
key: reports-integration-${{ github.run_id }}
56+
57+
- uses: shivammathur/setup-php@v2
58+
with:
59+
php-version: '8.1'
60+
tools: composer, phpunit:10
61+
coverage: xdebug
62+
env:
63+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
64+
- run: composer install
65+
- run: php bin/merge-coverage.php
66+
67+

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
### MacOs ###
22
.DS_Store
33

4+
### PhpStorm ###
5+
/.idea
6+
47
### Composer ###
58
composer.lock
69
composer.phar
@@ -13,3 +16,4 @@ composer.phar
1316
/reports
1417
!/reports/.keep
1518
/coverage
19+

0 commit comments

Comments
 (0)