Use deptrac to ensure component dependencies

This commit is contained in:
Oskar Stark
2025-11-24 23:18:41 +01:00
parent 9940d5c826
commit 2248f6cf2e
5 changed files with 104 additions and 0 deletions

55
.github/workflows/deptrac.yaml vendored Normal file
View File

@@ -0,0 +1,55 @@
name: deptrac
on:
push:
paths-ignore:
- 'src/*/doc/**'
- 'src/**/*.md'
pull_request:
paths-ignore:
- 'src/*/doc/**'
- 'src/**/*.md'
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
deptrac:
name: deptrac
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Configure environment
run: |
echo COLUMNS=120 >> $GITHUB_ENV
echo COMPOSER_UP='composer update --prefer-lowest --no-progress --no-interaction --ansi --ignore-platform-req=ext-mongodb' >> $GITHUB_ENV
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.5'
- name: Get composer cache directory
id: composer-cache
run: |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache packages dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-packages-${{ hashFiles('src/**/composer.json') }}
restore-keys: |
${{ runner.os }}-composer-packages
- name: Install root dependencies
uses: ramsey/composer-install@v3
- name: Build root packages
run: php .github/build-packages.php
- name: Run deptrac/deptrac
run: $COMPOSER_UP && vendor/bin/deptrac

View File

@@ -74,6 +74,10 @@ jobs:
restore-keys: |
${{ runner.os }}-composer-packages-${{ matrix.php-version }}-${{ matrix.dependency-version }}-${{ matrix.symfony-version }}
- name: Remove deptrac/deptrac for Symfony 8
if: matrix.symfony-version == '8.0.*'
run: composer remove deptrac/deptrac --dev --no-update
- name: Install root dependencies
uses: ramsey/composer-install@v3

1
.gitignore vendored
View File

@@ -1,3 +1,4 @@
.deptrac.cache
.doctor-rst.cache
.php-cs-fixer.cache
.phpunit.cache

View File

@@ -7,6 +7,7 @@
],
"require-dev": {
"php": ">=8.2",
"deptrac/deptrac": "^4.2",
"php-cs-fixer/shim": "^3.75",
"phpstan/phpstan-strict-rules": "^2.0",
"symfony/filesystem": "^7.3|^8.0",

43
deptrac.yaml Normal file
View File

@@ -0,0 +1,43 @@
deptrac:
paths:
- ./src
exclude_files:
- '#.*test.*#'
- '#.*vendor.*#'
layers:
- name: Agent
collectors:
- type: classLike
value: Symfony\\AI\\Agent.*
- name: Chat
collectors:
- type: classLike
value: Symfony\\AI\\Chat.*
- name: Platform
collectors:
- type: classLike
value: Symfony\\AI\\Platform.*
- name: Store
collectors:
- type: classLike
value: Symfony\\AI\\Store.*
ruleset:
Agent:
- Platform
- Store
Chat:
- Agent
- Platform
Platform: ~
Store:
- Platform
# Baseline of known violations to be skipped for now
skip_violations:
Symfony\AI\Platform\Bridge\Anthropic\TokenOutputProcessor: [Symfony\AI\Agent\OutputProcessorInterface, Symfony\AI\Agent\Output]
Symfony\AI\Platform\Bridge\DeepSeek\TokenOutputProcessor: [Symfony\AI\Agent\OutputProcessorInterface, Symfony\AI\Agent\Output]
Symfony\AI\Platform\Bridge\Gemini\TokenOutputProcessor: [Symfony\AI\Agent\OutputProcessorInterface, Symfony\AI\Agent\Output]
Symfony\AI\Platform\Bridge\Mistral\TokenOutputProcessor: [Symfony\AI\Agent\OutputProcessorInterface, Symfony\AI\Agent\Output]
Symfony\AI\Platform\Bridge\OpenAi\TokenOutputProcessor: [Symfony\AI\Agent\OutputProcessorInterface, Symfony\AI\Agent\Output]
Symfony\AI\Platform\Bridge\Perplexity\SearchResultProcessor: [Symfony\AI\Agent\OutputProcessorInterface, Symfony\AI\Agent\Output]
Symfony\AI\Platform\Bridge\Perplexity\TokenOutputProcessor: [Symfony\AI\Agent\OutputProcessorInterface, Symfony\AI\Agent\Output]
Symfony\AI\Platform\Bridge\VertexAi\TokenOutputProcessor: [Symfony\AI\Agent\OutputProcessorInterface, Symfony\AI\Agent\Output]