diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 5d1053f19..2ec68f40f 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -1,25 +1,50 @@ -name: validate +name: Validate/Lint on: [push, pull_request] jobs: build: runs-on: ${{ matrix.operating-system }} strategy: matrix: operating-system: [ubuntu-latest] php-versions: ['5.6'] name: PHP ${{ matrix.php-versions }} on ${{ matrix.operating-system }} steps: - name: Checkout uses: actions/checkout@v2 - name: Set up PHP uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php-versions }} extensions: pcre - name: Validate composer.json and composer.lock run: composer validate + + - name: Lint + run: | + lintPaths=() + lintPaths+=("${GITHUB_WORKSPACE}/admin") + lintPaths+=("${GITHUB_WORKSPACE}/feed") + lintPaths+=("${GITHUB_WORKSPACE}/install") + lintPaths+=("${GITHUB_WORKSPACE}/locale") + lintPaths+=("${GITHUB_WORKSPACE}/view") + lintPaths+=("${GITHUB_WORKSPACE}/index.php") + for lintPath in "${lintPaths[@]}" + do + for file in `find "$lintPath"` + do + EXTENSION="${file##*.}" + if [ "$EXTENSION" == "php" ] || [ "$EXTENSION" == "phtml" ] + then + RESULTS=`php -l "$file"` + if [ "$RESULTS" != "No syntax errors detected in $file" ] + then + echo $RESULTS + fi + fi + done + done