Skip to content

Commit 965d93c

Browse files
author
Greg Bowler
committed
Add github action configuration
1 parent 7b12480 commit 965d93c

File tree

3 files changed

+101
-0
lines changed

3 files changed

+101
-0
lines changed

Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM phpstan/phpstan:0.12
2+
3+
LABEL version="1.0.0"
4+
LABEL repository="https://github.com/php-actions/phpstan"
5+
LABEL homepage="https://github.com/php-actions/phpstan"
6+
LABEL maintainer="Greg Bowler <greg.bowler@g105b.com>"
7+
8+
COPY entrypoint /usr/local/bin/entrypoint
9+
ENTRYPOINT ["/usr/local/bin/entrypoint"]

action.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: PHPStan (php-actions)
2+
description: PHP Static Analysis in Github Actions.
3+
4+
inputs:
5+
configuration:
6+
description: Configuration file location
7+
required: false
8+
level:
9+
description: Level of rule options - the higher the stricter
10+
required: false
11+
paths_file:
12+
description: Path to a file with a list of paths to run analysis on
13+
required: false
14+
autoload_file:
15+
description: Project's additional autoload file path
16+
required: false
17+
error_format:
18+
description: Format in which to print the result of the analysis
19+
required: false
20+
generate_baseline:
21+
description: Path to a file where the baseline should be saved
22+
required: false
23+
memory_limit:
24+
description: Memory limit for analysis
25+
required: false
26+
args:
27+
description: Extra arguments to pass to the phpstan binary
28+
required: false
29+
30+
runs:
31+
using: 'docker'
32+
image: 'Dockerfile'
33+
env:
34+
action_configuration: ${{ inputs.configuration }}
35+
action_level: ${{ inputs.level }}
36+
action_paths_file: ${{ inputs.paths_file }}
37+
action_autoload_file: ${{ inputs.autoload_file }}
38+
action_error_format: ${{ inputs.error_format }}
39+
action_generate_baseline: ${{ inputs.generate_baseline }}
40+
action_memory_limit: ${{ inputs.memory_limit }}
41+
action_args: ${{ inputs.args }}
42+
43+
branding:
44+
icon: 'check-square'
45+
color: 'purple'

entrypoint

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/bin/bash
2+
set -e
3+
4+
command_string="phpstan"
5+
6+
if [ -n "$action_configuration" ]
7+
then
8+
command_string="$command_string --configuration='$action_configuration'"
9+
fi
10+
11+
if [ -n "$action_level" ]
12+
then
13+
command_string="$command_string --level=$action_level"
14+
fi
15+
16+
if [ -n "$action_paths_file" ]
17+
then
18+
command_string="$command_string --paths-file='$action_paths_file'"
19+
fi
20+
21+
if [ -n "$action_autoload_file" ]
22+
then
23+
command_string="$command_string --autoload-file='$action_autoload_file'"
24+
fi
25+
26+
if [ -n "$action_error_format" ]
27+
then
28+
command_string="$command_string --error-format=$action_error_format"
29+
fi
30+
31+
if [ -n "$action_generate_baseline" ]
32+
then
33+
command_string="$command_string --generate-baseline=$action_generate_baseline"
34+
fi
35+
36+
if [ -n "$action_memory_limit" ]
37+
then
38+
command_string="$command_string --memory-limit=$action_memory_limit"
39+
fi
40+
41+
if [ -n "$action_args" ]
42+
then
43+
command_string="$command_string $action_args"
44+
fi
45+
46+
echo "Command: $command_string"
47+
eval "$command_string"

0 commit comments

Comments
 (0)