Skip to content

Commit ff075ca

Browse files
committed
add github workflow
1 parent dcf8417 commit ff075ca

File tree

2 files changed

+58
-0
lines changed

2 files changed

+58
-0
lines changed

.github/workflows/check.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: 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.4']
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 install --prefer-dist --no-progress
48+
49+
- name: Code check
50+
run: composer check

composer.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,13 @@
1818
"psr-4": {
1919
"LambdaPhpSkeleton\\": "src/"
2020
}
21+
},
22+
"scripts": {
23+
"check": [
24+
"@cs-check",
25+
"@phpstan"
26+
],
27+
"cs-check": "php-cs-fixer fix --config=dev/php-cs-fixer.php_cs --dry-run --diff",
28+
"phpstan": "phpstan analyse -c dev/phpstan.neon --no-progress"
2129
}
2230
}

0 commit comments

Comments
 (0)