1+ name : Coverage Report
2+
3+ defaults :
4+ run :
5+ shell : bash
6+
7+ on :
8+ push :
9+ branches :
10+ - master
11+ workflow_dispatch :
12+
13+ jobs :
14+ coverage :
15+ name : Generate Coverage Report
16+ runs-on : ubuntu-latest
17+
18+ env :
19+ PHP_V : ' 8.1'
20+ DB : ' sqlite'
21+
22+ steps :
23+ - name : " System Install Dependencies"
24+ run : sudo apt-get install -y sqlite3 libsodium-dev
25+
26+ - name : " Checkout code"
27+ uses : actions/checkout@v4
28+ with :
29+ fetch-depth : 0
30+
31+ - name : " Set up PHP"
32+ uses : shivammathur/setup-php@v2
33+ with :
34+ php-version : ' 8.1'
35+ extensions : pdo, sodium, sqlite, pdo_mysql, pdo_pgsql, memcached, redis, gd, gnupg, xdebug
36+ tools : phpunit, composer
37+ ini-values : cgi.fix_pathinfo=1, xdebug.mode=coverage
38+ env :
39+ update : true
40+ fail-fast : true
41+
42+ - name : " Composer Install Dependencies"
43+ run : |
44+ composer install
45+ composer require --dev php-coveralls/php-coveralls
46+
47+ - name : " Setup Database for Coverage"
48+ run : |
49+ FILE=/tmp/test.db
50+ cat tests/phpunit/data/schema_sqlite.sql | sqlite3 ${FILE}
51+ cat tests/phpunit/data/seed.sql | sqlite3 ${FILE}
52+ env :
53+ DB_DRIVER : sqlite
54+ DB_NAME : cypht_test
55+ DB_CONNECTION_TYPE : socket
56+ DB_SOCKET : /tmp/test.db
57+
58+ - name : " Generate Coverage Report"
59+ run : |
60+ mkdir -p build/logs
61+ phpunit --bootstrap vendor/autoload.php \
62+ --configuration tests/phpunit/phpunit.xml \
63+ --coverage-clover build/logs/clover.xml \
64+ --testdox
65+ env :
66+ DB_DRIVER : sqlite
67+ DB_NAME : cypht_test
68+ DB_CONNECTION_TYPE : socket
69+ DB_SOCKET : /tmp/test.db
70+
71+ - name : " Upload Coverage to Coveralls"
72+ uses : coverallsapp/github-action@v2
73+ with :
74+ github-token : ${{ secrets.COVERALLS_REPO_TOKEN }}
75+ file : build/logs/clover.xml
76+ format : clover
77+ fail-on-error : false
78+
79+ - name : " Upload Coverage Artifacts"
80+ uses : actions/upload-artifact@v4
81+ with :
82+ name : coverage-report
83+ path : build/logs/
84+ retention-days : 7
0 commit comments