Skip to content

Commit f361ea8

Browse files
committed
feat: add code-coverage workflow
1 parent 720a857 commit f361ea8

File tree

1 file changed

+77
-0
lines changed

1 file changed

+77
-0
lines changed

.github/workflows/testing.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
---
2+
3+
on: # yamllint disable-line rule:truthy
4+
pull_request:
5+
branches:
6+
- master
7+
- develop
8+
9+
name: 🧪 Testing (SQLite)
10+
11+
env:
12+
# Disable docker support in Makefile
13+
APP_RUNNER: 'cd app &&'
14+
15+
jobs:
16+
code-coverage:
17+
timeout-minutes: 4
18+
runs-on: ${{ matrix.os }}
19+
concurrency:
20+
cancel-in-progress: true
21+
group: code-coverage-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-${{ matrix.php-version }}-${{ matrix.dependencies }}
22+
strategy:
23+
fail-fast: true
24+
matrix:
25+
os:
26+
- ubuntu-latest
27+
php-version:
28+
- '8.3'
29+
dependencies:
30+
- locked
31+
steps:
32+
- name: 📦 Check out the codebase
33+
uses: actions/checkout@v4.1.6
34+
35+
- name: 🛠️ Setup PHP
36+
uses: shivammathur/setup-php@2.30.4
37+
with:
38+
php-version: ${{ matrix.php-version }}
39+
extensions: none, ctype, dom, json, mbstring, simplexml, tokenizer, xml, xmlwriter, pdo, pdo_mysql, pdo_sqlite, curl, fileinfo, opcache, pcntl, posix
40+
ini-values: error_reporting=E_ALL
41+
coverage: xdebug
42+
43+
- name: 🛠️ Setup problem matchers
44+
run: |
45+
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
46+
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
47+
48+
- name: 🤖 Validate composer.json and composer.lock
49+
run: make validate-composer
50+
51+
- name: 🔍 Get composer cache directory
52+
uses: wayofdev/gh-actions/actions/composer/get-cache-directory@v3.1.0
53+
with:
54+
working-directory: app
55+
56+
- name: ♻️ Restore cached dependencies installed with composer
57+
uses: actions/cache@v4.0.2
58+
with:
59+
path: ${{ env.COMPOSER_CACHE_DIR }}
60+
key: php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}
61+
restore-keys: php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-
62+
63+
- name: 📥 Install "${{ matrix.dependencies }}" dependencies with composer
64+
uses: wayofdev/gh-actions/actions/composer/install@v3.1.0
65+
with:
66+
working-directory: app
67+
dependencies: ${{ matrix.dependencies }}
68+
69+
- name: 🧪 Collect code coverage with Xdebug and pestphp/pest
70+
run: make test-cc
71+
72+
- name: 📤 Upload code coverage report to Codecov
73+
uses: codecov/codecov-action@v4.4.1
74+
with:
75+
files: app/.build/phpunit/logs/clover.xml
76+
token: ${{ secrets.CODECOV_TOKEN }}
77+
verbose: true

0 commit comments

Comments
 (0)