Skip to content

Commit

Permalink
Merge pull request runatlantis#441 from runatlantis/website-testing
Browse files Browse the repository at this point in the history
Test website for broken links during build.
  • Loading branch information
lkysow authored Jan 23, 2019
2 parents c0b89d9 + 8cb27ab commit 5341e7d
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
24 changes: 23 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,28 @@ jobs:
# We don't run e2e tests on fork PRs because they don't have access to the secret env vars.
- run: if [ -z "${CIRCLE_PR_REPONAME}" ]; then ./scripts/e2e.sh; fi

# Check that there's no missing links for the website.
# This job builds the website, starts a server to serve it, and then uses
# muffet (https://github.com/raviqqe/muffet) to perform the link check.
website_link_check:
docker:
# This image's Dockerfile is at runatlantis.io/Dockerfile
- image: runatlantis/ci-link-checker:0.1
steps:
- checkout
- run: yarn install
- run: yarn website:build
- run:
name: http-server
command: http-server runatlantis.io/.vuepress/dist
background: true
# We use dockerize -wait here to wait until the server is up.
- run: |
dockerize -wait tcp://localhost:8080 -- \
muffet -e 'https://github\\.com/runatlantis/atlantis/edit/master/.*' \
-e 'https://github.com/helm/charts/tree/master/stable/atlantis#customization' \
http://localhost:8080/
# Build and push 'latest' Docker tag.
docker_master:
working_directory: /go/src/github.com/runatlantis/atlantis
Expand All @@ -46,7 +68,6 @@ jobs:
docker login -u "$DOCKER_USER" -p "$DOCKER_PASSWORD"
docker push runatlantis/atlantis:latest
fi
# Build and push Docker tag.
docker_tag:
working_directory: /go/src/github.com/runatlantis/atlantis
Expand Down Expand Up @@ -82,6 +103,7 @@ workflows:
filters:
branches:
only: master
- website_link_check
tag:
jobs:
- docker_tag:
Expand Down
16 changes: 16 additions & 0 deletions .circleci/website_link_checker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# This Dockerfile builds runatlantis/ci-link-checker.
# It is used in CircleCI to check if the website has any broken links.
FROM node:11
ENV DOCKERIZE_VERSION v0.6.0

# Muffet is used to check for broken links.
COPY --from=raviqqe/muffet:1.0.3 muffet /usr/local/bin/muffet

# http-server is used to serve the website locally as muffet checks it.
RUN yarn global add http-server

# Dockerize is used to wait until the server is up and running before running
# muffet.
RUN wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
&& tar -C /usr/local/bin -xzvf dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
&& rm dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz

0 comments on commit 5341e7d

Please sign in to comment.