mirror of
https://github.com/super-linter/super-linter.git
synced 2024-11-25 15:41:02 -05:00
adding composer code (#1950)
* adding composer code * making it better * adding composer bin * adding some logic * make shellfmt happy
This commit is contained in:
parent
a3ad489783
commit
a3cce70fa3
4 changed files with 63 additions and 4 deletions
|
@ -399,8 +399,8 @@ RUN wget --tries=5 -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sger
|
|||
git git-lfs \
|
||||
glibc-${GLIBC_VERSION}.apk \
|
||||
gnupg \
|
||||
php7 php7-phar php7-json php7-mbstring php-xmlwriter \
|
||||
php7-tokenizer php7-ctype php7-curl php7-dom php7-simplexml \
|
||||
php7 php7-curl php7-ctype php7-dom php7-iconv php7-json php7-mbstring \
|
||||
php7-openssl php7-phar php7-simplexml php7-tokenizer php-xmlwriter \
|
||||
&& rm glibc-${GLIBC_VERSION}.apk \
|
||||
&& wget -q --tries=5 -O /tmp/libz.tar.xz https://www.archlinux.org/packages/core/x86_64/zlib/download \
|
||||
&& mkdir /tmp/libz \
|
||||
|
@ -437,6 +437,11 @@ COPY --from=base_image /home/r-library /home/r-library
|
|||
COPY --from=base_image /root/.tflint.d/ /root/.tflint.d/
|
||||
COPY --from=clang-format-build /tmp/llvm-project/llvm/build/bin/clang-format /usr/bin/clang-format
|
||||
|
||||
####################################################
|
||||
# Install Composer after all Libs have been copied #
|
||||
####################################################
|
||||
RUN sh -c 'curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer'
|
||||
|
||||
########################################
|
||||
# Add node packages to path and dotnet #
|
||||
########################################
|
||||
|
|
|
@ -336,8 +336,8 @@ RUN wget --tries=5 -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sger
|
|||
git git-lfs \
|
||||
glibc-${GLIBC_VERSION}.apk \
|
||||
gnupg \
|
||||
php7 php7-phar php7-json php7-mbstring php-xmlwriter \
|
||||
php7-tokenizer php7-ctype php7-curl php7-dom php7-simplexml \
|
||||
php7 php7-curl php7-ctype php7-dom php7-iconv php7-json php7-mbstring \
|
||||
php7-openssl php7-phar php7-simplexml php7-tokenizer php-xmlwriter \
|
||||
&& rm glibc-${GLIBC_VERSION}.apk \
|
||||
&& wget -q --tries=5 -O /tmp/libz.tar.xz https://www.archlinux.org/packages/core/x86_64/zlib/download \
|
||||
&& mkdir /tmp/libz \
|
||||
|
@ -373,6 +373,11 @@ COPY --from=base_image /home/r-library /home/r-library
|
|||
COPY --from=base_image /root/.tflint.d/ /root/.tflint.d/
|
||||
COPY --from=clang-format-build /tmp/llvm-project/llvm/build/bin/clang-format /usr/bin/clang-format
|
||||
|
||||
####################################################
|
||||
# Install Composer after all Libs have been copied #
|
||||
####################################################
|
||||
RUN sh -c 'curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer'
|
||||
|
||||
########################################
|
||||
# Add node packages to path and dotnet #
|
||||
########################################
|
||||
|
|
|
@ -394,3 +394,47 @@ function IsGenerated() {
|
|||
return 0
|
||||
fi
|
||||
}
|
||||
################################################################################
|
||||
#### Function RunAdditionalInstalls ############################################
|
||||
function RunAdditionalInstalls() {
|
||||
##################################
|
||||
# Run installs for Psalm and PHP #
|
||||
##################################
|
||||
if [ "${VALIDATE_PHP_PSALM}" == "true" ] && [ "${#FILE_ARRAY_PHP_PSALM[@]}" -ne 0 ]; then
|
||||
# found PHP files and were validating it, need to composer install
|
||||
info "Found PHP files to validate, and [VALIDATE_PHP_PSALM] set to true, need to run composer install"
|
||||
info "looking for composer.json in the users repository..."
|
||||
mapfile -t COMPOSER_FILE_ARRAY < <(find / -name composer.json 2>&1)
|
||||
debug "COMPOSER_FILE_ARRAY contents: ${COMPOSER_FILE_ARRAY[*]}"
|
||||
############################################
|
||||
# Check if we found the file in the system #
|
||||
############################################
|
||||
if [ "${#COMPOSER_FILE_ARRAY[@]}" -ne 0 ]; then
|
||||
for LINE in "${COMPOSER_FILE_ARRAY[@]}"; do
|
||||
PATH=$(dirname "${LINE}" 2>&1)
|
||||
info "Found [composer.json] at:[${LINE}]"
|
||||
COMPOSER_CMD=$(
|
||||
cd "${PATH}" || exit 1
|
||||
composer install 2>&1
|
||||
)
|
||||
|
||||
##############
|
||||
# Error code #
|
||||
##############
|
||||
ERROR_CODE=$?
|
||||
|
||||
##############################
|
||||
# Check the shell for errors #
|
||||
##############################
|
||||
if [ "${ERROR_CODE}" -ne 0 ]; then
|
||||
# Error
|
||||
error "ERROR! Failed to run composer install at location:[${PATH}]"
|
||||
fatal "ERROR:[${COMPOSER_CMD}]"
|
||||
else
|
||||
# Success
|
||||
info "Successfully ran:[composer install] for PHP validation"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
|
|
@ -914,6 +914,11 @@ CheckSSLCert
|
|||
###########################################
|
||||
BuildFileList "${VALIDATE_ALL_CODEBASE}" "${TEST_CASE_RUN}" "${ANSIBLE_DIRECTORY}"
|
||||
|
||||
#####################################
|
||||
# Run additional Installs as needed #
|
||||
#####################################
|
||||
RunAdditionalInstalls
|
||||
|
||||
###############
|
||||
# Run linters #
|
||||
###############
|
||||
|
|
Loading…
Reference in a new issue