Skip to content

Commit

Permalink
Merge pull request #17982 from hashicorp/f-make-website
Browse files Browse the repository at this point in the history
make: Add website + website-test targets
  • Loading branch information
radeksimko authored May 3, 2018
2 parents 1588fd2 + c4ffdb1 commit 0cc9e05
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 2 deletions.
6 changes: 5 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
dist: trusty
sudo: false
sudo: required
services:
- docker
language: go
go:
- "1.10.1"
Expand Down Expand Up @@ -35,6 +37,8 @@ script:
- make test
- make e2etest
- GOOS=windows go build
- make website-test

branches:
only:
- master
Expand Down
48 changes: 47 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
VERSION?="0.3.32"
TEST?=./...
GOFMT_FILES?=$$(find . -name '*.go' | grep -v vendor)
WEBSITE_REPO=github.com/hashicorp/terraform-website

default: test

Expand Down Expand Up @@ -85,9 +87,53 @@ fmtcheck:
vendor-status:
@govendor status

website:
ifeq (,$(wildcard $(GOPATH)/src/$(WEBSITE_REPO)))
echo "$(WEBSITE_REPO) not found in your GOPATH (necessary for layouts and assets), get-ting..."
git clone https://$(WEBSITE_REPO) $(GOPATH)/src/$(WEBSITE_REPO)
endif
$(eval WEBSITE_PATH := $(GOPATH)/src/$(WEBSITE_REPO))
@echo "==> Starting core website in Docker..."
@docker run \
--interactive \
--rm \
--tty \
--publish "4567:4567" \
--publish "35729:35729" \
--volume "$(shell pwd)/website:/website" \
--volume "$(shell pwd):/ext/terraform" \
--volume "$(WEBSITE_PATH)/content:/terraform-website" \
--volume "$(WEBSITE_PATH)/content/source/assets:/website/docs/assets" \
--volume "$(WEBSITE_PATH)/content/source/layouts:/website/docs/layouts" \
--workdir /terraform-website \
hashicorp/middleman-hashicorp:${VERSION}

website-test:
ifeq (,$(wildcard $(GOPATH)/src/$(WEBSITE_REPO)))
echo "$(WEBSITE_REPO) not found in your GOPATH (necessary for layouts and assets), get-ting..."
git clone https://$(WEBSITE_REPO) $(GOPATH)/src/$(WEBSITE_REPO)
endif
$(eval WEBSITE_PATH := $(GOPATH)/src/$(WEBSITE_REPO))
@echo "==> Testing core website in Docker..."
-@docker stop "tf-website-core-temp"
@docker run \
--detach \
--rm \
--name "tf-website-core-temp" \
--publish "4567:4567" \
--volume "$(shell pwd)/website:/website" \
--volume "$(shell pwd):/ext/terraform" \
--volume "$(WEBSITE_PATH)/content:/terraform-website" \
--volume "$(WEBSITE_PATH)/content/source/assets:/website/docs/assets" \
--volume "$(WEBSITE_PATH)/content/source/layouts:/website/docs/layouts" \
--workdir /terraform-website \
hashicorp/middleman-hashicorp:${VERSION}
$(WEBSITE_PATH)/content/scripts/check-links.sh "http://127.0.0.1:4567" "/" "/docs/providers/*"
@docker stop "tf-website-core-temp"

# disallow any parallelism (-j) for Make. This is necessary since some
# commands during the build process create temporary files that collide
# under parallel conditions.
.NOTPARALLEL:

.PHONY: bin cover default dev e2etest fmt fmtcheck generate plugin-dev quickdev test-compile test testacc testrace tools vendor-status
.PHONY: bin cover default dev e2etest fmt fmtcheck generate plugin-dev quickdev test-compile test testacc testrace tools vendor-status website website-test

0 comments on commit 0cc9e05

Please sign in to comment.