Skip to content

Commit 616b38a

Browse files
authored
Merge pull request #18 from svnldwg/15-github-workflow
15 GitHub workflow
2 parents 19f85f6 + 751ef72 commit 616b38a

File tree

6 files changed

+71
-3925
lines changed

6 files changed

+71
-3925
lines changed

.github/workflows/tests-check.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Tests & Code Check
2+
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
pull_request:
8+
branches:
9+
- master
10+
11+
jobs:
12+
run:
13+
runs-on: ${{ matrix.os }}
14+
strategy:
15+
matrix:
16+
os: [ubuntu-latest]
17+
php: ['7.2', '7.3', '7.4', '8.0']
18+
19+
name: PHP ${{ matrix.php }} Test on ${{ matrix.os }}
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v2
23+
24+
- name: Setup PHP
25+
uses: shivammathur/setup-php@v2
26+
with:
27+
php-version: ${{ matrix.php }}
28+
tools: composer
29+
30+
- name: Validate composer.json and composer.lock
31+
run: composer validate
32+
33+
- name: Get Composer Cache Directory
34+
id: composer-cache
35+
run: |
36+
echo "::set-output name=dir::$(composer config cache-files-dir)"
37+
38+
- name: Cache composer dependencies
39+
uses: actions/cache@v2
40+
with:
41+
path: ${{ steps.composer-cache.outputs.dir }}
42+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
43+
restore-keys: |
44+
${{ runner.os }}-composer-
45+
46+
- name: Install dependencies
47+
run: composer update --prefer-dist --no-progress
48+
49+
- name: Tests
50+
run: composer phpunit
51+
52+
- name: Code check
53+
run: composer check

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
/.idea/
2-
/vendor/
2+
/vendor/
3+
composer.lock

composer.json

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,15 @@
1515
}
1616
],
1717
"require": {
18-
"php": "^7.2",
18+
"php": "^7.2 | ^8.0",
1919
"ext-mbstring": "*",
2020
"nikic/php-parser": "^4.2.3",
21-
"phpstan/phpstan": "^0.12.0"
21+
"phpstan/phpstan": ">=0.11"
2222
},
2323
"require-dev": {
2424
"friendsofphp/php-cs-fixer": "^2.16.4",
25-
"phpunit/phpunit": "^9.4.2"
25+
"phpunit/phpunit": "^8.0 || ^9.0",
26+
"phpstan/phpstan": "^0.12"
2627
},
2728
"config": {
2829
"preferred-install": "dist",
@@ -44,5 +45,14 @@
4445
"psr-4": {
4546
"Svnldwg\\PHPStan\\Test\\": "test/"
4647
}
48+
},
49+
"scripts": {
50+
"check": [
51+
"@cs-check",
52+
"@phpstan"
53+
],
54+
"cs-check": "php-cs-fixer fix --config=dev/csfixer.php_cs --dry-run --diff",
55+
"phpstan": "phpstan analyse -c dev/phpstan.neon --no-progress --memory-limit=1G",
56+
"phpunit": "php vendor/bin/phpunit --configuration=test/Integration/phpunit.xml"
4757
}
4858
}

0 commit comments

Comments
 (0)