Skip to content

Merge branch 'metadata-configuration' #870

Merge branch 'metadata-configuration'

Merge branch 'metadata-configuration' #870

Workflow file for this run

name: Run tests
# Runs tests to validate and ensure code quality. It's only triggered for new
# commits. If any of the jobs fail for new commits they're not allowed to be
# merged into the default branch.
on: [pull_request, push]
env:
GITHUB_TOKEN: ${{ github.token }}
PHPUNIT_FLAGS: ""
jobs:
database:
name: Validate database components
runs-on: ubuntu-latest
services:
database:
image: postgres:16-alpine
ports:
- "5432:5432"
env:
POSTGRES_DB: dirigent
POSTGRES_PASSWORD: "!ChangeMe!"
POSTGRES_USER: dirigent
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
with:
php-version: 8.3
tools: composer:v2
- name: Set Composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache Composer output
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install Composer dependencies
run: composer install --ansi --no-interaction --no-progress
- name: Generate encryption keys
run: bin/console encryption:generate-keys
- name: Validate mapping
run: bin/console doctrine:schema:validate --skip-sync -vvv --ansi --no-interaction
- name: Execute migrations
run: bin/console doctrine:migrations:migrate -vvv --ansi --no-interaction
- name: Validate schema
run: bin/console doctrine:schema:validate --skip-mapping --skip-property-types -vvv --ansi --no-interaction
- name: Load fixtures
run: bin/console doctrine:fixtures:load -vvv --ansi --no-interaction
phpunit:
name: "PHPUnit (PHP ${{ matrix.php-version }})"
runs-on: ubuntu-latest
services:
database:
image: postgres:16-alpine
ports:
- "5432:5432"
env:
POSTGRES_DB: dirigent_test
POSTGRES_PASSWORD: "!ChangeMe!"
POSTGRES_USER: dirigent
strategy:
matrix:
php-version: ["8.3", "8.4", "8.5"]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
tools: composer:v2
- name: Set Composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache Composer output
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install Composer dependencies
run: composer install --ansi --no-interaction --no-progress
- name: Install Node
uses: actions/setup-node@v4
with:
node-version: 23.x
- name: Install NPM dependencies
run: npm ci
- name: Build assets
run: npm run build
- name: Generate encryption keys
run: bin/console encryption:generate-keys
- name: Create database schema
run: bin/console doctrine:schema:create --env=test
- name: Load database fixtures
run: bin/console doctrine:fixtures:load --env=test --no-interaction
- name: PHPUnit version
run: bin/phpunit --version
- name: Run PHPUnit
run: bin/phpunit --coverage-text=var/coverage.txt ${{ env.PHPUNIT_FLAGS }}
- name: Code coverage
run: cat var/coverage.txt
# The tests covering the lowest Composer dependencies are disabled since this is not a library, and we expect
# users to follow the locked Composer dependencies as specified in this repository.
#
# phpunit-lowest:
# name: "PHPUnit (Lowest dependencies)"
#
# runs-on: ubuntu-latest
# services:
# database:
# image: postgres:16-alpine
# ports:
# - "5432:5432"
# env:
# POSTGRES_DB: dirigent_test
# POSTGRES_PASSWORD: "!ChangeMe!"
# POSTGRES_USER: dirigent
#
# steps:
# - name: Checkout code
# uses: actions/checkout@v4
#
# - name: Install PHP with extensions
# uses: shivammathur/setup-php@v2
# with:
# php-version: 8.3
# tools: composer:v2
#
# - name: Set Composer cache directory
# id: composer-cache
# run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
#
# - name: Cache Composer output
# uses: actions/cache@v4
# with:
# path: ${{ steps.composer-cache.outputs.dir }}
# key: ${{ runner.os }}-composer.lowest-${{ hashFiles('composer.lock') }}
# restore-keys: ${{ runner.os }}-composer.lowest-
#
# - name: Install Composer dependencies (Lowest dependencies)
# run: composer update --ansi --no-interaction --no-progress --prefer-lowest
#
# - name: Install Node
# uses: actions/setup-node@v4
# with:
# node-version: 23.x
#
# - name: Install NPM dependencies
# run: npm ci
#
# - name: Build assets
# run: npm run build
#
# - name: Generate encryption keys
# run: bin/console encryption:generate-keys
#
# - name: Create database schema
# run: bin/console doctrine:schema:create --env=test
#
# - name: Load database fixtures
# run: bin/console doctrine:fixtures:load --env=test --no-interaction
#
# - name: PHPUnit version
# run: bin/phpunit --version
#
# - name: Run PHPUnit
# run: bin/phpunit --coverage-text ${{ env.PHPUNIT_FLAGS }}