Skip to content

Commit f7c93b7

Browse files
authored
CI: Setup phpunit github action (#1)
1 parent 327f93e commit f7c93b7

File tree

4 files changed

+77
-1
lines changed

4 files changed

+77
-1
lines changed

.github/FUNDING.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
github: [staabm]

.github/workflows/php-linter.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: PHP Linter
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
types: [opened, synchronize, reopened, ready_for_review]
9+
10+
jobs:
11+
php-linter:
12+
runs-on: ubuntu-latest
13+
if: github.event.pull_request.draft == false
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
with:
18+
repository: ${{ github.event.client_payload.pull_request.head.repo.full_name }}
19+
ref: ${{ github.event.client_payload.pull_request.head.ref }}
20+
21+
- name: Setup PHP
22+
uses: shivammathur/setup-php@v2
23+
with:
24+
php-version: 7.4
25+
coverage: none
26+
tools: parallel-lint
27+
28+
- name: Lint PHP
29+
run: composer exec --no-interaction -- parallel-lint bin/ lib/ tests/

.github/workflows/unit-tests.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Unit tests
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
types: [opened, synchronize, reopened, ready_for_review]
9+
10+
jobs:
11+
phpunit:
12+
runs-on: ${{ matrix.os }}
13+
14+
strategy:
15+
matrix:
16+
include:
17+
- os: ubuntu-latest
18+
php-version: '7.4'
19+
- os: ubuntu-latest
20+
php-version: '8.0'
21+
- os: ubuntu-latest
22+
php-version: '8.1'
23+
- os: ubuntu-latest
24+
php-version: '8.2'
25+
26+
steps:
27+
- name: Checkout
28+
uses: actions/checkout@v4
29+
30+
- name: Setup PHP
31+
uses: shivammathur/setup-php@v2
32+
with:
33+
php-version: ${{ matrix.php-version }}
34+
coverage: none # disable xdebug, pcov
35+
36+
- name: Composer install
37+
uses: ramsey/composer-install@v3
38+
with:
39+
composer-options: '--ansi --prefer-dist'
40+
41+
- name: Setup Problem Matchers for PHPUnit
42+
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
43+
44+
- name: Run unit tests
45+
run: vendor/bin/phpunit --colors=always

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@
55
bundles/*
66
!bundles/.
77

8-
.idea
8+
.idea
9+
.phpunit.result.cache

0 commit comments

Comments
 (0)