Skip to content

Commit a1f18ee

Browse files
committed
update GitHub Actions
1 parent 9916c8e commit a1f18ee

File tree

6 files changed

+137
-10
lines changed

6 files changed

+137
-10
lines changed

.github/diff.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"problemMatcher": [
3+
{
4+
"owner": "diff",
5+
"pattern": [
6+
{
7+
"regexp": "--- a/(.*)",
8+
"file": 1,
9+
"message": 1
10+
}
11+
]
12+
}
13+
]
14+
}

.github/javascript-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": "node -c",
5+
"pattern": [
6+
{
7+
"regexp": "^(./\\S+):(\\d+) - (.*)$",
8+
"file": 1,
9+
"line": 2,
10+
"message": 3
11+
}
12+
]
13+
}
14+
]
15+
}

.github/workflows/codestyle.yml

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,31 @@ name: Code Style
22

33
on:
44
push:
5+
branches:
6+
- main
7+
paths:
8+
- '**.php'
9+
- '**.ts'
10+
- '**.scss'
511
pull_request:
12+
paths:
13+
- '**.php'
14+
- '**.ts'
15+
- '**.scss'
616

717
jobs:
8-
phpcs:
9-
name: PHPCS
10-
runs-on: ubuntu-latest
18+
php:
19+
name: PHP
20+
runs-on: self-hosted
1121
steps:
12-
- uses: actions/checkout@v2
13-
- name: PHPCS check
14-
uses: chekalsky/phpcs-action@v1
22+
- uses: actions/checkout@v3
23+
- name: Setup PHP with tools
24+
uses: shivammathur/setup-php@v2
25+
with:
26+
php-version: '8.1'
27+
extensions: ctype, dom, exif, gd, gmp, hash, intl, json, libxml, mbstring, opcache, pcre, pdo, pdo_mysql, zlib
28+
tools: cs2pr, phpcs, php-cs-fixer
29+
- name: phpcs
30+
run: phpcs -n -q --report=checkstyle | cs2pr
31+
- name: php-cs-fixer
32+
run: php-cs-fixer fix --dry-run --diff

.github/workflows/php.yml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,35 @@ name: PHP
22

33
on:
44
push:
5+
branches:
6+
- main
7+
tags-ignore:
8+
- '**'
9+
paths:
10+
- '**.php'
511
pull_request:
12+
paths:
13+
- '**.php'
614

715
jobs:
816
syntax:
917
name: "Check Syntax (${{ matrix.php }})"
10-
runs-on: ubuntu-latest
18+
runs-on: self-hosted
1119
strategy:
1220
fail-fast: false
1321
matrix:
1422
php:
15-
- '7.4'
16-
- '8.0'
1723
- '8.1'
1824
- '8.2'
1925
steps:
26+
- uses: actions/checkout@v3
2027
- name: Set up PHP
2128
uses: shivammathur/setup-php@v2
2229
with:
2330
php-version: ${{ matrix.php }}
24-
- uses: actions/checkout@v3
2531
- run: echo "::add-matcher::.github/php-syntax.json"
32+
- name: Remove files to be ignored
33+
run: |
34+
true
2635
- run: |
2736
! find . -type f -name '*.php' -exec php -l '{}' \; 2>&1 |grep -v '^No syntax errors detected'

.github/workflows/pull_request.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Pull Requests
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- edited
8+
- reopened
9+
- synchronize
10+
- ready_for_review
11+
- review_requested
12+
13+
jobs:
14+
commit_message:
15+
name: Check Commit Message
16+
runs-on: self-hosted
17+
steps:
18+
- name: Check for GitHub's default message.
19+
uses: gsactions/commit-message-checker@c61c81192182bbc0d5e41b4796e3b71684228c77
20+
with:
21+
pattern: '^(?!Update\s+\S*$).*$'
22+
error: 'Please use a meaningful commit message.'
23+
excludeDescription: 'true'
24+
excludeTitle: 'true'
25+
checkAllCommitMessages: 'true'
26+
accessToken: ${{ secrets.GITHUB_TOKEN }}
27+
- name: Check for unsquashed `fixup!` commits.
28+
if: ${{ ! github.event.pull_request.draft }}
29+
uses: gsactions/commit-message-checker@c61c81192182bbc0d5e41b4796e3b71684228c77
30+
with:
31+
pattern: '^(?!fixup!(\s|$))'
32+
error: 'A `fixup!` commit was found.'
33+
excludeDescription: 'true'
34+
excludeTitle: 'true'
35+
checkAllCommitMessages: 'true'
36+
accessToken: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yml

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

0 commit comments

Comments
 (0)