Skip to content

Commit 78ea6d0

Browse files
author
github-ci
committed
chore(php-monorepo): 添加 composer-dependency-analyser 和相关 CI 配置
1 parent d8cfb8f commit 78ea6d0

File tree

4 files changed

+50
-4
lines changed

4 files changed

+50
-4
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Composer dependency analyse
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
pull_request:
7+
branches: [ "master" ]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
build:
14+
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Validate composer.json and composer.lock
21+
run: composer validate --strict
22+
23+
- name: Cache Composer packages
24+
id: composer-cache
25+
uses: actions/cache@v3
26+
with:
27+
path: vendor
28+
key: ${{ runner.os }}-php-${{ hashFiles("**/composer.lock") }}
29+
restore-keys: |
30+
${{ runner.os }}-php-
31+
32+
- name: Install dependencies
33+
run: composer install --prefer-dist --no-progress
34+
35+
- name: Detect composer dependency issues
36+
run: vendor/bin/composer-dependency-analyser
37+

.github/workflows/phpstan.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@ jobs:
3333
run: composer install --prefer-dist --no-progress
3434

3535
- name: Run PHPStan
36-
run: composer run-script phpstan
36+
run: ./vendor/bin/phpstan analyse src -l 1

composer-dependency-analyser.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use ShipMonk\ComposerDependencyAnalyser\Config\Configuration;
6+
7+
$config = new Configuration();
8+
9+
return $config
10+
->addPathToScan(__DIR__ . "/src", false)
11+
->disableExtensionsAnalysis();
12+

composer.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,5 @@
3030
"phpunit/phpunit": "^10.0",
3131
"phpstan/phpstan": "^2.1",
3232
"maglnet/composer-require-checker": "^4"
33-
},
34-
"scripts": {
35-
"phpstan": "phpstan analyse src -l 1"
3633
}
3734
}

0 commit comments

Comments
 (0)