Skip to content

Instantly share code, notes, and snippets.

@faizanakram99
Created November 11, 2020 03:34
Show Gist options
  • Save faizanakram99/48a59b599110b64e3a17099a518910ed to your computer and use it in GitHub Desktop.
Save faizanakram99/48a59b599110b64e3a17099a518910ed to your computer and use it in GitHub Desktop.
name: Code check
on:
push:
branches: [ master, develop ]
pull_request:
branches: [ master, develop ]
types: [ synchronize, opened, reopened, ready_for_review ]
jobs:
code-check:
runs-on: ubuntu-latest
if: github.event.pull_request.draft == false
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2
with:
php-version: "7.4"
tools: pecl, php-cs-fixer:2.16.3, cs2pr
extensions: curl, mbstring, xml, ctype, iconv, intl, pdo_sqlite, mysql, bcmath, iconv, gd, intl, mysqli, pdo_mysql, zip, redis, imap, apcu
coverage: none
- name: Composer install including dev-dependencies
run: |
composer install --no-progress --no-suggest --prefer-dist --optimize-autoloader --no-scripts --ignore-platform-reqs
- name: Start Redis
uses: supercharge/redis-github-action@1.1.0
with:
redis-version: 5
- id: file_changes
if: github.event_name != 'release'
uses: trilom/file-changes-action@v1.2.4
with:
output: "|"
- name: PHP-CS-Fixer
if: github.event_name != 'release'
run: |
changed_files="${{ steps.file_changes.outputs.files_modified }}|${{ steps.file_changes.outputs.files_added }}"
php_files=$(echo $changed_files | awk 'BEGIN { RS="|" } /.php/')
[ -z $php_files ] && echo 'No php files' || php-cs-fixer fix --config=.php_cs.dist --dry-run --allow-risky=yes --format=checkstyle $php_files | cs2pr
- name: Check service definitions
run: ./bin/console lint:container --env=prod
env:
DATABASE_URL: mysql://root@127.0.0.1:${{ job.services.mysql.ports['3306'] }}/demo
INSTALLATION_NAME: demo
REDIS_URL: redis://127.0.0.1:6379
- name: Check twig templates syntax
run: ./bin/console lint:twig templates
- name: Check xlf translation files syntax
run: ./bin/console lint:xliff src
- name: Check yaml files syntax
run: ./bin/console lint:yaml --parse-tags src app custom_translations
- name: Validate dynamic fields
run: ./bin/console tenants:run-command dynamic-fields:validate
- name: Check doctrine mappings
run: ./bin/console doctrine:schema:validate --skip-sync -v
- name: Run php stan static analysis
run: composer phpstan
env:
DATABASE_URL: mysql://root@127.0.0.1:${{ job.services.mysql.ports['3306'] }}/demo
INSTALLATION_NAME: demo
- name: Run php psalm static analysis
run: composer psalm
env:
DATABASE_URL: mysql://root@127.0.0.1:${{ job.services.mysql.ports['3306'] }}/demo
INSTALLATION_NAME: demo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment