Skip to content

Commit

Permalink
Merge dfacda1 into d18358e
Browse files Browse the repository at this point in the history
  • Loading branch information
gerson-scanapieco committed Oct 4, 2019
2 parents d18358e + dfacda1 commit a800437
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 16 deletions.
43 changes: 28 additions & 15 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,29 @@
language: go
go:
- '1.13'
services:
- docker
cache:
directories:
- "$GOPATH/pkg"
before_install:
- go get github.com/mattn/goveralls
install:
- make ci/install
script:
- make ci/test
after_success:
- goveralls -coverprofile=coverage.out -service=travis-ci

go: '1.13'

jobs:
include:
- stage: "Tests"
cache:
directories:
- "$GOPATH/pkg"
services:
- docker
before_install:
- go get github.com/mattn/goveralls
install:
- make ci/install
after_success:
- goveralls -coverprofile=coverage.out -service=travis-ci
name: "Unit tests"
script:
- make ci/test/unit
- script:
- make ci/test/integration
name: "Integration tests"
- stage: deploy
if: branch = master AND type = push
services: docker
script:
- push_to_docker.sh
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,13 @@ test/integration:
@make gather-integration-profiles

.PHONY: ci/test
ci/test:
ci/test/unit:
@echo "Unit Tests - START"
@go test ${testable_packages} -tags=unit -covermode=count -coverprofile=coverage.out -v -p 1
@echo "Unit Tests - DONE"

.PHONY: ci/test/integration
ci/test/integration:
@echo "Integration Tests - START"
@go test ${testable_packages} -tags=integration -covermode=count -coverprofile=coverage.out -v -p 1
@echo "Integration Tests - DONE"
Expand Down
17 changes: 17 additions & 0 deletions push_to_docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

# The image build step occurs only when a build is triggered by a commit being merged into the "master" branch.
# Given that the "master" branch is protected, the only way to trigger a build from the "master" branch is when a PR
# is merged into it. This way, we avoid storing images from non-stable branches.
VERSION=$(cat ./version/version.go | grep "var VERSION" | awk ' { print $4 } ' | sed s/\"//g)

docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"

docker build -t will-iam .
docker tag will-iam:latest tfgco/will-iam:$VERSION.$TRAVIS_BUILD_NUMBER
docker tag will-iam:latest tfgco/will-iam:$VERSION
docker tag will-iam:latest tfgco/will-iam:latest
docker push tfgco/will-iam:$VERSION.$TRAVIS_BUILD_NUMBER
docker push tfgco/will-iam:$VERSION
docker push tfgco/will-iam:latest

3 changes: 3 additions & 0 deletions version/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package version

var VERSION = "8.6.0"

0 comments on commit a800437

Please sign in to comment.