Run CI & security check using GitHub actions #3
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" | |
concurrency: | |
group: "tests-${{ github.head_ref || github.run_id }}" | |
cancel-in-progress: true | |
on: | |
pull_request: | |
push: | |
branches: [master] | |
jobs: | |
tests: | |
name: "PHP ${{ matrix.php-version }}" | |
runs-on: "ubuntu-latest" | |
container: | |
image: "php:${{ matrix.php-version }}-fpm-alpine" | |
services: | |
postgresql: | |
image: "postgres:11.7-alpine" | |
env: | |
POSTGRES_USER: main | |
POSTGRES_PASSWORD: main | |
POSTGRES_DB: main | |
strategy: | |
fail-fast: false | |
matrix: | |
php-version: | |
- "7.4.1" | |
steps: | |
- name: "Install OS dependencies" | |
run: "apk add --no-cache bash git icu-dev libzip-dev unzip zip" | |
- name: "Install PHP extensions" | |
shell: bash | |
run: | | |
wget https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions --quiet -O /usr/local/bin/install-php-extensions | |
chmod +x /usr/local/bin/install-php-extensions && sync | |
install-php-extensions intl pdo_pgsql zip | |
- name: "Install composer" | |
run: "curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer --version=2.6.5" | |
- name: "Checkout" | |
uses: "actions/checkout@v4" | |
with: | |
show-progress: false | |
- name: "Install Composer dependencies" | |
uses: "ramsey/composer-install@v2" | |
- name: "Validate Composer dependencies" | |
run: "composer validate" | |
- name: "Check code style" | |
run: "composer check-cs" | |
- name: "Run PHPStan" | |
run: "composer phpstan" | |
- name: "Lint twig" | |
run: "bin/console lint:twig templates --show-deprecations" | |
- name: "Run migrations" | |
run: "bin/console doctrine:migrations:migrate --no-interaction" | |
- name: "Validate database schema" | |
run: "bin/console doctrine:schema:validate" | |
- name: "Setup messenger transports" | |
run: "bin/console messenger:setup-transports" | |
- name: "Run PHPUnit" | |
run: "composer phpunit" | |
- name: "Warmup prod cache" | |
run: "bin/console cache:warmup --env=prod" |