Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

only deploy once per build #747

Merged
merged 1 commit into from
Jan 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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