-
-
Notifications
You must be signed in to change notification settings - Fork 244
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
419 additions
and
128 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
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
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
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
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
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
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,255 @@ | ||
# syntax=docker/dockerfile:1 | ||
########################################### | ||
########################################### | ||
## Dockerfile to run MegaLinter ## | ||
########################################### | ||
########################################### | ||
|
||
# @not-generated | ||
|
||
############################################################################################# | ||
## @generated by .automation/build.py using descriptor files, please do not update manually ## | ||
############################################################################################# | ||
#ARGTOP__START | ||
|
||
#ARGTOP__END | ||
|
||
############################################################################################# | ||
## @generated by .automation/build.py using descriptor files, please do not update manually ## | ||
############################################################################################# | ||
#FROM__START | ||
|
||
#FROM__END | ||
|
||
################## | ||
# Get base image # | ||
################## | ||
FROM python:3.12.3-alpine3.19 | ||
|
||
############################################################################################# | ||
## @generated by .automation/build.py using descriptor files, please do not update manually ## | ||
############################################################################################# | ||
#ARG__START | ||
|
||
#ARG__END | ||
|
||
# Static args | ||
ARG GITHUB_TOKEN | ||
|
||
#################### | ||
# Run APK installs # | ||
#################### | ||
|
||
WORKDIR / | ||
|
||
############################################################################################# | ||
## @generated by .automation/build.py using descriptor files, please do not update manually ## | ||
############################################################################################# | ||
#APK__START | ||
RUN apk add --no-cache \ | ||
bash \ | ||
ca-certificates \ | ||
curl \ | ||
gcc \ | ||
git \ | ||
git-lfs \ | ||
libffi-dev \ | ||
make \ | ||
musl-dev \ | ||
openssh \ | ||
gnupg \ | ||
php83 \ | ||
php83-phar \ | ||
php83-mbstring \ | ||
php83-xmlwriter \ | ||
php83-tokenizer \ | ||
php83-ctype \ | ||
php83-curl \ | ||
php83-dom \ | ||
php83-opcache \ | ||
php83-openssl \ | ||
php83-common \ | ||
php83-simplexml \ | ||
dpkg \ | ||
&& git config --global core.autocrlf true | ||
#APK__END | ||
|
||
# PATH for golang & python | ||
ENV GOROOT=/usr/lib/go \ | ||
GOPATH=/go | ||
# PYTHONPYCACHEPREFIX="$HOME/.cache/cpython/" NV: not working for all packages :/ | ||
# hadolint ignore=DL3044 | ||
ENV PATH="$PATH":"$GOROOT"/bin:"$GOPATH"/bin | ||
RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ | ||
# Ignore npm package issues | ||
yarn config set ignore-engines true || true | ||
|
||
############################## | ||
# Installs rust dependencies # | ||
############################################################################################# | ||
## @generated by .automation/build.py using descriptor files, please do not update manually ## | ||
############################################################################################# | ||
|
||
#CARGO__START | ||
|
||
#CARGO__END | ||
|
||
################################ | ||
# Installs python dependencies # | ||
############################################################################################# | ||
## @generated by .automation/build.py using descriptor files, please do not update manually ## | ||
############################################################################################# | ||
|
||
#PIPVENV__START | ||
|
||
#PIPVENV__END | ||
|
||
############################ | ||
# Install NPM dependencies # | ||
############################################################################################# | ||
## @generated by .automation/build.py using descriptor files, please do not update manually ## | ||
############################################################################################# | ||
|
||
ENV NODE_OPTIONS="--max-old-space-size=8192" \ | ||
NODE_ENV=production | ||
#NPM__START | ||
|
||
#NPM__END | ||
|
||
# Add node packages to path # | ||
ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ | ||
NODE_PATH="/node-deps/node_modules" | ||
|
||
############################## | ||
# Installs ruby dependencies # | ||
############################################################################################# | ||
## @generated by .automation/build.py using descriptor files, please do not update manually ## | ||
############################################################################################# | ||
|
||
#GEM__START | ||
|
||
#GEM__END | ||
|
||
############################## | ||
# COPY instructions # | ||
############################################################################################# | ||
## @generated by .automation/build.py using descriptor files, please do not update manually ## | ||
############################################################################################# | ||
|
||
#COPY__START | ||
COPY --from=composer/composer:2-bin /composer /usr/bin/composer | ||
#COPY__END | ||
|
||
############################################################################################# | ||
## @generated by .automation/build.py using descriptor files, please do not update manually ## | ||
############################################################################################# | ||
#OTHER__START | ||
# PHP installation | ||
RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GITHUB_TOKEN)" \ | ||
&& export GITHUB_AUTH_TOKEN \ | ||
&& wget --tries=5 -q -O phive.phar https://phar.io/releases/phive.phar \ | ||
&& wget --tries=5 -q -O phive.phar.asc https://phar.io/releases/phive.phar.asc \ | ||
&& PHAR_KEY_ID="0x6AF725270AB81E04D79442549D8A98B29B2D5D79" \ | ||
&& ( gpg --keyserver hkps://keys.openpgp.org --recv-keys "$PHAR_KEY_ID" \ | ||
|| gpg --keyserver hkps://keyserver.ubuntu.com --recv-keys "$PHAR_KEY_ID" \ | ||
|| gpg --keyserver keyserver.pgp.com --recv-keys "$PHAR_KEY_ID" \ | ||
|| gpg --keyserver pgp.mit.edu --recv-keys "$PHAR_KEY_ID" ) \ | ||
&& gpg --verify phive.phar.asc phive.phar \ | ||
&& chmod +x phive.phar \ | ||
&& mv phive.phar /usr/local/bin/phive \ | ||
&& rm phive.phar.asc \ | ||
&& update-alternatives --install /usr/bin/php php /usr/bin/php83 110 | ||
|
||
# Managed with COPY --from=composer/composer:2-bin /composer /usr/bin/composer | ||
ENV PATH="/root/.composer/vendor/bin:${PATH}" | ||
|
||
# php-cs-fixer installation | ||
RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GITHUB_TOKEN)" && export GITHUB_AUTH_TOKEN && composer global require friendsofphp/php-cs-fixer | ||
|
||
|
||
#OTHER__END | ||
|
||
################################ | ||
# Installs python dependencies # | ||
################################ | ||
COPY megalinter /megalinter | ||
RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ | ||
&& PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ | ||
&& rm -rf /var/cache/apk/* \ | ||
&& find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf | ||
|
||
####################################### | ||
# Copy scripts and rules to container # | ||
####################################### | ||
COPY megalinter/descriptors /megalinter-descriptors | ||
COPY TEMPLATES /action/lib/.automation | ||
|
||
# Copy server scripts | ||
COPY server /server | ||
|
||
########################### | ||
# Get the build arguments # | ||
########################### | ||
ARG BUILD_DATE | ||
ARG BUILD_REVISION | ||
ARG BUILD_VERSION | ||
|
||
################################################# | ||
# Set ENV values used for debugging the version # | ||
################################################# | ||
ENV BUILD_DATE=$BUILD_DATE \ | ||
BUILD_REVISION=$BUILD_REVISION \ | ||
BUILD_VERSION=$BUILD_VERSION | ||
|
||
#FLAVOR__START | ||
ENV MEGALINTER_FLAVOR=none | ||
#FLAVOR__END | ||
|
||
######################################### | ||
# Label the instance and set maintainer # | ||
######################################### | ||
LABEL com.github.actions.name="MegaLinter" \ | ||
com.github.actions.description="The ultimate linters aggregator to make sure your projects are clean" \ | ||
com.github.actions.icon="code" \ | ||
com.github.actions.color="red" \ | ||
maintainer="Nicolas Vuillamy <[email protected]>" \ | ||
org.opencontainers.image.created=$BUILD_DATE \ | ||
org.opencontainers.image.revision=$BUILD_REVISION \ | ||
org.opencontainers.image.version=$BUILD_VERSION \ | ||
org.opencontainers.image.authors="Nicolas Vuillamy <[email protected]>" \ | ||
org.opencontainers.image.url="https://megalinter.io" \ | ||
org.opencontainers.image.source="https://github.com/oxsecurity/megalinter" \ | ||
org.opencontainers.image.documentation="https://megalinter.io" \ | ||
org.opencontainers.image.vendor="Nicolas Vuillamy" \ | ||
org.opencontainers.image.description="Lint your code base with GitHub Actions" | ||
|
||
#EXTRA_DOCKERFILE_LINES__START | ||
ENV ENABLE_LINTERS=PHP_PHPCSFIXER \ | ||
FLAVOR_SUGGESTIONS=false \ | ||
SINGLE_LINTER=PHP_PHPCSFIXER \ | ||
PRINT_ALPACA=false \ | ||
LOG_FILE=none \ | ||
SARIF_REPORTER=true \ | ||
TEXT_REPORTER=false \ | ||
UPDATED_SOURCES_REPORTER=false \ | ||
GITHUB_STATUS_REPORTER=false \ | ||
GITHUB_COMMENT_REPORTER=false \ | ||
EMAIL_REPORTER=false \ | ||
FILEIO_REPORTER=false \ | ||
CONFIG_REPORTER=false \ | ||
SARIF_TO_HUMAN=false | ||
RUN mkdir /root/docker_ssh && mkdir /usr/bin/megalinter-sh | ||
EXPOSE 22 | ||
COPY entrypoint.sh /entrypoint.sh | ||
COPY sh /usr/bin/megalinter-sh | ||
COPY sh/megalinter_exec /usr/bin/megalinter_exec | ||
COPY sh/motd /etc/motd | ||
RUN find /usr/bin/megalinter-sh/ -type f -iname "*.sh" -exec chmod +x {} \; && \ | ||
chmod +x entrypoint.sh && \ | ||
chmod +x /usr/bin/megalinter_exec && \ | ||
echo "alias megalinter='python -m megalinter.run'" >> ~/.bashrc && source ~/.bashrc && \ | ||
echo "alias megalinter_exec='/usr/bin/megalinter_exec'" >> ~/.bashrc && source ~/.bashrc | ||
RUN export STANDALONE_LINTER_VERSION="$(python -m megalinter.run --input /tmp --linterversion)" && \ | ||
echo $STANDALONE_LINTER_VERSION | ||
ENTRYPOINT ["/bin/bash", "/entrypoint.sh"] | ||
#EXTRA_DOCKERFILE_LINES__END |
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
14 changes: 14 additions & 0 deletions
14
megalinter/tests/test_megalinter/linters/php_phpcsfixer_test.py
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,14 @@ | ||
# !/usr/bin/env python3 | ||
""" | ||
Unit tests for PHP linter php-cs-fixer | ||
This class has been automatically @generated by .automation/build.py, please don't update it manually | ||
""" | ||
|
||
from unittest import TestCase | ||
|
||
from megalinter.tests.test_megalinter.LinterTestRoot import LinterTestRoot | ||
|
||
|
||
class php_phpcsfixer_test(TestCase, LinterTestRoot): | ||
descriptor_id = "PHP" | ||
linter_name = "php-cs-fixer" |