Skip to content
This repository was archived by the owner on Jun 4, 2024. It is now read-only.

Commit 75cf0e3

Browse files
committed
add github actions; update cs-fixer version; exclude templates from csfixer
1 parent 48b98f0 commit 75cf0e3

File tree

4 files changed

+64
-3
lines changed

4 files changed

+64
-3
lines changed

.github/workflows/test.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: yii2-openapi
2+
on:
3+
push:
4+
branches: [ master, wip]
5+
pull_request:
6+
branches: [ master, wip ]
7+
paths-ignore:
8+
- 'docs/**'
9+
- '*.md'
10+
11+
jobs:
12+
test:
13+
if: "!contains(github.event.head_commit.message, 'skip ci') && !contains(github.event.head_commit.message, 'ci skip')"
14+
name: yii2-openapi (PHP ${{ matrix.php-versions }})
15+
runs-on: ubuntu-latest
16+
env:
17+
DB_USERNAME: dbuser
18+
DB_PASSWORD: dbpass
19+
DB_CHARSET: utf8
20+
strategy:
21+
fail-fast: true
22+
matrix:
23+
php-versions: ['7.1', '7.2', '7.3', '7.4']
24+
steps:
25+
- uses: actions/checkout@v2
26+
27+
- name: Setup PHP, with composer and extensions
28+
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
29+
with:
30+
php-version: ${{ matrix.php-versions }}
31+
extensions: mbstring, intl, gd, zip, dom, pgsql
32+
tools: php-cs-fixer
33+
34+
- name: Get composer cache directory
35+
id: composercache
36+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
37+
38+
- name: Cache Composer packages
39+
id: composer-cache
40+
uses: actions/cache@v2
41+
with:
42+
path: ${{ steps.composercache.outputs.dir }}
43+
key: ${{ runner.os }}-php-${{ matrix.php-versions }}-${{ hashFiles('**/composer.json') }}
44+
restore-keys: |
45+
${{ runner.os }}-php-${{ matrix.php-versions }}
46+
47+
- name: Install deps
48+
run: composer install --prefer-dist --no-progress --no-suggest --optimize-autoloader
49+
50+
- name: Prepare permissions
51+
run: mkdir -p tests/tmp && chmod -R 0777 tests/tmp
52+
53+
- name: Unit tests
54+
run: php vendor/bin/phpunit
55+
56+
- name: Check style
57+
run: make check-style
58+

.php_cs.dist

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
<?php
2-
2+
$finder = PhpCsFixer\Finder::create()
3+
->in(['src'])
4+
->exclude(['default']);
35
return PhpCsFixer\Config::create()
6+
->setFinder($finder)
47
->setRules([
58
'@PSR2' => true,
69
'array_syntax' => ['syntax' => 'short'],

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ PHPARGS=-dmemory_limit=64M
55
all:
66

77
check-style:
8-
vendor/bin/php-cs-fixer fix src/ --diff --dry-run
8+
vendor/bin/php-cs-fixer fix --diff --dry-run
99

1010
fix-style:
1111
vendor/bin/indent --tabs composer.json

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
},
2929
"require-dev": {
3030
"cebe/indent": "*",
31-
"friendsofphp/php-cs-fixer": "~2.13.1",
31+
"friendsofphp/php-cs-fixer": "~2.16",
3232
"phpunit/phpunit": "^6.5|^8.0|^9.0",
3333
"yiisoft/yii2-gii": ">=2.1.0"
3434
},

0 commit comments

Comments
 (0)