Improve GitHub workflow configurations #427
Workflow file for this run
This file contains hidden or 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: Run tests | |
| 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: 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"] | |
| 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: 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 ${{ env.PHPUNIT_FLAGS }} |