Skip to content

Commit a7d2a3e

Browse files
committed
Run tests on Github
1 parent c622fcb commit a7d2a3e

4 files changed

Lines changed: 108 additions & 1 deletion

File tree

.github/workflows/tests.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [main, master]
6+
pull_request:
7+
branches: [main, master]
8+
9+
jobs:
10+
tests:
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
php: ['8.3', '8.4']
17+
18+
name: PHP ${{ matrix.php }}
19+
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v4
23+
24+
- name: Setup PHP
25+
uses: shivammathur/setup-php@v2
26+
with:
27+
php-version: ${{ matrix.php }}
28+
extensions: mbstring, json, curl
29+
coverage: none
30+
31+
- name: Install dependencies
32+
run: composer install --prefer-dist --no-interaction --no-progress
33+
34+
- name: Run tests
35+
run: composer test
36+
37+
code-style:
38+
runs-on: ubuntu-latest
39+
name: Code Style
40+
41+
steps:
42+
- name: Checkout code
43+
uses: actions/checkout@v4
44+
45+
- name: Setup PHP
46+
uses: shivammathur/setup-php@v2
47+
with:
48+
php-version: '8.3'
49+
extensions: mbstring
50+
coverage: none
51+
52+
- name: Install dependencies
53+
run: composer install --prefer-dist --no-interaction --no-progress
54+
55+
- name: Check code style
56+
run: composer cs
57+
58+
static-analysis:
59+
runs-on: ubuntu-latest
60+
name: Static Analysis
61+
62+
steps:
63+
- name: Checkout code
64+
uses: actions/checkout@v4
65+
66+
- name: Setup PHP
67+
uses: shivammathur/setup-php@v2
68+
with:
69+
php-version: '8.3'
70+
extensions: mbstring
71+
coverage: none
72+
73+
- name: Install dependencies
74+
run: composer install --prefer-dist --no-interaction --no-progress
75+
76+
- name: Run PHPStan
77+
run: composer analyse

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
vendor/
1+
/vendor/
2+
composer.lock
3+
.phpunit.cache/
4+
.phpstan.cache/
5+
.php-cs-fixer.cache

.php-cs-fixer.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
$finder = PhpCsFixer\Finder::create()
6+
->in(__DIR__ . '/src')
7+
->in(__DIR__ . '/tests');
8+
9+
return (new PhpCsFixer\Config())
10+
->setRiskyAllowed(true)
11+
->setRules([
12+
'@PSR12' => true,
13+
'strict_param' => true,
14+
'declare_strict_types' => true,
15+
'array_syntax' => ['syntax' => 'short'],
16+
'ordered_imports' => ['sort_algorithm' => 'alpha'],
17+
'no_unused_imports' => true,
18+
'trailing_comma_in_multiline' => true,
19+
'single_quote' => true,
20+
])
21+
->setFinder($finder);

phpstan.neon

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
parameters:
2+
level: 8
3+
paths:
4+
- src
5+
tmpDir: .phpstan.cache

0 commit comments

Comments
 (0)