From ae7755b4d1725ffbd02d0eaa5d90a873966d5838 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Wed, 21 Oct 2020 12:52:13 +0200 Subject: [PATCH] Add php-syntax workflow --- .github/php-syntax.json | 15 +++++++++++++++ .github/workflows/php-syntax.yml | 31 +++++++++++++++++++++++++++++++ .travis.yml | 1 - 3 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 .github/php-syntax.json create mode 100644 .github/workflows/php-syntax.yml diff --git a/.github/php-syntax.json b/.github/php-syntax.json new file mode 100644 index 0000000..dd45f79 --- /dev/null +++ b/.github/php-syntax.json @@ -0,0 +1,15 @@ +{ + "problemMatcher": [ + { + "owner": "php -l", + "pattern": [ + { + "regexp": "^\\s*(PHP\\s+)?([a-zA-Z\\s]+):\\s+(.*)\\s+in\\s+(\\S+)\\s+on\\s+line\\s+(\\d+)$", + "file": 4, + "line": 5, + "message": 3 + } + ] + } + ] +} diff --git a/.github/workflows/php-syntax.yml b/.github/workflows/php-syntax.yml new file mode 100644 index 0000000..3c469d4 --- /dev/null +++ b/.github/workflows/php-syntax.yml @@ -0,0 +1,31 @@ +name: PHP Syntax Check + +on: + push: + pull_request: + +jobs: + check: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + php: + - '7.0' + - '7.1' + - '7.2' + - '7.3' + - '7.4' + - '8.0' + steps: + - name: Set up PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + - uses: actions/checkout@v2 + - run: echo "::add-matcher::.github/php-syntax.json" + - name: Remove files to be ignored + run: | + true + - run: | + ! find . -type f -name '*.php' -exec php -l '{}' \; 2>&1 |grep -v '^No syntax errors detected' diff --git a/.travis.yml b/.travis.yml index fe07869..aea7d62 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,5 +10,4 @@ before_install: before_script: - git clone --branch=master --depth=1 --quiet git://github.com/WoltLab/WCF.git WCF script: - - find files -type f -name '*.php' |xargs -I file php -l file - phpcs -p --extensions=php --standard="`pwd`/WCF/CodeSniff/WCF" files -- 2.20.1