Run CI & security check using GitHub actions #25
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 }}" | |
runs-on: "ubuntu-latest" | |
container: | |
image: "php:${{ matrix.php-version }}-cli-alpine" | |
env: | |
DATABASE_URL: postgresql://main:main@postgresql:5432/main?serverVersion=11&charset=utf8 | |
services: | |
postgresql: | |
image: "postgres:11.7-alpine" | |
env: | |
POSTGRES_USER: main | |
POSTGRES_PASSWORD: main | |
POSTGRES_DB: main | |
ports: | |
- 5432 | |
strategy: | |
fail-fast: false | |
matrix: | |
php: | |
- "7.4" | |
include: | |
- php: "7.4" | |
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 | |
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.6 | |
- 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: "Setup messenger transports" | |
run: "bin/console messenger:setup-transports" | |
- name: "Validate database schema" | |
run: "bin/console doctrine:schema:validate" | |
- name: "Set git committer info" | |
shell: bash | |
run: | | |
git config --global user.name "${GITHUB_ACTOR}" | |
git config --global user.email "${GITHUB_ACTOR_ID}+${GITHUB_ACTOR}@users.noreply.github.com" | |
- name: "Run unit tests" | |
run: "composer phpunit:unit" | |
- name: "Run integration tests" | |
run: "composer phpunit:integration" | |
- name: "Run functional tests" | |
run: "composer phpunit:functional" | |
- name: "Warmup prod cache" | |
run: "bin/console cache:warmup --env=prod" |