diff --git a/.github/workflows/deptrac.yaml b/.github/workflows/deptrac.yaml new file mode 100644 index 000000000..6edc45787 --- /dev/null +++ b/.github/workflows/deptrac.yaml @@ -0,0 +1,59 @@ +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 + strategy: + fail-fast: false + matrix: + php-version: [ '8.4' ] + steps: + - name: Checkout + uses: actions/checkout@v5 + + - name: Configure environment + run: | + echo COLUMNS=120 >> $GITHUB_ENV + echo COMPOSER_UP='composer update --no-progress --no-interaction --ansi --ignore-platform-req=ext-mongodb' >> $GITHUB_ENV + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-version }} + + - 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-${{ matrix.php-version }}-${{ hashFiles('src/**/composer.json') }} + restore-keys: | + ${{ runner.os }}-composer-packages-${{ matrix.php-version }} + + - name: Install root dependencies + uses: ramsey/composer-install@v3 + + - name: Build root packages + run: php .github/build-packages.php + + - name: Run DEPTRAC + run: $COMPOSER_UP && vendor/bin/deptrac diff --git a/.gitignore b/.gitignore index 5d204c615..b86a9a51f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.deptrac.cache .doctor-rst.cache .php-cs-fixer.cache .phpunit.cache diff --git a/composer.json b/composer.json index b022443ee..2496eb1c9 100644 --- a/composer.json +++ b/composer.json @@ -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", diff --git a/deptrac.yaml b/deptrac.yaml new file mode 100644 index 000000000..4a10a46f3 --- /dev/null +++ b/deptrac.yaml @@ -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]