Skip to content

Commit ed24e65

Browse files
committed
feat: add github action
Signed-off-by: Vitor Mattos <[email protected]>
1 parent 5e0a028 commit ed24e65

2 files changed

Lines changed: 83 additions & 0 deletions

File tree

.github/workflows/phpunit.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: PHPUnit
2+
3+
on: pull_request
4+
5+
permissions:
6+
contents: read
7+
8+
concurrency:
9+
group: phpunit
10+
cancel-in-progress: true
11+
12+
jobs:
13+
changes:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: read
17+
pull-requests: read
18+
19+
outputs:
20+
src: ${{ steps.changes.outputs.src }}
21+
22+
steps:
23+
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
24+
id: changes
25+
continue-on-error: true
26+
with:
27+
filters: |
28+
src:
29+
- '.github/workflows/**'
30+
- 'src/**'
31+
- 'tests/**'
32+
- 'vendor/**'
33+
- 'composer.json'
34+
- 'composer.lock'
35+
36+
phpunit:
37+
runs-on: ubuntu-latest
38+
39+
strategy:
40+
matrix:
41+
php-versions: [8.1, 8.2, 8.3, 8.4]
42+
43+
name: PHP ${{ matrix.php-versions }}
44+
45+
steps:
46+
- name: Checkout
47+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
48+
with:
49+
persist-credentials: false
50+
51+
- name: Set up php ${{ matrix.php-versions }}
52+
uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 # v2.31.1
53+
with:
54+
php-version: ${{ matrix.php-versions }}
55+
extensions: json, openssl
56+
coverage: xdebug
57+
ini-file: development
58+
env:
59+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
60+
61+
- name: Set up dependencies
62+
run: composer i
63+
64+
- name: PHPUnit
65+
run: composer run test:unit
66+
67+
summary:
68+
permissions:
69+
contents: none
70+
runs-on: ubuntu-latest
71+
needs: [changes, phpunit]
72+
73+
if: always()
74+
75+
name: phpunit-summary
76+
77+
steps:
78+
- name: Summary status
79+
run: if ${{ needs.changes.outputs.src != 'false' && needs.phpunit.result != 'success' }}; then exit 1; fi

composer.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,9 @@
3535
"psr-4": {
3636
"Jeidison\\JSignPDF\\Tests\\": "tests/"
3737
}
38+
},
39+
"scripts": {
40+
"test:unit": "vendor/bin/phpunit -c tests/php/phpunit.xml --no-coverage --colors=always --fail-on-warning --fail-on-risky --display-deprecations --display-phpunit-deprecations",
41+
"test:coverage": "XDEBUG_MODE=coverage vendor/bin/phpunit -c tests/php/phpunit.xml"
3842
}
3943
}

0 commit comments

Comments
 (0)