Merge pull request #30 from digitaldreams/develop #18
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: Full CI process for Symfony 5 | |
on: | |
push: | |
branches: | |
- master | |
env: | |
ES_HTTP_PORT: 9209 | |
jobs: | |
symfony: | |
name: Symfony 5.0 (PHP ${{ matrix.php-versions }}) | |
# https://hub.docker.com/_/ubuntu/ | |
runs-on: ubuntu-18.04 | |
services: | |
# https://docs.docker.com/samples/library/mysql/ | |
mysql: | |
image: mysql:5.7 | |
env: | |
MYSQL_ROOT_PASSWORD: root | |
ports: | |
- 3306:3306 | |
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | |
# https://hub.docker.com/_/elasticsearch/ | |
elasticsearch: | |
image: elasticsearch:6.8.6 | |
ports: | |
- 9209:9200 | |
options: -e="discovery.type=single-node" --health-cmd="curl http://localhost:9200/_cluster/health" --health-interval=10s --health-timeout=5s --health-retries=10 | |
strategy: | |
fail-fast: true | |
matrix: | |
php-versions: ['7.2', '7.4'] | |
steps: | |
# —— Check Elasticsearch 🔎 —————————————————————————————————————————————— | |
- name: Check the Elasticsearch connection from runner host | |
run: | | |
curl -fsSL "http://localhost:$ES_HTTP_PORT" | |
curl -fsSL "http://localhost:$ES_HTTP_PORT/_cluster/health?pretty" | |
# —— Setup Github actions 🐙 ————————————————————————————————————————————— | |
# https://github.com/actions/checkout (official) | |
- name: Checkout | |
uses: actions/checkout@v2 | |
# https://github.com/shivammathur/setup-php (community) | |
- name: Setup PHP, extensions and composer with shivammathur/setup-php | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-versions }} | |
extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite, dom, filter, gd, iconv, json, mbstring, pdo | |
env: | |
update: true | |
# https://github.com/zhulik/redis-action (community) | |
- name: Setup Redis with zhulik/redis-action | |
uses: zhulik/[email protected] | |
with: | |
redis version: '5' | |
# —— Composer 🧙️ ————————————————————————————————————————————————————————— | |
- name: Validate composer.json and composer.lock | |
run: composer validate | |
- name: Get composer cache directory | |
id: composer-cache | |
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | |
- name: Cache composer dependencies | |
uses: actions/cache@v1 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
restore-keys: ${{ runner.os }}-composer- | |
- name: Install Composer dependencies | |
run: make install | |
# —— Symfony 🎵 —————————————————————————————————————————————————————————— | |
- name: Check Symfony requirements | |
run: vendor/bin/requirements-checker | |
- name: Check the Symfony console | |
run: | | |
php bin/console -V | |
php bin/console strangebuzz:version | |
## —— Coding standards ✨ ———————————————————————————————————————————————— | |
- name: Coding standards checks (php_codesniffer + PHPStan) | |
run: make cs | |
## —— Tests ✅ ——————————————————————————————————————————————————————————— | |
- name: Load Doctrine fixtures and populate the Elasticsearch indexes | |
run: | | |
make load-fixtures | |
make populate | |
- name: Run functionnal and unit tests | |
run: | | |
cp phpunit.xml.ci phpunit.xml | |
make test |