Skip to content

Commit 9d9bbcb

Browse files
committed
📦 Introduce phpunit + phpstan CI checks
1 parent 395ff27 commit 9d9bbcb

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed

.github/workflows/test.yaml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: test
2+
on:
3+
pull_request: ~
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
test:
10+
runs-on: ubuntu-latest
11+
name: test
12+
strategy:
13+
matrix:
14+
install-args: ['']
15+
php-version: ['8.1', '8.2', '8.3', '8.4']
16+
fail-fast: false
17+
steps:
18+
# Cancel previous runs of the same branch
19+
- name: cancel
20+
uses: styfle/cancel-workflow-action@0.12.1
21+
with:
22+
access_token: ${{ github.token }}
23+
24+
- name: checkout
25+
uses: actions/checkout@v5
26+
27+
- name: php
28+
uses: shivammathur/setup-php@2.35.5
29+
with:
30+
php-version: ${{ matrix.php-version }}
31+
ini-values: zend.assertions=1
32+
33+
- name: composer-cache-dir
34+
id: composercache
35+
run: |
36+
echo "::set-output name=dir::$(composer config cache-files-dir)"
37+
38+
- name: composer-cache
39+
uses: actions/cache@v4.2.4
40+
with:
41+
path: ${{ steps.composercache.outputs.dir }}
42+
key: composer-${{ hashFiles('**/composer.json') }}-${{ matrix.install-args }}
43+
restore-keys: |
44+
composer-${{ hashFiles('**/composer.json') }}-${{ matrix.install-args }}
45+
composer-${{ hashFiles('**/composer.json') }}-
46+
composer-
47+
48+
- name: composer
49+
run: |
50+
composer update ${{ matrix.install-args }} --no-interaction --no-progress --prefer-dist
51+
52+
- name: phpunit
53+
run: |
54+
vendor/bin/phpunit --no-coverage
55+
56+
- name: phpstan-cache
57+
uses: actions/cache@v4.2.4
58+
with:
59+
key: phpstan-${{ matrix.php-version }}-${{ matrix.install-args }}-${{ github.ref }}-${{ github.sha }}
60+
path: .phpstan-cache
61+
restore-keys: |
62+
phpstan-${{ matrix.php-version }}-${{ matrix.install-args }}-${{ github.ref }}-
63+
phpstan-${{ matrix.php-version }}-${{ matrix.install-args }}-
64+
phpstan-${{ matrix.php-version }}-
65+
phpstan-
66+
67+
- name: phpstan
68+
run: |
69+
mkdir -p .phpstan-cache
70+
vendor/bin/phpstan analyse --no-progress --no-interaction --memory-limit=1G

0 commit comments

Comments
 (0)