Skip to content

Commit 5e76246

Browse files
committed
Add GitHub workflows 'testing' and 'coverage'
1 parent 7c37ab7 commit 5e76246

File tree

3 files changed

+81
-2
lines changed

3 files changed

+81
-2
lines changed

.github/workflows/coverage.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Coverage
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
7+
jobs:
8+
run:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v2
14+
15+
- name: Setup PHP
16+
uses: shivammathur/setup-php@v2
17+
with:
18+
php-version: '7.2'
19+
coverage: xdebug
20+
21+
- name: Install dependencies
22+
run: composer update --prefer-dist --no-progress
23+
24+
- name: Run PHPUnit test suite
25+
run: ./vendor/bin/phpunit
26+
27+
- name: Update code coverage badge
28+
uses: timkrase/[email protected]
29+
with:
30+
report: ./clover.xml
31+
report_type: clover
32+
coverage_badge_path: ./.github/coverage.svg
33+
push_badge: true
34+
repo_token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/testing.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Testing
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
run:
11+
runs-on: ${{ matrix.operating-system }}
12+
strategy:
13+
matrix:
14+
operating-system: [ 'ubuntu-latest', 'windows-latest', 'macos-latest' ]
15+
php-version: [ '7.2', '7.3', '7.4', '8.0' ]
16+
include:
17+
- operating-system: ubuntu-latest
18+
php-version: '7.2'
19+
fail-fast: false
20+
21+
steps:
22+
- uses: actions/checkout@v2
23+
24+
- name: Setup PHP
25+
uses: shivammathur/setup-php@v2
26+
with:
27+
php-version: ${{ matrix.php-version }}
28+
coverage: xdebug
29+
30+
- name: Validate composer.json and composer.lock
31+
run: composer validate
32+
33+
- name: Install dependencies
34+
run: composer update --prefer-dist --no-progress
35+
36+
- name: Run Psalm static code analysis
37+
run: ./vendor/bin/psalm
38+
39+
- name: Run PHPUnit test suite
40+
run: ./vendor/bin/phpunit
41+
42+
- name: Check code coverage
43+
run: ./vendor/bin/coverage clover.xml 100
44+
if: matrix.php-version != '8.0'

composer.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@
3636
"require-dev": {
3737
"phpunit/phpunit": "^8",
3838
"mockery/mockery": "^1.3",
39-
"symfony/yaml": "^5.2",
40-
"vimeo/psalm": "^4.4"
39+
"symfony/yaml": "^4.4",
40+
"vimeo/psalm": "^4.4",
41+
"incompass/coverage": "^1.0"
4142
}
4243
}

0 commit comments

Comments
 (0)