-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new bin CI Shell scrpts for PHPStan & Psalm (#131)
* Add PHPStan and Psalm shell scripts. * Update composer phpstan and add composer pslam to scripts.
- Loading branch information
Showing
3 changed files
with
81 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
source "$(dirname "$0")/functions.sh" | ||
echo 'Running PHPStan' | ||
|
||
against="${GITHUB_HEAD_REF:=$(get_commit_against)}" | ||
commit="${GITHUB_BASE_REF:=develop}" | ||
echo "git merge-base commit: ${commit} against: ${against}" | ||
if [[ -z ${CHANGED_FILES+x} ]]; then | ||
commitFiles=$(git diff --name-only "$(git merge-base "${commit}" "${against}")") | ||
else | ||
commitFiles="${CHANGED_FILES}" | ||
fi | ||
|
||
args="${ARGS:=analyze --memory-limit 1G}" | ||
phpFiles="" | ||
phpFilesCount=0 | ||
for f in ${commitFiles}; do | ||
if [[ ! -e ${f} ]]; then | ||
continue | ||
fi | ||
if [[ ${f} =~ \.(php|ctp)$ && ! ${f} =~ ^tests/ ]]; then | ||
phpFilesCount=$((phpFilesCount + 1)) | ||
phpFiles="$phpFiles $f" | ||
fi | ||
done | ||
if [[ ${phpFilesCount} == 0 ]]; then | ||
echo "No PHP files updated, nothing to check." | ||
exit 0 | ||
fi | ||
|
||
phpFiles=$(echo "${phpFiles}" | xargs) | ||
echo "Checking files: $phpFiles" | ||
|
||
# shellcheck disable=SC2086 | ||
source_bin_file phpstan ${args} ${phpFiles} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
source "$(dirname "$0")/functions.sh" | ||
echo 'Running Psalm' | ||
|
||
against="${GITHUB_HEAD_REF:=$(get_commit_against)}" | ||
commit="${GITHUB_BASE_REF:=develop}" | ||
echo "git merge-base commit: ${commit} against: ${against}" | ||
if [[ -z ${CHANGED_FILES+x} ]]; then | ||
commitFiles=$(git diff --name-only "$(git merge-base "${commit}" "${against}")") | ||
else | ||
commitFiles="${CHANGED_FILES}" | ||
fi | ||
|
||
args="${ARGS:=--config=psalm.xml --show-info=true}" | ||
phpFiles="" | ||
phpFilesCount=0 | ||
for f in ${commitFiles}; do | ||
if [[ ! -e ${f} ]]; then | ||
continue | ||
fi | ||
if [[ ${f} =~ \.(php|ctp)$ && ! ${f} =~ ^tests/ ]]; then | ||
phpFilesCount=$((phpFilesCount + 1)) | ||
phpFiles="$phpFiles $f" | ||
fi | ||
done | ||
if [[ ${phpFilesCount} == 0 ]]; then | ||
echo "No PHP files updated, nothing to check." | ||
exit 0 | ||
fi | ||
|
||
phpFiles=$(echo "${phpFiles}" | xargs) | ||
echo "Checking files: $phpFiles" | ||
|
||
# shellcheck disable=SC2086 | ||
source_bin_file psalm ${args} ${phpFiles} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters