-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
GH-49: Implementation proposal for CI and CD
- Loading branch information
Showing
3 changed files
with
66 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,22 @@ | ||
sudo: required | ||
|
||
services: | ||
- docker | ||
- docker | ||
|
||
script: bats ./tests/test_suite.bats | ||
# | ||
# deploy: | ||
# provider: script | ||
# script: curl -H "Content-Type: application/json" --data '{"build": true}' -X POST https://registry.hub.docker.com/u/dduportal/docker-asciidoctor/trigger/${DOCKER_HUB_TOKEN}/ | ||
env: | ||
global: | ||
- CURRENT_GIT_BRANCH=$TRAVIS_BRANCH | ||
|
||
script: | ||
- make build | ||
- make test | ||
|
||
# Do not deploy if Pull Request | ||
# If a contributor want to deploy on its own DockerHub account: | ||
# 1 - Enable Travis on the forked repository | ||
# 2 - Set the environment variable DOCKERHUB_USERNAME in Travis Settings | ||
deploy: | ||
- provider: script | ||
script: make deploy | ||
on: | ||
condition: $TRAVIS_PULL_REQUEST = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
|
||
DOCKER_IMAGE_NAME ?= docker-asciidoctor | ||
DOCKERHUB_USERNAME ?= asciidoctor | ||
DOCKER_IMAGE_TEST_TAG ?= $(shell git rev-parse --short HEAD) | ||
DOCKER_IMAGE_NAME_TO_TEST ?= $(DOCKERHUB_USERNAME)/$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TEST_TAG) | ||
ASCIIDOCTOR_VERSION ?= 1.5.6.1 | ||
ASCIIDOCTOR_PDF_VERSION ?= 1.5.0.alpha.16 | ||
CURRENT_GIT_BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD) | ||
|
||
export DOCKER_IMAGE_NAME_TO_TEST ASCIIDOCTOR_VERSION ASCIIDOCTOR_PDF_VERSION | ||
|
||
all: build test deploy | ||
|
||
build: | ||
docker build \ | ||
-t $(DOCKER_IMAGE_NAME_TO_TEST) \ | ||
-f Dockerfile \ | ||
$(CURDIR)/ | ||
|
||
test: | ||
bats $(CURDIR)/tests/*.bats | ||
|
||
deploy: | ||
curl -H "Content-Type: application/json" \ | ||
--data '{"source_type": "Branch", "source_name": "$(CURRENT_GIT_BRANCH)"}' \ | ||
-X POST https://registry.hub.docker.com/u/$(DOCKERHUB_USERNAME)/$(DOCKER_IMAGE_NAME)/trigger/$(DOCKER_HUB_TOKEN)/ | ||
|
||
.PHONY: all build test deploy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters