[Tests] Integrate dockerfile_lint to test Dockerfile

Peter Dave Hello 2018-07-12 12:14:06 +08:00
parent cdde74a55d
commit 7ff20855a2
3 changed files with 7 additions and 3 deletions

View File

@ -19,12 +19,13 @@ before_install:
- curl --version - curl --version
- wget --version - wget --version
install: install:
- if [ -z "${SHELLCHECK-}" ]; then nvm install node && npm install && npm prune && npm ls urchin doctoc eclint; fi - if [ -z "${SHELLCHECK-}" ]; then nvm install node && npm install && npm prune && npm ls urchin doctoc eclint dockerfile_lint; fi
- '[ -z "$WITHOUT_CURL" ] || sudo apt-get remove curl -y' - '[ -z "$WITHOUT_CURL" ] || sudo apt-get remove curl -y'
script: script:
- if [ -n "${MAKE_RELEASE-}" ]; then export GIT_EDITOR="sed -i '1 s/^/99.99.99 make release test/'" && git fetch --unshallow --tags && echo proceed | make TAG=99.99.99 release ; fi - if [ -n "${MAKE_RELEASE-}" ]; then export GIT_EDITOR="sed -i '1 s/^/99.99.99 make release test/'" && git fetch --unshallow --tags && echo proceed | make TAG=99.99.99 release ; fi
- if [ -n "${DOCTOCCHECK-}" ]; then cp README.md README.md.orig && npm run doctoc && diff -q README.md README.md.orig ; fi - if [ -n "${DOCTOCCHECK-}" ]; then cp README.md README.md.orig && npm run doctoc && diff -q README.md README.md.orig ; fi
- if [ -n "${ECLINT-}" ]; then npm run eclint ; fi - if [ -n "${ECLINT-}" ]; then npm run eclint ; fi
- if [ -n "${DOCKERFILE_LINT-}" ]; then npm run dockerfile_lint ; fi
- if [ -n "${SHELLCHECK-}" ]; then shellcheck -s bash nvm.sh && shellcheck -s sh nvm.sh && shellcheck -s dash nvm.sh && shellcheck -s ksh nvm.sh ; fi - if [ -n "${SHELLCHECK-}" ]; then shellcheck -s bash nvm.sh && shellcheck -s sh nvm.sh && shellcheck -s dash nvm.sh && shellcheck -s ksh nvm.sh ; fi
- if [ -n "${SHELLCHECK-}" ]; then shellcheck -s bash install.sh bash_completion nvm-exec ; fi - if [ -n "${SHELLCHECK-}" ]; then shellcheck -s bash install.sh bash_completion nvm-exec ; fi
- if [ -n "${SHELL-}" ] && [ -n "${TEST_SUITE}" ]; then if [ "${TEST_SUITE}" = 'installation_iojs' ]; then travis_retry make TEST_SUITE=$TEST_SUITE URCHIN="$(npm bin)/urchin" test-$SHELL ; else make TEST_SUITE=$TEST_SUITE URCHIN="$(npm bin)/urchin" test-$SHELL; fi; fi - if [ -n "${SHELL-}" ] && [ -n "${TEST_SUITE}" ]; then if [ "${TEST_SUITE}" = 'installation_iojs' ]; then travis_retry make TEST_SUITE=$TEST_SUITE URCHIN="$(npm bin)/urchin" test-$SHELL ; else make TEST_SUITE=$TEST_SUITE URCHIN="$(npm bin)/urchin" test-$SHELL; fi; fi
@ -42,6 +43,7 @@ env:
- DOCTOCCHECK=true - DOCTOCCHECK=true
- SHELLCHECK=true - SHELLCHECK=true
- ECLINT=true - ECLINT=true
- DOCKERFILE_LINT=true
- SHELL=bash TEST_SUITE=install_script - SHELL=bash TEST_SUITE=install_script
- SHELL=sh TEST_SUITE=fast - SHELL=sh TEST_SUITE=fast
- SHELL=dash TEST_SUITE=fast - SHELL=dash TEST_SUITE=fast

View File

@ -101,7 +101,7 @@ RUN echo '[ -s "$NVM_DIR/bash_completion" ] && . "$NVM_DIR/bash_completion" # Th
# nodejs and tools # nodejs and tools
RUN bash -c 'source $HOME/.nvm/nvm.sh && \ RUN bash -c 'source $HOME/.nvm/nvm.sh && \
nvm install node && \ nvm install node && \
npm install -g doctoc urchin eclint && \ npm install -g doctoc urchin eclint dockerfile_lint && \
npm install --prefix "$HOME/.nvm/"' npm install --prefix "$HOME/.nvm/"'
# Set WORKDIR to nvm directory # Set WORKDIR to nvm directory

View File

@ -15,7 +15,8 @@
"test/installation/iojs": "shell=$(basename -- $(ps -o comm= $(ps -o ppid= -p $PPID)) | sed 's/^-//'); make TEST_SUITE=installation_iojs test-$shell", "test/installation/iojs": "shell=$(basename -- $(ps -o comm= $(ps -o ppid= -p $PPID)) | sed 's/^-//'); make TEST_SUITE=installation_iojs test-$shell",
"test/sourcing": "shell=$(basename -- $(ps -o comm= $(ps -o ppid= -p $PPID)) | sed 's/^-//'); make TEST_SUITE=sourcing test-$shell", "test/sourcing": "shell=$(basename -- $(ps -o comm= $(ps -o ppid= -p $PPID)) | sed 's/^-//'); make TEST_SUITE=sourcing test-$shell",
"doctoc": "doctoc --title='## Table of Contents' --github README.md", "doctoc": "doctoc --title='## Table of Contents' --github README.md",
"eclint": "eclint check $(git ls-tree --name-only HEAD | xargs)" "eclint": "eclint check $(git ls-tree --name-only HEAD | xargs)",
"dockerfile_lint": "dockerfile_lint"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@ -35,6 +36,7 @@
}, },
"homepage": "https://github.com/creationix/nvm", "homepage": "https://github.com/creationix/nvm",
"devDependencies": { "devDependencies": {
"dockerfile_lint": "^0.3.2",
"eclint": "^2.6.0", "eclint": "^2.6.0",
"replace": "^0.3.0", "replace": "^0.3.0",
"semver": "^5.0.1", "semver": "^5.0.1",