Good bye atoum :'( #2285
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: Galette CI | |
on: | |
push: | |
branches: | |
- master | |
- develop | |
- 'feature/*' | |
- 'hotfix/*' | |
- 'release/*' | |
pull_request: | |
jobs: | |
ubuntu-latest: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
php-versions: [ '8.1', '8.2' ] | |
coverage: ['none'] | |
db-image: ['mysql:5.7', 'mysql:8.0', 'mariadb:10.2', 'mariadb:10.6', 'postgres:10', 'postgres:14'] | |
include: | |
- php-versions: '8.1' | |
coverage: 'xdebug' | |
db-image: 'postgres:14' | |
fail-fast: false | |
env: | |
DB: ${{ matrix.db-image }} | |
services: | |
# Label used to access the service container | |
db: | |
# Docker Hub image | |
image: ${{ matrix.db-image }} | |
# Provide env variables for both mysql and pgsql | |
env: | |
POSTGRES_USER: galette_tests | |
POSTGRES_PASSWORD: g@l3tte | |
POSTGRES_DB: galette_tests | |
MYSQL_USER: galette_tests | |
MYSQL_PASSWORD: g@l3tte | |
MYSQL_ROOT_PASSWORD: g@l3tte | |
MYSQL_DATABASE: galette_tests | |
# Open network ports for both mysql and pgsql | |
ports: | |
- 3306:3306 | |
- 5432:5432 | |
# Set health checks to wait until postgres has started | |
options: >- | |
--health-cmd="bash -c 'if [[ -n $(command -v pg_isready) ]]; then pg_isready; else mysqladmin ping; fi'" | |
--health-interval=10s | |
--health-timeout=5s | |
--health-retries=10 | |
name: PHP ${{ matrix.php-versions }} ${{ matrix.db-image }} | |
steps: | |
- name: PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-versions }} | |
tools: composer, pecl | |
coverage: ${{ matrix.coverage }} | |
extensions: apcu | |
ini-values: apc.enable_cli=1 | |
- name: "Show versions" | |
run: | | |
php --version | |
composer --version | |
echo "node $(node --version)" | |
echo "npm $(npm --version)" | |
docker exec ${{ job.services.db.id }} bash -c "if [[ -n \$(command -v psql) ]]; then psql --version; else mysql --version; fi" | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 2 | |
- name: Get composer cache directory | |
id: composer-cache | |
run: | | |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} | |
restore-keys: ${{ runner.os }}-composer- | |
- name: Install dependencies | |
run: bin/install_deps | |
- name: CS | |
run: | | |
galette/vendor/bin/phpcs -n -p --ignore=galette_tcpdf_config.php --standard=phpcs-rules.xml galette/lib/ tests/TestsBootstrap.php tests/Galette tests/plugins galette/webroot/index.php galette/includes/ | |
- name: Twig CS | |
run: | | |
galette/vendor/bin/twigcs galette/templates/default --severity error --display blocking | |
if: matrix.php-versions == '8.1' | |
- name: Install checker | |
working-directory: galette | |
run: composer require maglnet/composer-require-checker -W | |
if: matrix.php-versions == '8.1' | |
- name: Check missing symbols | |
run: | | |
galette/vendor/bin/composer-require-checker check --config-file=.composer-require-checker.config.json galette/composer.json | |
if: matrix.php-versions == '8.1' | |
- name: PHPStan checks | |
run: | | |
galette/vendor/bin/phpstan analyze --ansi --memory-limit=2G --no-interaction --no-progress | |
if: matrix.php-versions == '8.1' | |
- name: Init for PostgreSQL (update) | |
env: | |
POSTGRES_HOST: localhost | |
POSTGRES_PORT: 5432 | |
run: | | |
PGPASSWORD=g@l3tte psql -d galette_tests -a -f tests/pgsql_06.sql -U galette_tests -h localhost | |
if: startsWith(matrix.db-image, 'postgres') | |
- name: Init for MariaDB (update) | |
run: | | |
mysql -e 'create database IF NOT EXISTS galette_tests;' -u galette_tests --password=g@l3tte -h 127.0.0.1 -P 3306 | |
mysql -e 'use galette_tests; source tests/mysql_06.sql;' -u galette_tests --password=g@l3tte -h 127.0.0.1 -P 3306 | |
if: startsWith(matrix.db-image, 'mysql') || startsWith(matrix.db-image, 'mariadb') | |
- name: Update database tests | |
run: UPDATE=UPDATE galette/vendor/bin/phpunit --test-suffix=.php --bootstrap tests/TestsBootstrap.php --no-coverage --process-isolation tests/GaletteUpdate/ | |
if: matrix.coverage != 'xdebug' | |
- name: Init for PostgreSQL | |
env: | |
POSTGRES_HOST: localhost | |
POSTGRES_PORT: 5432 | |
run: | | |
PGPASSWORD=g@l3tte psql -d galette_tests -a -f galette/install/scripts/pgsql.sql -U galette_tests -h localhost | |
if: startsWith(matrix.db-image, 'postgres') | |
- name: Init for MariaDB | |
run: | | |
mysql -e 'create database IF NOT EXISTS galette_tests;' -u galette_tests --password=g@l3tte -h 127.0.0.1 -P 3306 | |
mysql -e 'use galette_tests; source galette/install/scripts/mysql.sql;' -u galette_tests --password=g@l3tte -h 127.0.0.1 -P 3306 | |
if: startsWith(matrix.db-image, 'mysql') || startsWith(matrix.db-image, 'mariadb') | |
- name: Unit tests | |
run: galette/vendor/bin/phpunit --test-suffix=.php --bootstrap tests/TestsBootstrap.php --no-coverage --process-isolation tests/Galette/ | |
if: matrix.coverage != 'xdebug' | |
- name: Unit tests (with coverage) | |
run: galette/vendor/bin/phpunit --test-suffix=.php --bootstrap tests/TestsBootstrap.php --process-isolation --coverage-filter galette/lib --coverage-clover tests/clover.xml tests/Galette/ | |
if: matrix.coverage == 'xdebug' | |
- name: Upload code coverage (scrutinizer) | |
run: | | |
cd galette | |
composer require scrutinizer/ocular | |
cd .. | |
php galette/vendor/bin/ocular code-coverage:upload --format=php-clover tests/clover.xml | |
if: matrix.coverage == 'xdebug' | |
- name: Upload code coverage (codecov) | |
uses: codecov/codecov-action@v3 | |
with: | |
file: tests/clover.xml | |
if: matrix.coverage == 'xdebug' |