Skip to content

Commit

Permalink
only deploy once per build
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronhurt committed Jan 28, 2020
1 parent b317248 commit 7f73ded
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 26 deletions.
28 changes: 15 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,21 @@ sudo: false
language: go

go:
- "1.13"
- 1.13
- master

script:
- make travis
script: make travis

deploy:
provider: pages
skip_cleanup: true
github_token: $GITHUB_TOKEN
keep_history: true
local_dir: docs/public
target_branch: gh-pages
fqdn: fabiolb.net
on:
branch: master
jobs:
include:
- stage: deploy pages
script: make travis-pages
deploy:
provider: pages
skip_cleanup: true
github_token: $GITHUB_TOKEN
local_dir: docs/public
target_branch: gh-pages
fqdn: fabiolb.net
on:
branch: master
27 changes: 14 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ GORELEASER ?= $(shell which goreleaser)

# pin versions for CI builds
CI_CONSUL_VERSION ?= 1.6.2
CI_VAULT_VERSION ?= 1.3.1
CI_HUGO_VERSION ?= 0.62.2
CI_VAULT_VERSION ?= 1.3.2
CI_HUGO_VERSION ?= 0.63.2

# all is the default target
all: test
Expand All @@ -42,10 +42,11 @@ help:
build: gofmt
go build $(GOFLAGS)

# test runs the tests
# test builds and runs the tests
test: build
go test $(GOFLAGS) -v -test.timeout 15s ./...

# mod performs go module maintenance
mod:
go mod tidy
go mod vendor
Expand Down Expand Up @@ -109,27 +110,27 @@ docker-test:
-f Dockerfile \
.

# travis runs the CI on travis
# travis runs tests on Travis CI
travis:
go version
go env
wget -O ~/consul.zip https://releases.hashicorp.com/consul/$(CI_CONSUL_VERSION)/consul_$(CI_CONSUL_VERSION)_linux_amd64.zip
wget -O ~/vault.zip https://releases.hashicorp.com/vault/$(CI_VAULT_VERSION)/vault_$(CI_VAULT_VERSION)_linux_amd64.zip
wget -O ~/hugo.tgz https://github.com/gohugoio/hugo/releases/download/v$(CI_HUGO_VERSION)/hugo_$(CI_HUGO_VERSION)_Linux-64bit.tar.gz
wget -q -O ~/consul.zip https://releases.hashicorp.com/consul/$(CI_CONSUL_VERSION)/consul_$(CI_CONSUL_VERSION)_linux_amd64.zip
wget -q -O ~/vault.zip https://releases.hashicorp.com/vault/$(CI_VAULT_VERSION)/vault_$(CI_VAULT_VERSION)_linux_amd64.zip
unzip -o -d ~/bin ~/consul.zip
unzip -o -d ~/bin ~/vault.zip
tar -C ~/bin -zxf ~/hugo.tgz hugo
vault --version
consul --version
hugo version
make test
(cd docs && hugo --verbose)

# travis-pages runs the GitHub pages (https://fabiolb.net/) deploy on Travis CI
travis-pages:
wget -q -O ~/hugo.tgz https://github.com/gohugoio/hugo/releases/download/v$(CI_HUGO_VERSION)/hugo_$(CI_HUGO_VERSION)_Linux-64bit.tar.gz
tar -C ~/bin -zxf ~/hugo.tgz hugo
hugo version
(cd docs && hugo --verbose)

# clean removes intermediate files
clean:
go clean
rm -rf pkg dist fabio
find . -name '*.test' -delete

.PHONY: all build clean travis gofmt gorelease help homebrew install linux pkg preflight release tag test
.PHONY: all help build test mod gofmt linux install pkg release preflight tag gorelease homebrew docker-test travis travis-pages clean

0 comments on commit 7f73ded

Please sign in to comment.