Skip to content

Commit

Permalink
ci: add hadolint linter
Browse files Browse the repository at this point in the history
  • Loading branch information
audrium committed Nov 18, 2020
1 parent f577feb commit 3c94e25
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 7 deletions.
21 changes: 15 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on: [push, pull_request]

jobs:
lint-shellcheck:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -21,7 +21,7 @@ jobs:
./run-tests.sh --check-shellscript
docs-sphinx:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -43,7 +43,7 @@ jobs:
run: ./run-tests.sh --check-sphinx

format-prettier:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -60,7 +60,7 @@ jobs:
run: ./run-tests.sh --check-prettier

js-tests:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -76,11 +76,20 @@ jobs:
- name: Run javascript tests
run: ./run-tests.sh --check-js-tests

lint-dockerfile:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Check Dockerfile compliance
run: ./run-tests.sh --check-dockerfile

docker-build:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Build docker image
- name: Build Docker image
run: ./run-tests.sh --check-docker-build
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
FROM node:12 as react-build
WORKDIR /code
COPY . /code
# hadolint ignore=DL3003
RUN cd reana-ui && \
yarn && \
yarn build

FROM nginx
FROM nginx:1.19
COPY --from=react-build /code/reana-ui/build /usr/share/nginx/html
COPY nginx/reana-ui.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
Expand Down
6 changes: 6 additions & 0 deletions run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ check_js_tests () {
cd reana-ui && yarn && yarn test --ci --passWithNoTests && cd ..
}

check_dockerfile () {
docker run -i --rm hadolint/hadolint < Dockerfile
}

check_docker_build () {
docker build -t reanahub/reana-ui .
}
Expand All @@ -37,6 +41,7 @@ check_all () {
check_sphinx
check_prettier
check_js_tests
check_dockerfile
check_docker_build
}

Expand All @@ -52,6 +57,7 @@ do
--check-sphinx) check_sphinx;;
--check-prettier) check_prettier;;
--check-js-tests) check_js_tests;;
--check-dockerfile) check_dockerfile;;
--check-docker-build) check_docker_build;;
*)
esac
Expand Down

0 comments on commit 3c94e25

Please sign in to comment.