make: Add website + website-test targets

This commit is contained in:
Radek Simko 2018-05-02 12:43:14 +01:00
parent c1bc0be7b2
commit c4ffdb1f57
No known key found for this signature in database
GPG Key ID: 1F1C84FE689A88D7
2 changed files with 52 additions and 2 deletions

View File

@ -1,5 +1,7 @@
dist: trusty
sudo: false
sudo: required
services:
- docker
language: go
go:
- "1.10.1"
@ -35,6 +37,8 @@ script:
- make test
- make e2etest
- GOOS=windows go build
- make website-test
branches:
only:
- master

View File

@ -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
@ -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