Skip to content

Commit fb9e746

Browse files
authored
Merge pull request #50 from DominicWatts/master
static code analysis with the PHPCompatibility Coding Standard
2 parents f751f9c + fe91fbf commit fb9e746

7 files changed

Lines changed: 94 additions & 0 deletions

File tree

php-compatibility/7.3/action.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: 'PHPCompatibility'
2+
author: 'ExtDN'
3+
description: 'performs php static code analysis with the PHPCompatibility Coding Standard'
4+
inputs:
5+
phpcs_standard:
6+
description: 'PHPCompatibility standard.'
7+
required: false
8+
runs:
9+
using: 'docker'
10+
image: 'docker://extdn/php-compatibility-action:7.3-latest'
11+
branding:
12+
icon: 'code'
13+
color: 'green'

php-compatibility/7.4/action.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: 'PHPCompatibility'
2+
author: 'ExtDN'
3+
description: 'performs php static code analysis with the PHPCompatibility Coding Standard'
4+
inputs:
5+
phpcs_standard:
6+
description: 'PHPCompatibility standard.'
7+
required: false
8+
runs:
9+
using: 'docker'
10+
image: 'docker://extdn/php-compatibility-action:7.4-latest'
11+
branding:
12+
icon: 'code'
13+
color: 'green'

php-compatibility/Dockerfile:7.3

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM php:7.3-cli-alpine3.9
2+
3+
COPY --from=composer:1 /usr/bin/composer /usr/local/bin/composer
4+
5+
RUN /usr/local/bin/composer global require phpcompatibility/php-compatibility:*
6+
RUN ~/.composer/vendor/bin/phpcs --config-set installed_paths ../../phpcompatibility/php-compatibility
7+
RUN echo memory_limit = -1 >> /usr/local/etc/php/conf.d/custom-memory.ini
8+
9+
ADD problem-matcher.json /problem-matcher.json
10+
ADD entrypoint.sh /entrypoint.sh
11+
ENTRYPOINT ["/entrypoint.sh"]

php-compatibility/Dockerfile:7.4

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM php:7.4-cli-alpine
2+
3+
COPY --from=composer:1 /usr/bin/composer /usr/local/bin/composer
4+
5+
RUN /usr/local/bin/composer global require phpcompatibility/php-compatibility:*
6+
RUN ~/.composer/vendor/bin/phpcs --config-set installed_paths ../../phpcompatibility/php-compatibility
7+
RUN echo memory_limit = -1 >> /usr/local/etc/php/conf.d/custom-memory.ini
8+
9+
ADD problem-matcher.json /problem-matcher.json
10+
ADD entrypoint.sh /entrypoint.sh
11+
ENTRYPOINT ["/entrypoint.sh"]

php-compatibility/action.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: 'PHPCompatibility'
2+
author: 'ExtDN'
3+
description: 'performs php static code analysis with the PHPCompatibility Standard'
4+
inputs:
5+
phpcs_standard:
6+
description: 'PHPCompatibility standard'
7+
required: false
8+
runs:
9+
using: 'docker'
10+
image: 'docker://extdn/php-compatibility-action:latest'
11+
branding:
12+
icon: 'code'
13+
color: 'green'

php-compatibility/entrypoint.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/sh -l
2+
3+
# Copy the matcher to a shared volume with the host; otherwise "add-matcher"
4+
# can't find it.
5+
cp /problem-matcher.json ${HOME}/
6+
echo "::add-matcher::${HOME}/problem-matcher.json"
7+
8+
cd $GITHUB_WORKSPACE
9+
test -z "${INPUT_RUNTIME}" && INPUT_RUNTIME=7.3-7.4
10+
sh -c "/root/.composer/vendor/bin/phpcs --report=checkstyle --standard=PHPCompatibility --runtime-set testVersion $INPUT_RUNTIME $GITHUB_WORKSPACE -s $*"
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"problemMatcher": [
3+
{
4+
"owner": "phpcs",
5+
"severity": "error",
6+
"pattern": [
7+
{
8+
"regexp": "^<file name=\"(?:\\/github\\/workspace\\/)?(.*)\">$",
9+
"file": 1
10+
},
11+
{
12+
"regexp": "<error line=\"(\\d*)\" column=\"(\\d*)\" severity=\"(error|warning)\" message=\"(.*)\" source=\"(.*)(\"\\/>+)$",
13+
"line": 1,
14+
"column": 2,
15+
"severity": 3,
16+
"message": 4,
17+
"code": 5,
18+
"loop": true
19+
}
20+
]
21+
}
22+
]
23+
}

0 commit comments

Comments
 (0)