-
-
Notifications
You must be signed in to change notification settings - Fork 241
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(descriptors, lua): add
stylua
support (#3985)
* feat(descriptors, lua): add `stylua` support * feat: add `stylua` and `johnnymorganz` and sorted * fix: make changes to fit `stylua` and lua linters * feat: build after changes * fix: `stylua` to `Stylua` * fix: use correct var syntax * fix: use lowercase repo name * fix: modify dockerfile commands * fix(test): make test error * feat: use `cargo` installation
- Loading branch information
1 parent
aabd7ac
commit c2045ac
Showing
12 changed files
with
323 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
local embracer = {} | ||
|
||
local function helper(opt) | ||
-- NYI wontfix | ||
print(opt) | ||
-- NYI wontfix | ||
print(opt) | ||
end | ||
|
||
function embracer.embrace(opt) | ||
opt = opt or "default" | ||
return helper(opt.."?") | ||
opt = opt or "default" | ||
return helper(opt .. "?") | ||
end | ||
|
||
return embracer |
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
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,245 @@ | ||
# 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 | ||
|
||
################## | ||
# Build wheel for megalinter python package | ||
################## | ||
FROM ghcr.io/astral-sh/uv:0.4.7 AS uv | ||
FROM python:3.12.5-alpine3.20 AS build-ml-core | ||
WORKDIR / | ||
COPY pyproject.toml . | ||
COPY --from=uv /uv /bin/uv | ||
RUN --mount=type=cache,target=/root/.cache/uv \ | ||
uv pip install --system -r pyproject.toml | ||
COPY . . | ||
RUN --mount=type=cache,target=/root/.cache/uv \ | ||
uv pip install --system . | ||
|
||
################## | ||
# Get base image # | ||
################## | ||
FROM python:3.12.5-alpine3.20 | ||
|
||
############################################################################################# | ||
## @generated by .automation/build.py using descriptor files, please do not update manually ## | ||
############################################################################################# | ||
#ARG__START | ||
# renovate: datasource=crate depName=stylua | ||
ARG LUA_STYLUA_VERSION=0.20.0 | ||
#ARG__END | ||
|
||
#################### | ||
# 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 \ | ||
readline-dev \ | ||
&& 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 | ||
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable \ | ||
&& export PATH="/root/.cargo/bin:${PATH}" \ | ||
&& cargo install --force --locked stylua@${LUA_STYLUA_VERSION} \ | ||
&& rm -rf /root/.cargo/registry /root/.cargo/git /root/.cache/sccache /root/.rustup | ||
ENV PATH="/root/.cargo/bin:${PATH}" | ||
#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__END | ||
|
||
############################################################################################# | ||
## @generated by .automation/build.py using descriptor files, please do not update manually ## | ||
############################################################################################# | ||
#OTHER__START | ||
# LUA installation | ||
RUN wget --tries=5 https://www.lua.org/ftp/lua-5.3.5.tar.gz -O - -q | tar -xzf - \ | ||
&& cd lua-5.3.5 \ | ||
&& make linux \ | ||
&& make install \ | ||
&& cd .. && rm -r lua-5.3.5/ | ||
|
||
# | ||
# stylua installation | ||
# | ||
#OTHER__END | ||
|
||
################################ | ||
# Installs python dependencies # | ||
################################ | ||
COPY --from=build-ml-core pyproject.toml README.md ./ | ||
COPY --from=build-ml-core megalinter /megalinter/ | ||
RUN --mount=type=cache,target=/root/.cache/uv,from=build-ml-core \ | ||
--mount=from=uv,source=/uv,target=/bin/uv \ | ||
uv pip install --system -e . | ||
|
||
####################################### | ||
# 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=LUA_STYLUA \ | ||
FLAVOR_SUGGESTIONS=false \ | ||
SINGLE_LINTER=LUA_STYLUA \ | ||
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 |
Oops, something went wrong.