chore: Add tests for Symfony7 #501
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Tests | |
on: | |
pull_request: null | |
push: | |
branches: [ master, main ] | |
schedule: | |
# Do not make it the first of the month and/or midnight since it is a very busy time | |
- cron: "* 10 5 * *" | |
# this fixes the input device is not a TTY .. see https://github.com/docker/compose/issues/5696 | |
env: | |
MYSQL_HOST: '127.0.0.1' | |
DOCTRINE_ORM_DB_HOST: '127.0.0.1' | |
MONGO_DB_VERSION: '7.0' | |
XDEBUG_MODE: 'coverage' | |
jobs: | |
tests: | |
name: '${{ matrix.make-test }}: PHP ${{ matrix.php-version }} + ${{ matrix.dependencies }} + ${{ matrix.variant }}' | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
php-version: | |
- '8.3' | |
dependencies: [ highest, lowest ] | |
make-test: | |
- test_core | |
- test_doctrine_bridge | |
- test_doctrine_odm_bridge | |
- test_doctrine_phpcr_bridge | |
- test_eloquent_bridge | |
- test_symfony_bridge | |
- test_symfony_doctrine_bridge | |
- test_symfony_doctrine_bridge_proxy_manager | |
- test_symfony_eloquent_bridge | |
- test_symfony_eloquent_bridge_proxy_manager | |
variant: | |
- 'no-change' | |
- 'symfony/http-kernel:^6.4.14 symfony/validator:^6.4.14' | |
- 'symfony/http-kernel:^7.1 "symfony/validator:^7.1' | |
# To keep in sync with docker-compose.yml | |
services: | |
mysql: | |
image: mysql:8.0 | |
ports: | |
- 3307:3306 | |
env: | |
MYSQL_DATABASE: fidry_alice_data_fixtures | |
MYSQL_ROOT_USER: root | |
MYSQL_ROOT_PASSWORD: password | |
mongo: | |
image: mongo:7.0 | |
ports: | |
- 27018:27017 | |
env: | |
MONGO_INITDB_DATABASE: fidry_alice_data_fixtures | |
MONGO_INITDB_ROOT_USERNAME: root | |
MONGO_INITDB_ROOT_PASSWORD: password | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install mongosh | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y wget gnupg | |
wget -qO - https://www.mongodb.org/static/pgp/server-${MONGO_DB_VERSION}.asc | sudo apt-key add - | |
echo \ | |
"deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/${MONGO_DB_VERSION} multiverse" \ | |
| sudo tee /etc/apt/sources.list.d/mongodb-org-${MONGO_DB_VERSION}.list | |
sudo apt-get update | |
sudo apt-get install -y mongodb-mongosh | |
- name: Install PHP with extensions | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-version }} | |
coverage: xdebug | |
tools: composer | |
extensions: mongodb | |
- name: Configure | |
run: | | |
set -eo pipefail | |
PHPUNIT_FLAGS='--stop-on-failure --verbose' | |
perl -pi -e 's/^}$/,"provide":{"ext-mongo":"*"}}/' composer.json | |
- name: Install Composer dependencies (${{ matrix.dependencies }}) | |
uses: ramsey/composer-install@v3 | |
with: | |
dependency-versions: "${{ matrix.dependencies }}" | |
# Split the bin updates to avoid GA to time out the task | |
# The updates apparently need to be repeated as well due to a bug | |
# in the wiki merge plugin | |
- name: Install doctrine Composer bin dependencies | |
uses: ramsey/composer-install@v3 | |
if: "matrix.make-test == 'test_doctrine_bridge'" | |
with: | |
dependency-versions: "${{ matrix.dependencies }}" | |
composer-options: "${{ matrix.composer-flags }}" | |
working-directory: vendor-bin/doctrine | |
- name: Repeat "Install doctrine Composer bin dependencies" | |
uses: ramsey/composer-install@v3 | |
if: "matrix.make-test == 'test_doctrine_bridge'" | |
with: | |
dependency-versions: "${{ matrix.dependencies }}" | |
composer-options: "${{ matrix.composer-flags }}" | |
working-directory: vendor-bin/doctrine | |
- name: Install MongoDB Composer bin dependencies | |
uses: ramsey/composer-install@v3 | |
if: "matrix.make-test == 'test_doctrine_odm_bridge'" | |
with: | |
dependency-versions: "${{ matrix.dependencies }}" | |
composer-options: "${{ matrix.composer-flags }}" | |
working-directory: vendor-bin/doctrine_mongodb | |
- name: Repeat "Install MongoDB Composer bin dependencies" | |
uses: ramsey/composer-install@v3 | |
if: "matrix.make-test == 'test_doctrine_odm_bridge'" | |
with: | |
dependency-versions: "${{ matrix.dependencies }}" | |
composer-options: "${{ matrix.composer-flags }}" | |
working-directory: vendor-bin/doctrine_mongodb | |
- name: Install Doctrine PHPCR Composer bin dependencies | |
uses: ramsey/composer-install@v3 | |
if: "matrix.make-test == 'test_doctrine_phpcr_bridge' || matrix.make-test == 'test_symfony_bridge' || matrix.make-test == 'test_symfony_doctrine_bridge'" | |
with: | |
dependency-versions: "${{ matrix.dependencies }}" | |
composer-options: "${{ matrix.composer-flags }}" | |
working-directory: vendor-bin/doctrine_phpcr | |
- name: Repeat "Install Doctrine PHPCR Composer bin dependencies" | |
uses: ramsey/composer-install@v3 | |
if: "matrix.make-test == 'test_doctrine_phpcr_bridge' || matrix.make-test == 'test_symfony_bridge' || matrix.make-test == 'test_symfony_doctrine_bridge'" | |
with: | |
dependency-versions: "${{ matrix.dependencies }}" | |
composer-options: "${{ matrix.composer-flags }}" | |
working-directory: vendor-bin/doctrine_phpcr | |
- name: Install Eloquent Composer bin dependencies | |
uses: ramsey/composer-install@v3 | |
if: "matrix.make-test == 'test_eloquent_bridge'" | |
with: | |
dependency-versions: "${{ matrix.dependencies }}" | |
composer-options: "${{ matrix.composer-flags }}" | |
working-directory: vendor-bin/eloquent | |
- name: Repeat "Install Eloquent Composer bin dependencies" | |
uses: ramsey/composer-install@v3 | |
if: "matrix.make-test == 'test_eloquent_bridge'" | |
with: | |
dependency-versions: "${{ matrix.dependencies }}" | |
composer-options: "${{ matrix.composer-flags }}" | |
working-directory: vendor-bin/eloquent | |
- name: Install ProxyManager Composer bin dependencies | |
uses: ramsey/composer-install@v3 | |
if: "matrix.make-test == 'test_symfony_doctrine_bridge_proxy_manager' || matrix.make-test == 'test_symfony_eloquent_bridge_proxy_manager'" | |
with: | |
dependency-versions: "${{ matrix.dependencies }}" | |
composer-options: "${{ matrix.composer-flags }}" | |
working-directory: vendor-bin/proxy-manager | |
- name: Repeat "Install ProxyManager Composer bin dependencies" | |
uses: ramsey/composer-install@v3 | |
if: "matrix.make-test == 'test_symfony_doctrine_bridge_proxy_manager' || matrix.make-test == 'test_symfony_eloquent_bridge_proxy_manager'" | |
with: | |
dependency-versions: "${{ matrix.dependencies }}" | |
composer-options: "${{ matrix.composer-flags }}" | |
working-directory: vendor-bin/proxy-manager | |
- name: Install Symfony for ProxyManager Composer bin dependencies | |
uses: ramsey/composer-install@v3 | |
if: "matrix.make-test == 'test_symfony_doctrine_bridge_proxy_manager' || matrix.make-test == 'test_symfony_eloquent_bridge_proxy_manager'" | |
with: | |
dependency-versions: "${{ matrix.dependencies }}" | |
composer-options: "${{ matrix.composer-flags }}" | |
working-directory: vendor-bin/proxy-manager | |
- name: Configure Symfony (variant) Composer bin dependencies | |
if: matrix.variant != 'no-change' | |
run: composer bin symfony require --dev --no-update ${{ matrix.variant }} | |
- name: Install Symfony Composer bin dependencies | |
uses: ramsey/composer-install@v3 | |
if: "matrix.make-test == 'test_symfony_bridge' || matrix.make-test == 'test_symfony_doctrine_bridge' || matrix.make-test == 'test_symfony_eloquent_bridge' || matrix.make-test == 'test_symfony_eloquent_bridge_proxy_manager' || matrix.make-test == 'test_symfony_doctrine_bridge_proxy_manager'" | |
with: | |
dependency-versions: "${{ matrix.dependencies }}" | |
composer-options: "${{ matrix.composer-flags }}" | |
working-directory: vendor-bin/symfony | |
- name: Repeat "Install Symfony Composer bin dependencies" | |
uses: ramsey/composer-install@v3 | |
if: "matrix.make-test == 'test_symfony_bridge' || matrix.make-test == 'test_symfony_doctrine_bridge' || matrix.make-test == 'test_symfony_eloquent_bridge' || matrix.make-test == 'test_symfony_eloquent_bridge_proxy_manager' || matrix.make-test == 'test_symfony_doctrine_bridge_proxy_manager'" | |
with: | |
dependency-versions: "${{ matrix.dependencies }}" | |
composer-options: "${{ matrix.composer-flags }}" | |
working-directory: vendor-bin/symfony | |
- name: Run Tests | |
run: make ${{ matrix.make-test }} | |
# This is a "trick", a meta task which does not change, and we can use in | |
# the protected branch rules as opposed to the individual tests which | |
# may change regularly. | |
validate-tests: | |
name: Tests status | |
runs-on: ubuntu-latest | |
needs: | |
- tests | |
if: always() | |
steps: | |
- name: Successful run | |
if: ${{ !(contains(needs.*.result, 'failure')) }} | |
run: exit 0 | |
- name: Failing run | |
if: ${{ contains(needs.*.result, 'failure') }} | |
run: exit 1 |