mirror of
https://github.com/symfony/ai.git
synced 2026-03-23 23:42:18 +01:00
455 lines
17 KiB
YAML
455 lines
17 KiB
YAML
name: Tests
|
|
|
|
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
|
|
|
|
env:
|
|
REQUIRED_PHP_EXTENSIONS: 'mongodb, redis'
|
|
|
|
jobs:
|
|
# ===========================================
|
|
# Build Matrix
|
|
# ===========================================
|
|
matrix:
|
|
name: Matrix
|
|
uses: ./.github/workflows/build-matrix.yaml
|
|
|
|
# ===========================================
|
|
# Unit Tests
|
|
# ===========================================
|
|
packages:
|
|
name: Unit / ${{ matrix.package.type }} / ${{ matrix.package.name }} / PHP ${{ matrix.php-version }}${{ matrix.dependency-version == 'lowest' && ' / lowest' || '' }}${{ matrix.symfony-version && format(' / Symfony {0}', matrix.symfony-version) || '' }}
|
|
needs: matrix
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
package: ${{ fromJson(needs.matrix.outputs.packages) }}
|
|
php-version: ['8.2', '8.5']
|
|
dependency-version: ['']
|
|
symfony-version: ['']
|
|
include: ${{ fromJson(needs.matrix.outputs.packages-include) }}
|
|
|
|
env:
|
|
SYMFONY_REQUIRE: ${{ matrix.symfony-version || '>=7.4' }}
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Configure environment
|
|
run: |
|
|
echo COLUMNS=120 >> $GITHUB_ENV
|
|
[ 'lowest' = '${{ matrix.dependency-version }}' ] && echo SYMFONY_DEPRECATIONS_HELPER=weak >> $GITHUB_ENV || true
|
|
|
|
- name: Setup PHP
|
|
uses: shivammathur/setup-php@v2
|
|
with:
|
|
php-version: ${{ matrix.php-version }}
|
|
tools: flex
|
|
extensions: ${{ env.REQUIRED_PHP_EXTENSIONS }}
|
|
|
|
# deptrac does not support Symfony 5.4
|
|
- name: Remove deptrac for unsupported Symfony versions
|
|
if: startsWith(matrix.symfony-version, '5.4')
|
|
run: composer remove --dev deptrac/deptrac --no-update
|
|
|
|
- name: Install root dependencies
|
|
uses: ramsey/composer-install@v3
|
|
|
|
- name: Build packages
|
|
run: php .github/build-packages.php
|
|
|
|
- name: Clean vendor folder
|
|
run: rm -rf vendor
|
|
|
|
- name: Install dependencies
|
|
uses: ramsey/composer-install@v3
|
|
with:
|
|
working-directory: src/${{ matrix.package.path }}
|
|
dependency-versions: ${{ matrix.dependency-version || 'highest' }}
|
|
|
|
- name: Run PHPUnit
|
|
run: cd src/${{ matrix.package.path }} && vendor/bin/phpunit
|
|
|
|
store-bridges:
|
|
name: Unit / Store / ${{ matrix.bridge.bridge }} / PHP ${{ matrix.php-version }}${{ matrix.dependency-version == 'lowest' && ' / lowest' || '' }}
|
|
needs: matrix
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include: ${{ fromJson(needs.matrix.outputs.store-bridges-include) }}
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Configure environment
|
|
run: |
|
|
echo COLUMNS=120 >> $GITHUB_ENV
|
|
[ 'lowest' = '${{ matrix.dependency-version }}' ] && echo SYMFONY_DEPRECATIONS_HELPER=weak >> $GITHUB_ENV || true
|
|
|
|
- name: Setup PHP
|
|
uses: shivammathur/setup-php@v2
|
|
with:
|
|
php-version: ${{ matrix.php-version }}
|
|
tools: flex
|
|
extensions: ${{ env.REQUIRED_PHP_EXTENSIONS }}
|
|
|
|
- name: Install root dependencies
|
|
uses: ramsey/composer-install@v3
|
|
|
|
- name: Build packages
|
|
run: php .github/build-packages.php
|
|
|
|
# Remove root vendor and bridge vendor to avoid circular symlinks when installing bridge dependencies
|
|
- name: Clean vendor folders
|
|
run: rm -rf vendor src/platform/src/Bridge/${{ matrix.bridge.bridge }}/vendor
|
|
|
|
- name: Install dependencies
|
|
uses: ramsey/composer-install@v3
|
|
with:
|
|
working-directory: src/${{ matrix.bridge.component }}/src/Bridge/${{ matrix.bridge.bridge }}
|
|
dependency-versions: ${{ matrix.dependency-version }}
|
|
|
|
- name: Run PHPUnit
|
|
run: cd src/${{ matrix.bridge.component }}/src/Bridge/${{ matrix.bridge.bridge }} && vendor/bin/phpunit
|
|
|
|
message-store-bridges:
|
|
name: Unit / Message Store / ${{ matrix.bridge.bridge }} / PHP ${{ matrix.php-version }}${{ matrix.dependency-version == 'lowest' && ' / lowest' || '' }}
|
|
needs: matrix
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include: ${{ fromJson(needs.matrix.outputs.message-store-bridges-include) }}
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Configure environment
|
|
run: |
|
|
echo COLUMNS=120 >> $GITHUB_ENV
|
|
[ 'lowest' = '${{ matrix.dependency-version }}' ] && echo SYMFONY_DEPRECATIONS_HELPER=weak >> $GITHUB_ENV || true
|
|
|
|
- name: Setup PHP
|
|
uses: shivammathur/setup-php@v2
|
|
with:
|
|
php-version: ${{ matrix.php-version }}
|
|
tools: flex
|
|
extensions: ${{ env.REQUIRED_PHP_EXTENSIONS }}
|
|
|
|
- name: Install root dependencies
|
|
uses: ramsey/composer-install@v3
|
|
|
|
- name: Build packages
|
|
run: php .github/build-packages.php
|
|
|
|
# Remove root vendor and bridge vendor to avoid circular symlinks when installing bridge dependencies
|
|
- name: Clean vendor folders
|
|
run: rm -rf vendor src/platform/src/Bridge/${{ matrix.bridge.bridge }}/vendor
|
|
|
|
- name: Install dependencies
|
|
uses: ramsey/composer-install@v3
|
|
with:
|
|
working-directory: src/${{ matrix.bridge.component }}/src/Bridge/${{ matrix.bridge.bridge }}
|
|
dependency-versions: ${{ matrix.dependency-version }}
|
|
|
|
- name: Run PHPUnit
|
|
run: cd src/${{ matrix.bridge.component }}/src/Bridge/${{ matrix.bridge.bridge }} && vendor/bin/phpunit
|
|
|
|
tool-bridges:
|
|
name: Unit / Tool / ${{ matrix.bridge.bridge }} / PHP ${{ matrix.php-version }}${{ matrix.dependency-version == 'lowest' && ' / lowest' || '' }}
|
|
needs: matrix
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include: ${{ fromJson(needs.matrix.outputs.tool-bridges-include) }}
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Configure environment
|
|
run: |
|
|
echo COLUMNS=120 >> $GITHUB_ENV
|
|
[ 'lowest' = '${{ matrix.dependency-version }}' ] && echo SYMFONY_DEPRECATIONS_HELPER=weak >> $GITHUB_ENV || true
|
|
|
|
- name: Setup PHP
|
|
uses: shivammathur/setup-php@v2
|
|
with:
|
|
php-version: ${{ matrix.php-version }}
|
|
tools: flex
|
|
extensions: ${{ env.REQUIRED_PHP_EXTENSIONS }}
|
|
|
|
- name: Install root dependencies
|
|
uses: ramsey/composer-install@v3
|
|
|
|
- name: Build packages
|
|
run: php .github/build-packages.php
|
|
|
|
# Remove root vendor and bridge vendor to avoid circular symlinks when installing bridge dependencies
|
|
- name: Clean vendor folders
|
|
run: rm -rf vendor src/platform/src/Bridge/${{ matrix.bridge.bridge }}/vendor
|
|
|
|
- name: Install dependencies
|
|
uses: ramsey/composer-install@v3
|
|
with:
|
|
working-directory: src/${{ matrix.bridge.component }}/src/Bridge/${{ matrix.bridge.bridge }}
|
|
dependency-versions: ${{ matrix.dependency-version }}
|
|
|
|
- name: Run PHPUnit
|
|
run: cd src/${{ matrix.bridge.component }}/src/Bridge/${{ matrix.bridge.bridge }} && vendor/bin/phpunit
|
|
|
|
platform-bridges:
|
|
name: Unit / Platform / ${{ matrix.bridge.bridge }} / PHP ${{ matrix.php-version }}${{ matrix.dependency-version == 'lowest' && ' / lowest' || '' }}
|
|
needs: matrix
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include: ${{ fromJson(needs.matrix.outputs.platform-bridges-include) }}
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Configure environment
|
|
run: |
|
|
echo COLUMNS=120 >> $GITHUB_ENV
|
|
[ 'lowest' = '${{ matrix.dependency-version }}' ] && echo SYMFONY_DEPRECATIONS_HELPER=weak >> $GITHUB_ENV || true
|
|
|
|
- name: Setup PHP
|
|
uses: shivammathur/setup-php@v2
|
|
with:
|
|
php-version: ${{ matrix.php-version }}
|
|
tools: flex
|
|
extensions: ${{ env.REQUIRED_PHP_EXTENSIONS }}
|
|
|
|
- name: Install root dependencies
|
|
uses: ramsey/composer-install@v3
|
|
|
|
- name: Build packages
|
|
run: php .github/build-packages.php
|
|
|
|
# Remove root vendor and bridge vendor to avoid circular symlinks when installing bridge dependencies
|
|
- name: Clean vendor folders
|
|
run: rm -rf vendor src/platform/src/Bridge/${{ matrix.bridge.bridge }}/vendor
|
|
|
|
- name: Install dependencies
|
|
uses: ramsey/composer-install@v3
|
|
with:
|
|
working-directory: src/platform/src/Bridge/${{ matrix.bridge.bridge }}
|
|
dependency-versions: ${{ matrix.dependency-version }}
|
|
|
|
- name: Run PHPUnit
|
|
run: cd src/platform/src/Bridge/${{ matrix.bridge.bridge }} && vendor/bin/phpunit
|
|
|
|
mate-bridges:
|
|
name: Unit / Mate / ${{ matrix.bridge.bridge }} / PHP ${{ matrix.php-version }}${{ matrix.dependency-version == 'lowest' && ' / lowest' || '' }}
|
|
needs: matrix
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include: ${{ fromJson(needs.matrix.outputs.mate-bridges-include) }}
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Configure environment
|
|
run: |
|
|
echo COLUMNS=120 >> $GITHUB_ENV
|
|
[ 'lowest' = '${{ matrix.dependency-version }}' ] && echo SYMFONY_DEPRECATIONS_HELPER=weak >> $GITHUB_ENV || true
|
|
|
|
- name: Setup PHP
|
|
uses: shivammathur/setup-php@v2
|
|
with:
|
|
php-version: ${{ matrix.php-version }}
|
|
tools: flex
|
|
extensions: ${{ env.REQUIRED_PHP_EXTENSIONS }}
|
|
|
|
- name: Install root dependencies
|
|
uses: ramsey/composer-install@v3
|
|
|
|
- name: Build packages
|
|
run: php .github/build-packages.php
|
|
|
|
# Remove root vendor and bridge vendor to avoid circular symlinks when installing bridge dependencies
|
|
- name: Clean vendor folders
|
|
run: rm -rf vendor src/platform/src/Bridge/${{ matrix.bridge.bridge }}/vendor
|
|
|
|
- name: Install dependencies
|
|
uses: ramsey/composer-install@v3
|
|
with:
|
|
working-directory: src/mate/src/Bridge/${{ matrix.bridge.bridge }}
|
|
dependency-versions: ${{ matrix.dependency-version }}
|
|
|
|
- name: Run PHPUnit
|
|
run: cd src/mate/src/Bridge/${{ matrix.bridge.bridge }} && vendor/bin/phpunit
|
|
|
|
demo:
|
|
name: Integration / Demo
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
|
|
- name: Setup PHP
|
|
uses: shivammathur/setup-php@v2
|
|
with:
|
|
php-version: '8.4'
|
|
tools: flex
|
|
extensions: "${{ env.REQUIRED_PHP_EXTENSIONS }}"
|
|
|
|
- name: Install root dependencies
|
|
uses: ramsey/composer-install@v3
|
|
|
|
- name: Build root packages
|
|
run: php .github/build-packages.php
|
|
|
|
- name: Install demo dependencies
|
|
uses: ramsey/composer-install@v3
|
|
with:
|
|
composer-options: "--no-scripts"
|
|
working-directory: demo
|
|
|
|
- name: Link local packages
|
|
working-directory: demo
|
|
run: ../link
|
|
|
|
- run: composer run-script auto-scripts --no-interaction
|
|
working-directory: demo
|
|
|
|
- run: bin/console lint:container
|
|
working-directory: demo
|
|
|
|
- name: Run demo tests
|
|
working-directory: demo
|
|
run: vendor/bin/phpunit
|
|
|
|
demo-no-dev:
|
|
name: Integration / Demo (no-dev)
|
|
needs: demo
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
APP_ENV: prod
|
|
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
|
|
- name: Setup PHP
|
|
uses: shivammathur/setup-php@v2
|
|
with:
|
|
php-version: '8.4'
|
|
tools: flex
|
|
extensions: "${{ env.REQUIRED_PHP_EXTENSIONS }}"
|
|
|
|
- name: Install root dependencies
|
|
uses: ramsey/composer-install@v3
|
|
|
|
- name: Build root packages
|
|
run: php .github/build-packages.php
|
|
|
|
- name: Install demo dependencies (no-dev)
|
|
uses: ramsey/composer-install@v3
|
|
with:
|
|
composer-options: "--no-scripts --no-dev"
|
|
working-directory: demo
|
|
|
|
- name: Link local packages
|
|
working-directory: demo
|
|
run: ../link
|
|
|
|
- run: composer run-script auto-scripts --no-interaction
|
|
working-directory: demo
|
|
|
|
- run: bin/console lint:container
|
|
working-directory: demo
|
|
|
|
- run: bin/console cache:clear
|
|
working-directory: demo
|
|
|
|
examples:
|
|
name: Integration / Examples / PHP ${{ matrix.php-version }}${{ matrix.dependency-version == 'lowest' && ' / lowest' || '' }}${{ matrix.symfony-version && format(' / Symfony {0}', matrix.symfony-version) || '' }}
|
|
needs: demo
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
php-version: ['8.2', '8.5']
|
|
dependency-version: ['']
|
|
symfony-version: ['']
|
|
include:
|
|
# lowest deps
|
|
- php-version: '8.2'
|
|
dependency-version: 'lowest'
|
|
# LTS version of Symfony
|
|
- php-version: '8.2'
|
|
symfony-version: '7.4.*'
|
|
|
|
env:
|
|
SYMFONY_REQUIRE: ${{ matrix.symfony-version || '>=7.4' }}
|
|
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
|
|
- name: Up the examples services
|
|
working-directory: examples
|
|
run: docker compose up -d
|
|
|
|
- name: Configure environment
|
|
run: |
|
|
echo COLUMNS=120 >> $GITHUB_ENV
|
|
echo COMPOSER_UP='composer update ${{ matrix.dependency-version == 'lowest' && '--prefer-lowest --prefer-stable' || '' }} --no-progress --no-interaction --ansi' >> $GITHUB_ENV
|
|
echo PHPUNIT='vendor/bin/phpunit' >> $GITHUB_ENV
|
|
[ 'lowest' = '${{ matrix.dependency-version }}' ] && export SYMFONY_DEPRECATIONS_HELPER=weak
|
|
|
|
PACKAGES=$(find src/ -mindepth 2 -type f -name composer.json -not -path "*/vendor/*" -printf '%h\n' | sed 's/^src\///' | grep -Ev "examples" | sort | tr '\n' ' ')
|
|
echo "Packages: $PACKAGES"
|
|
echo "PACKAGES=$PACKAGES" >> $GITHUB_ENV
|
|
|
|
- name: Setup PHP
|
|
uses: shivammathur/setup-php@v2
|
|
with:
|
|
php-version: ${{ matrix.php-version }}
|
|
tools: flex
|
|
extensions: "${{ env.REQUIRED_PHP_EXTENSIONS }}"
|
|
|
|
# deptrac does not support Symfony 5.4, 6.4, and 8 yet
|
|
- name: Remove deptrac for unsupported Symfony versions
|
|
if: startsWith(matrix.symfony-version, '5.4')
|
|
run: composer remove --dev deptrac/deptrac --no-update
|
|
|
|
- name: Install root dependencies
|
|
uses: ramsey/composer-install@v3
|
|
|
|
- name: Build root packages
|
|
run: php .github/build-packages.php
|
|
|
|
- name: Install root dependencies
|
|
uses: ramsey/composer-install@v3
|
|
with:
|
|
working-directory: examples
|
|
|
|
- name: Run commands examples
|
|
working-directory: examples
|
|
run: |
|
|
php commands/stores.php
|
|
php commands/message-stores.php
|