Skip to content

Commit 85c37ef

Browse files
committed
codestyle
1 parent fc26207 commit 85c37ef

File tree

4 files changed

+105
-0
lines changed

4 files changed

+105
-0
lines changed

.github/php-syntax.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"problemMatcher": [
3+
{
4+
"owner": "php -l",
5+
"pattern": [
6+
{
7+
"regexp": "^\\s*(PHP\\s+)?([a-zA-Z\\s]+):\\s+(.*)\\s+in\\s+(\\S+)\\s+on\\s+line\\s+(\\d+)$",
8+
"file": 4,
9+
"line": 5,
10+
"message": 3
11+
}
12+
]
13+
}
14+
]
15+
}

.github/workflows/codestyle.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Code Style
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
php:
9+
name: PHP
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- name: Setup PHP with tools
14+
uses: shivammathur/setup-php@v2
15+
with:
16+
php-version: '8.1'
17+
extensions: ctype, dom, exif, gd, gmp, hash, intl, json, libxml, mbstring, opcache, pcre, pdo, pdo_mysql, zlib
18+
tools: cs2pr, phpcs, php-cs-fixer
19+
- name: phpcs
20+
run: phpcs -n -q --report=checkstyle | cs2pr
21+
- name: php-cs-fixer
22+
run: php-cs-fixer fix --dry-run --diff

.github/workflows/php.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: PHP
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
syntax:
9+
name: "Check Syntax (${{ matrix.php }})"
10+
runs-on: ubuntu-latest
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
php:
15+
- '8.1'
16+
- '8.2'
17+
- '8.3'
18+
- '8.4'
19+
steps:
20+
- name: Set up PHP
21+
uses: shivammathur/setup-php@v2
22+
with:
23+
php-version: ${{ matrix.php }}
24+
- uses: actions/checkout@v4
25+
- run: echo "::add-matcher::.github/php-syntax.json"
26+
- run: |
27+
! find . -type f -name '*.php' -exec php -l '{}' \; 2>&1 |grep -v '^No syntax errors detected'

.github/workflows/release.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags: ['*']
6+
workflow_dispatch:
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- uses: actions/setup-node@v3
18+
with:
19+
node-version: 20
20+
21+
- name: Create package
22+
run: |
23+
rm -rf *.tar.gz
24+
npx --yes wspackager@latest
25+
26+
- name: Check file existence
27+
id: check_files
28+
uses: andstor/file-existence-action@v2.0.0
29+
with:
30+
files: "*.tar.gz"
31+
32+
- name: On Build Failure
33+
if: steps.check_files.outputs.files_exists == 'false'
34+
run: |
35+
echo "Packaging FAILED" && exit 1
36+
37+
- name: Release
38+
uses: softprops/action-gh-release@v0.1.15
39+
if: startsWith(github.ref, 'refs/tags/') && steps.check_files.outputs.files_exists == 'true'
40+
with:
41+
files: "*.tar.gz"

0 commit comments

Comments
 (0)