Skip to content

Commit 52b3df7

Browse files
committed
ci(ci): Update action references and enhance CI configurations
- Change issues-translate-action reference to dromara/issues-translate-action - Set COMPOSER_NO_SECURITY_BLOCKING environment variable in multiple CI files - Add php-cs-fixer, phpstan, and rector steps for dry-run and error format outputs - Upload phpstan analysis results in SARIF format to GitHub Signed-off-by: guanguans <ityaozm@gmail.com>
1 parent 0887d3c commit 52b3df7

File tree

7 files changed

+107
-3
lines changed

7 files changed

+107
-3
lines changed

.github/workflows/issues-translate.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ jobs:
1111
build:
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: usthe/issues-translate-action@v2.7
14+
- uses: dromara/issues-translate-action@v2.7
1515
with:
1616
IS_MODIFY_TITLE: true

.github/workflows/php-cs-fixer.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
push:
66
pull_request:
77

8+
env:
9+
COMPOSER_NO_SECURITY_BLOCKING: 1
10+
811
jobs:
912
php-cs-fixer:
1013
name: php-cs-fixer
@@ -37,5 +40,9 @@ jobs:
3740
- name: Run composer install
3841
run: composer install --no-interaction --ansi -v
3942

43+
- name: Run php-cs-fixer with annotate-pull-request format
44+
continue-on-error: true
45+
run: composer php-cs-fixer:fix-dry-run-format-annotate-pull-request
46+
4047
- name: Run php-cs-fixer
4148
run: composer php-cs-fixer:fix-dry-run

.github/workflows/phpstan.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ on:
55
push:
66
pull_request:
77

8+
env:
9+
COMPOSER_NO_SECURITY_BLOCKING: 1
10+
11+
permissions:
12+
contents: read
13+
security-events: write
14+
815
jobs:
916
phpstan:
1017
name: phpstan
@@ -37,5 +44,19 @@ jobs:
3744
- name: Run composer install
3845
run: composer install --no-interaction --ansi -v
3946

47+
- name: Run phpstan with sarif error format
48+
continue-on-error: true
49+
run: composer phpstan:analyse-error-format-sarif
50+
51+
- name: Upload the analysis results of sarif to GitHub
52+
uses: github/codeql-action/upload-sarif@v4
53+
with:
54+
sarif_file: .build/phpstan/results.sarif
55+
wait-for-processing: true
56+
57+
- name: Run phpstan with annotate-pull-request error format
58+
continue-on-error: true
59+
run: composer phpstan:analyse-error-format-annotate-pull-request
60+
4061
- name: Run phpstan
4162
run: composer phpstan:analyse

.github/workflows/rector.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
push:
66
pull_request:
77

8+
env:
9+
COMPOSER_NO_SECURITY_BLOCKING: 1
10+
811
jobs:
912
rector:
1013
name: rector
@@ -37,5 +40,9 @@ jobs:
3740
- name: Run composer install
3841
run: composer install --no-interaction --ansi -v
3942

43+
- name: Run rector with github output format
44+
continue-on-error: true
45+
run: composer rector:process-dry-run-output-format-github
46+
4047
- name: Run rector
4148
run: composer rector:process-dry-run

.github/workflows/tests.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
push:
66
pull_request:
77

8+
env:
9+
COMPOSER_NO_SECURITY_BLOCKING: 1
10+
811
jobs:
912
test:
1013
runs-on: ${{ matrix.os }}

.typos.toml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# https://github.com/crate-ci/typos/blob/master/docs/reference.md
2+
# https://github.com/crate-ci/typos/wiki
3+
# https://github.com/GitoxideLabs/gitoxide/blob/main/_typos.toml
4+
# https://github.com/letsencrypt/boulder/blob/main/.typos.toml
5+
# https://github.com/nushell/nushell/blob/main/typos.toml
6+
[files]
7+
ignore-hidden = false
8+
extend-exclude = [
9+
".git/",
10+
"CHANGELOG.md",
11+
]
12+
13+
[default]
14+
extend-ignore-re = [
15+
# https://github.com/sirwart/ripsecrets/blob/main/src/lib.rs
16+
'\b[0-9A-Za-z+/_-]{36,}\b', # Anything base64 or base64url longer than 36 chars is probably encoded.
17+
"at_[0-9a-zA-Z-]+", # 忽略以 at_ 开头的令牌字符串
18+
"[0-9A-Z]{16}", # 忽略评分 ID
19+
]
20+
extend-ignore-identifiers-re = [
21+
"[0-9a-f]{7,}", # Git commit hash
22+
]
23+
extend-ignore-words-re = [
24+
# "Symplify",
25+
]
26+
27+
[default.extend-words]
28+
"Symplify" = "Symplify"
29+
"reguard" = "reguard"
30+
"responsable" = "responsable"
31+
"STATMENT" = "STATMENT"
32+
33+
[default.extend-identifiers]
34+
# "Symplify" = "Symplify"

