Skip to content

ci: Add meta job for branch protection #220

ci: Add meta job for branch protection

ci: Add meta job for branch protection #220

Workflow file for this run

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'
jobs:
tests:
name: PHP ${{ matrix.php-version }} + ${{ matrix.dependencies }} + ${{ matrix.variant }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php-version:
- '8.1'
dependencies: [ highest ]
variant: [ normal ]
include:
- php-version: '8.1'
dependencies: highest
variant: 'symfony/symfony:"^5.4"'
# 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:4.4-bionic
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@v2
- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
coverage: xdebug
tools: phpenv, pecl, composer:v2
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@v1
with:
dependency-versions: ${{ matrix.dependencies }}
composer-options: "--prefer-dist --prefer-stable"
# 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
run: composer bin doctrine update --prefer-dist --prefer-stable ${{ matrix.composer-flags }}
- name: Install doctrine Composer bin dependencies
run: composer bin doctrine update --prefer-dist --prefer-stable ${{ matrix.composer-flags }}
- name: Repeat "Install doctrine Composer bin dependencies"
run: composer bin doctrine_mongodb update --prefer-dist --prefer-stable ${{ matrix.composer-flags }}
- name: Install MongoDB Composer bin dependencies
run: composer bin doctrine_mongodb update --prefer-dist --prefer-stable ${{ matrix.composer-flags }}
- name: Repeat "Install MongoDB Composer bin dependencies"
run: composer bin doctrine_mongodb update --prefer-dist --prefer-stable ${{ matrix.composer-flags }}
- name: Install Doctrine PHPCR Composer bin dependencies
run: composer bin doctrine_phpcr update --prefer-dist --prefer-stable ${{ matrix.composer-flags }}
- name: Repeat "Install Doctrine PHPCR Composer bin dependencies"
run: composer bin doctrine_phpcr update --prefer-dist --prefer-stable ${{ matrix.composer-flags }}
- name: Install Eloquent Composer bin dependencies
run: composer bin eloquent update --prefer-dist --prefer-stable ${{ matrix.composer-flags }}
- name: Repeat "Install Eloquent Composer bin dependencies"
run: composer bin eloquent update --prefer-dist --prefer-stable ${{ matrix.composer-flags }}
# There is a known issue here with Composer
# see https://github.com/composer/composer/issues/10200
# Meanwhile we break down the installation as a workaround.
# Once this is fixed the whole bin dependencies can probably be installed
# in one step with a timeout adjustment
- name: Remove Symfony from ProxyManager Composer bin dependencies
run: composer bin proxy-manager remove --dev symfony/symfony --no-update
- name: Install ProxyManager Composer bin dependencies
run: composer bin proxy-manager update --prefer-dist --prefer-stable ${{ matrix.composer-flags }}
- name: Repeat "Install ProxyManager Composer bin dependencies"
run: composer bin proxy-manager update --prefer-dist --prefer-stable ${{ matrix.composer-flags }}
- name: Add back Symfony for ProxyManager Composer bin dependencies
if: matrix.variant == 'normal'
run: composer bin proxy-manager require --dev "symfony/symfony:^5.4.1 || ^6.0.0" --prefer-dist --prefer-stable ${{ matrix.composer-flags }} --no-update
- name: Add back Symfony (variant) for ProxyManager Composer bin dependencies
if: matrix.variant != 'normal'
run: composer bin proxy-manager require --dev ${{ matrix.variant }} --prefer-dist --prefer-stable ${{ matrix.composer-flags }} --no-update
- name: Install Symfony for ProxyManager Composer bin dependencies
run: composer bin proxy-manager update --prefer-dist --prefer-stable ${{ matrix.composer-flags }}
- name: Configure Symfony (variant) Composer bin dependencies
if: matrix.variant != 'normal'
run: composer bin symfony require --dev --no-update ${{ matrix.variant }}
- name: Install Symfony Composer bin dependencies
run: composer bin symfony update --prefer-dist --prefer-stable ${{ matrix.composer-flags }}
- name: Repeat "Install Symfony Composer bin dependencies"
run: composer bin symfony update --prefer-dist --prefer-stable ${{ matrix.composer-flags }}
- name: Install CoversValidator Composer bin dependencies
run: composer bin covers-validator install --prefer-dist
- name: Install PHP-CS-Fixer Composer bin dependencies
run: composer bin php-cs-fixer install --prefer-dist
- name: Run Tests
run: make test
timeout-minutes: 5
# 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