From 7e6101235908d67751560dfe56663ef9964077e5 Mon Sep 17 00:00:00 2001 From: Bruce Weirdan Date: Sat, 13 Feb 2021 00:03:03 +0200 Subject: [PATCH] Add linting to prevent embarassing errors (#5209) * Added linting to prevent embarassing errors Refs vimeo/psalm#5201 * Ignore unused requirements --- .github/workflows/ci.yml | 35 +++++++++++++++++++++++++++++++++++ composer.json | 1 + 2 files changed, 36 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6335ab8c34a..951f99c5f58 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,6 +2,41 @@ name: Run unit tests on: [push, pull_request] jobs: + lint: + name: Check PHP syntax + runs-on: ubuntu-latest + steps: + - name: Set up PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '7.1' + tools: composer:v2 + + - uses: actions/checkout@v2 + + - name: Get Composer Cache Directories + id: composer-cache + run: | + echo "::set-output name=files_cache::$(composer config cache-files-dir)" + echo "::set-output name=vcs_cache::$(composer config cache-vcs-dir)" + + - name: Cache composer cache + uses: actions/cache@v2 + with: + path: | + ${{ steps.composer-cache.outputs.files_cache }} + ${{ steps.composer-cache.outputs.vcs_cache }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-composer- + + - name: Run composer install + run: composer install -o --ignore-platform-reqs + env: + COMPOSER_ROOT_VERSION: dev-master + + - run: | + vendor/bin/parallel-lint src chunk-matrix: name: Generate Chunk Matrix diff --git a/composer.json b/composer.json index 37839acee27..ecd18020c28 100644 --- a/composer.json +++ b/composer.json @@ -44,6 +44,7 @@ "amphp/amp": "^2.4.2", "bamarni/composer-bin-plugin": "^1.2", "brianium/paratest": "^4.0||^6.0", + "php-parallel-lint/php-parallel-lint": "^1.2", "phpdocumentor/reflection-docblock": "^5", "phpmyadmin/sql-parser": "5.1.0||dev-master", "phpspec/prophecy": ">=1.9.0",