forked from pmmp/ExamplePlugin
-
Notifications
You must be signed in to change notification settings - Fork 0
97 lines (89 loc) · 3.13 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
name: CI
on:
# push:
pull_request:
types:
- synchronize
- opened
- closed
branches:
- "!poggit"
workflow_dispatch:
jobs:
phpstan:
name: PHPStan analysis
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php:
- "8.0.19"
steps:
- uses: actions/checkout@v3
- name: Setup PHP
uses: pmmp/setup-php-action@247e08acd52c1465f8f144c162c88f079d8c1174
with:
php-version: ${{ matrix.php }}
install-path: "./bin"
- name: Restore Composer package cache
id: composer-cache
uses: actions/cache@v2
with:
path: "~/.cache/composer"
key: "php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}"
restore-keys: "php-${{ matrix.php }}-composer-"
- name: Install PHPStan Composer dependencies
run: composer install --prefer-dist --no-interaction
- name: Run PHPStan
run: vendor/bin/phpstan analyze
suites:
name: suite tests
needs: [phpstan]
runs-on: ubuntu-latest
strategy:
matrix:
suite-name:
- normal
pocketmine-version:
- "4" # latest ??
- "4.0.0"
steps:
- uses: actions/checkout@v3
- run: make suitetest/cases/${{matrix.suite-name}} DIFF="diff -y" POCKETMINE_VERSION=${{matrix.pocketmine-version}}
fix-cs:
name: Fix CS violations
runs-on: ubuntu-latest
if: "!contains(github.event_name, 'pull_request') || github.event.pull_request.merged"
needs:
- phpstan
steps:
- uses: actions/checkout@v3
- uses: docker://oskarstark/php-cs-fixer-ga:latest
with:
args: --config=.php-cs-fixer.php --diff
- name: Set cpr step parameters under pull request context
id: cpr-param4pr
if: contains(github.event_name, 'pull_request')
run: |
echo "Event context: ${{ github.event_name }}"
echo "::set-output name=fixed::${{ github.base_ref }} after merging ${{ github.head_ref }}"
- uses: peter-evans/create-pull-request@v4
id: cpr
with:
base: ${{ github.base_ref || '' }}
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Apply php-cs-fixer changes as of ${{ github.sha }}
title: Fix coding standards in ${{ steps.cpr-param4pr.outputs.fixed || github.ref }}
branch: php-cs-fixer/${{ github.sha }}
delete-branch: true
assignees: ${{ github.actor }}
committer: "github-actions[bot]"
body: |
Please apply these changes on the ${{ github.base_ref || github.ref }} branch to fix coding standard violations.
- uses: thollander/actions-comment-pull-request@v1
if: contains(github.event_name, 'pull_request') && steps.cpr.outputs.pull-request-number
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
message: |
# Thank you for your contribution!
@${{ github.event.pull_request.user.login }} Your changes are reformatted in #${{ steps.cpr.outputs.pull-request-number }} to assimilate with the repository's code style and standard.