Skip to content

Commit d1209ef

Browse files
committed
Add badge and integrate to CI
1 parent 964f145 commit d1209ef

File tree

3 files changed

+50
-6
lines changed

3 files changed

+50
-6
lines changed

.github/workflows/test.yml

+47-5
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
name: run-tests
22

33
on:
4+
pull_request: null
45
push:
5-
pull_request:
6-
schedule:
7-
- cron: '0 0 * * *'
6+
branches:
7+
- main
88

99
jobs:
1010
test:
1111
runs-on: ${{ matrix.os }}
1212
strategy:
1313
matrix:
1414
os: [ ubuntu-latest ]
15-
php: [ 7.4, 7.3, 7.2 ]
15+
php: [ 8.0, 7.4, 7.3, 7.2 ]
1616
dependency-version: [ prefer-lowest, prefer-stable ]
1717

1818
name: P${{ matrix.php }} - ${{ matrix.dependency-version }} - ${{ matrix.os }}
@@ -38,4 +38,46 @@ jobs:
3838
run: composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest
3939

4040
- name: Execute tests
41-
run: vendor/bin/phpunit --teamcity
41+
run: composer ci
42+
43+
- uses: actions/upload-artifact@v2
44+
with:
45+
name: build-${{ matrix.php }}
46+
path: build
47+
48+
upload-coverage:
49+
needs:
50+
- test
51+
runs-on: ubuntu-latest
52+
strategy:
53+
matrix:
54+
php: [ 8.0, 7.4, 7.3, 7.2 ]
55+
steps:
56+
- name: Checkout code
57+
uses: actions/checkout@v2
58+
- name: Use PHP
59+
uses: shivammathur/setup-php@v2
60+
with:
61+
php-version: ${{ matrix.php }}
62+
coverage: pcov
63+
- uses: actions/download-artifact@v2
64+
with:
65+
name: build-${{ matrix.php }}
66+
path: build
67+
- name: Publish coverage
68+
uses: codecov/codecov-action@v1
69+
with:
70+
file: ./build/clover.xml
71+
72+
delete-artifacts:
73+
needs:
74+
- test
75+
- upload-coverage
76+
runs-on: ubuntu-latest
77+
strategy:
78+
matrix:
79+
php: [ 8.0, 7.4, 7.3, 7.2 ]
80+
steps:
81+
- uses: geekyeggo/delete-artifact@v1
82+
with:
83+
name: build-${{ matrix.php }}

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# PHP Enum
22

33
![Tests](https://github.com/ekvedaras/php-enum/workflows/run-tests/badge.svg)
4+
[![Code Coverage](https://img.shields.io/codecov/c/gh/ekvedaras/php-enum/main?style=flat)](https://app.codecov.io/gh/ekvedaras/php-enum)
45
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat)](LICENSE)
56
[![Latest Version on Packagist](https://img.shields.io/packagist/v/ekvedaras/php-enum.svg?style=flat)](https://packagist.org/packages/ekvedaras/php-enum)
67
[![Total Downloads](https://img.shields.io/packagist/dt/ekvedaras/php-enum.svg?style=flat)](https://packagist.org/packages/ekvedaras/php-enum)

composer.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@
4545
},
4646
"scripts": {
4747
"test": "phpunit",
48-
"cover": "phpunit --coverage-html=build"
48+
"cover": "phpunit --coverage-html=build",
49+
"ci": "phpunit --coverage-clover=build/clover.xml --coverage-xml=build/coverage-xml --log-junit=build/junit.xml"
4950
},
5051
"config": {
5152
"sort-packages": true

0 commit comments

Comments
 (0)