composer.json

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,8 @@
162162
"@composer:normalize"
163163
],
164164
"actionlint": "actionlint -ignore=SC2035 -ignore=SC2086 -color -oneline -verbose",
165+
"argtyper": "@php vendor/bin/argtyper --ansi -vv",
166+
"argtyper:add-types": "@argtyper add-types .",
165167
"blade-formatter": "blade-formatter resources/views/*.blade.php resources/views/**/*.blade.php --ignore-path= --php-version=8.1 --progress",
166168
"blade-formatter:check-formatted": "@blade-formatter --check-formatted",
167169
"blade-formatter:write": "@blade-formatter --write",
@@ -176,6 +178,7 @@
176178
],
177179
"checks:optional": [
178180
"@putenv:xdebug-off",
181+
"@composer:unlink",
179182
"@class-leak:check",
180183
"@composer-dependency-analyser",
181184
"@composer:normalize-dry-run",
@@ -205,6 +208,7 @@
205208
"@php-cs-fixer:custom-fix-dry-run",
206209
"@php-cs-fixer:custom-ln-config",
207210
"@rule-doc-generator:generate",
211+
"@typos",
208212
"@zhlint"
209213
],
210214
"checks:required": [
@@ -242,6 +246,7 @@
242246
"composer:diff": "@composer diff --with-platform --ansi -vv",
243247
"composer:normalize": "@composer normalize --diff --ansi -vv",
244248
"composer:normalize-dry-run": "@composer:normalize --dry-run",
249+
"composer:unlink": "@php -r \"@unlink('vendor/bin/composer');\"",
245250
"composer:validate": "@composer validate --check-lock --strict --ansi -vv",
246251
"detect-collisions": "@php vendor/bin/detect-collisions examples/ src/",
247252
"facade:lint": "@facade:update --lint",
@@ -307,6 +312,7 @@
307312
"@putenv:xdebug-off"
308313
],
309314
"pest:coverage": "@pest --coverage-html=.build/phpunit/ --coverage-clover=.build/phpunit/clover.xml",
315+
"pest:generate-baseline": "@pest --generate-baseline=phpunit-baseline.xml",
310316
"pest:highest": [
311317
"@putenv:php",
312318
"@putenv:xdebug-on",
@@ -333,6 +339,7 @@
333339
],
334340
"php-cs-fixer:fix": "@php-cs-fixer fix --show-progress=dots --diff",
335341
"php-cs-fixer:fix-dry-run": "@php-cs-fixer:fix --dry-run",
342+
"php-cs-fixer:fix-dry-run-format-annotate-pull-request": "@php vendor/bin/php-cs-fixer --ansi -vv 'fix' '--show-progress=dots' '--diff' '--dry-run' --format=checkstyle | vendor/bin/cs2pr --notices-as-warnings --colorize",
336343
"php-cs-fixer:list-files": "@php-cs-fixer list-files",
337344
"php-cs-fixer:list-sets": "@php-cs-fixer list-sets --ansi -vv",
338345
"php-lint": [
@@ -344,6 +351,14 @@
344351
"phpmnd": "@php vendor/bin/phpmnd src/ --exclude-path=Support/helpers.phpp --ignore-numbers=2,-1 --hint --progress --ansi -vv",
345352
"phpstan": "@php vendor/bin/phpstan --ansi -vv",
346353
"phpstan:analyse": "@phpstan analyse",
354+
"phpstan:analyse-error-format-annotate-pull-request": "@php vendor/bin/phpstan --ansi -vv 'analyse' --error-format=checkstyle | vendor/bin/cs2pr --notices-as-warnings --colorize",
355+
"phpstan:analyse-error-format-checkstyle": "@phpstan:analyse --error-format=checkstyle",
356+
"phpstan:analyse-error-format-github": "@phpstan:analyse --error-format=github",
357+
"phpstan:analyse-error-format-llm": "@phpstan:analyse --error-format=llm",
358+
"phpstan:analyse-error-format-sarif": [
359+
"[ -d .build/phpstan/ ] || mkdir -p .build/phpstan/",
360+
"@php vendor/bin/phpstan --ansi -vv 'analyse' --error-format=sarif > .build/phpstan/results.sarif"
361+
],
347362
"phpstan:analyse-generate-baseline": "@phpstan:analyse --generate-baseline --allow-empty-baseline",
348363
"phpstan:analyse-split-baseline": [
349364
"@phpstan:analyse --generate-baseline=baselines/loader.neon --allow-empty-baseline",
@@ -357,6 +372,10 @@
357372
"@php vendor/bin/pint --ansi -vv"
358373
],
359374
"pint:test": "@pint --test",
375+
"pint:test-format-annotate-pull-request": [
376+
"@putenv:xdebug-off",
377+
"@php vendor/bin/pint --ansi -vv '--test' --format=checkstyle | vendor/bin/cs2pr --notices-as-warnings --colorize"
378+
],
360379
"putenv:composer-memory-unlimited": "@putenv COMPOSER_MEMORY_LIMIT=-1",
361380
"putenv:php": [
362381
"@putenv PHP74=/opt/homebrew/opt/php@7.4/bin/php",
@@ -375,14 +394,20 @@
375394
"rector": "@php vendor/bin/rector",
376395
"rector:custom-rule": "@rector custom-rule",
377396
"rector:list-rules": "@rector list-rules",
378-
"rector:process": "@rector process",
397+
"rector:process": "@rector process --ansi",
379398
"rector:process-clear-cache": "@rector:process --clear-cache",
380399
"rector:process-clear-cache-dry-run": "@rector:process-clear-cache --dry-run",
381400
"rector:process-dry-run": "@rector:process --dry-run",
401+
"rector:process-dry-run-output-format-github": "@rector:process-dry-run --output-format=github",
382402
"rector:process-only": "@rector:process-clear-cache --only=Guanguans\\SoarPHP\\Support\\Rectors\\AddHasOptionsDocCommentRector",
383403
"rector:process-only-dry-run": "@rector:process-only --dry-run",
384404
"rector:process-options": "@rector:process-clear-cache --config=rector-options.php",
385405
"rector:process-options-dry-run": "@rector:process-options --dry-run",
406+
"roave-backward-compatibility-check": [
407+
"@putenv:php",
408+
"$PHP82 vendor/bin/roave-backward-compatibility-check --install-development-dependencies --ansi -vv"
409+
],
410+
"roave-backward-compatibility-check:format-github-actions": "@roave-backward-compatibility-check --format=github-actions",
386411
"rule-doc-generator": [
387412
"@putenv:php",
388413
"$PHP82 rule-doc-generator --ansi -vv"
@@ -398,7 +423,12 @@
398423
"sk:finalize-classes-dry-run": "@sk:finalize-classes --dry-run",
399424
"sk:find-multi-classes": "@sk find-multi-classes examples/ src/",
400425
"sk:generate-symfony-config-builders": "@sk generate-symfony-config-builders --help",
401-
"sk:namespace-to-psr-4": "@sk namespace-to-psr-4 src/ --namespace-root=Guanguans\\SoarPHP\\",
426+
"sk:namespace-to-psr-4": [
427+
"@sk:namespace-to-psr-4-src",
428+
"@sk:namespace-to-psr-4-tests"
429+
],
430+
"sk:namespace-to-psr-4-src": "@sk namespace-to-psr-4 src/ --namespace-root=Guanguans\\SoarPHP\\",
431+
"sk:namespace-to-psr-4-tests": "@sk namespace-to-psr-4 tests/ --namespace-root=Guanguans\\SoarPHPTests\\",
402432
"sk:pretty-json": "@sk pretty-json .lintmdrc",
403433
"sk:pretty-json-dry-run": "@sk:pretty-json --dry-run",
404434
"sk:privatize-constants": "@sk privatize-constants examples/ src/",
@@ -448,6 +478,8 @@
448478
],
449479
"todo-lint": "! git --no-pager grep --extended-regexp --ignore-case 'todo|fixme' -- '*.php' ':!*.blade.php' ':(exclude)resources/'",
450480
"trufflehog": "trufflehog git https://github.com/guanguans/soar-php --only-verified",
481+
"typos": "typos --color=always --sort --verbose",
482+
"typos:write-changes": "@typos --write-changes",
451483
"var-dump-server:cli": "@php vendor/bin/var-dump-server --ansi -vv",
452484
"var-dump-server:html": [
453485
"@composer-config:disable-process-timeout",

0 commit comments

Comments
 (0)