Created
January 16, 2021 19:31
-
-
Save irozgar/bf9ab057df8be7328d3362f98f1b87d2 to your computer and use it in GitHub Desktop.
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: CI for API | |
on: | |
pull_request: | |
paths: | |
- 'api/**' | |
- '.github/workflows/ci_api.yaml' | |
jobs: | |
coding-standard: | |
name: Coding Standard | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Install PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.0 | |
coverage: none | |
- name: Install dependencies with composer | |
run: (cd api; composer install --no-suggest --no-interaction --no-ansi --no-progress) | |
- name: Run squizlabs/php_codesniffer | |
run: (cd api; vendor/bin/phpcs) | |
static-analysis: | |
name: Static Analysis | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Install PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.0 | |
coverage: none | |
- name: Install dependencies with composer | |
run: (cd api; composer install --no-suggest --no-interaction --no-ansi --no-progress) | |
- name: Run vimeo/psalm | |
run: (cd api; vendor/bin/psalm --show-info=false) | |
lint-yaml: | |
name: Lint YAML configuration | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Install PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.0 | |
coverage: none | |
- name: Install dependencies with composer | |
run: (cd api; composer install --no-suggest --no-interaction --no-ansi --no-progress) | |
- name: Run linter | |
run: | | |
cd api | |
bin/console lint:yaml config src | |
bin/console lint:container | |
tests: | |
name: Tests | |
runs-on: ubuntu-latest | |
services: | |
db: | |
image: mariadb:10.5 | |
ports: | |
- 3306 | |
env: | |
MYSQL_DATABASE: data-engine | |
MYSQL_ROOT_PASSWORD: dev | |
options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Install PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.0 | |
coverage: none | |
- name: Install dependencies with composer | |
run: (cd api; composer install --no-suggest --no-interaction --no-ansi --no-progress) | |
- name: Wait for MySQL | |
env: | |
PORT: ${{ job.services.db.ports[3306] }} | |
run: | | |
while ! mysqladmin ping -h"127.0.0.1" -P"$PORT" --silent; do | |
sleep 1 | |
done | |
- name: Change database collation | |
env: | |
PORT: ${{ job.services.db.ports[3306] }} | |
run: mysql -h"127.0.0.1" -uroot -pdev -P"$PORT" -e 'ALTER DATABASE `data-engine` COLLATE 'utf8mb4_unicode_ci'' | |
- name: Run database migrations | |
env: | |
DATABASE_URL: mysql://root:[email protected]:${{ job.services.db.ports[3306] }}/data-engine?serverVersion=mariadb-10.5.4 | |
run: (cd api; bin/console doctrine:migrations:migrate --no-interaction) | |
- name: Run tests | |
env: | |
DATABASE_URL: mysql://root:[email protected]:${{ job.services.db.ports[3306] }}/data-engine?serverVersion=mariadb-10.5.4 | |
run: (cd api; vendor/bin/phpunit) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment