PHP test #934
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: PHP test | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
repository_dispatch: | |
types: [ push ] | |
schedule: # Added to ensure build still works daily. | |
- cron: '0 2 * * *' # run at 2 AM UTC | |
jobs: | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
php-versions: ['8.1'] | |
services: | |
mongo: | |
image: mongo | |
env: | |
MONGO_INITDB_DATABASE: easio_test | |
MONGO_INITDB_ROOT_USERNAME: appuser | |
MONGO_INITDB_ROOT_PASSWORD: apppassword | |
postgres: | |
image: postgres:13.3-alpine3.14 | |
ports: | |
- 5432:5432 | |
env: | |
POSTGRES_DB: 'parthenon_test' | |
POSTGRES_USER: 'appuser' | |
POSTGRES_PASSWORD: 'apppassword' | |
redis: | |
image: redis | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Runs Elasticsearch | |
uses: elastic/elastic-github-actions/elasticsearch@master | |
with: | |
stack-version: 7.14.0 | |
port: 9200 | |
- name: Create all the databases | |
run: psql -h localhost -d parthenon_test -U appuser -f docker/database/init.sql | |
env: | |
PGPASSWORD: apppassword | |
- name: Setup PHP, with composer and extensions | |
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php | |
with: | |
php-version: ${{ matrix.php-versions }} | |
tools: phpunit-bridge | |
extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite, pgsql, mongodb | |
env: | |
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Get composer cache directory | |
id: composercache | |
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | |
- name: Cache dependencies | |
uses: actions/cache@v2 | |
with: | |
path: ${{ steps.composercache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} | |
restore-keys: ${{ runner.os }}-composer- | |
- name: Install dependencies | |
run: | | |
composer install | |
- name: Code Style | |
run: | | |
vendor/bin/php-cs-fixer fix src --dry-run | |
- name: Behat | |
run: | | |
vendor/bin/behat | |
- name: Install yarn | |
uses: borales/[email protected] | |
with: | |
cmd: install | |
- name: encore | |
uses: borales/[email protected] | |
with: | |
cmd: encore production | |
- name: Run vitest | |
uses: borales/[email protected] | |
with: | |
cmd: vitest |