-
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from peter-evans/circleci
Add CircleCI build
- Loading branch information
Showing
23 changed files
with
116 additions
and
9 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 |
---|---|---|
@@ -0,0 +1,107 @@ | ||
version: 2.1 | ||
executors: | ||
docker-executor: | ||
environment: | ||
IMAGE_NAME: peterevans/nominatim-k8s | ||
NOMINATIM_PBF_URL: http://download.geofabrik.de/asia/maldives-latest.osm.pbf | ||
docker: | ||
- image: circleci/buildpack-deps:stretch | ||
jobs: | ||
build: | ||
executor: docker-executor | ||
environment: | ||
IMAGE_TAG: latest | ||
DOCKERFILE_PATH: . | ||
steps: | ||
- checkout | ||
- setup_remote_docker: | ||
docker_layer_caching: true | ||
- run: | ||
name: Build Docker image | ||
command: | | ||
docker build -t $IMAGE_NAME:$IMAGE_TAG $DOCKERFILE_PATH | ||
- run: | ||
name: Cache Docker image | ||
command: docker save -o $IMAGE_TAG.tar $IMAGE_NAME | ||
- persist_to_workspace: | ||
root: . | ||
paths: | ||
- ./*.tar | ||
test: | ||
executor: docker-executor | ||
steps: | ||
- checkout | ||
- attach_workspace: | ||
at: /tmp/workspace | ||
- setup_remote_docker | ||
- run: | ||
name: Load cached Docker image | ||
command: | | ||
docker load -i /tmp/workspace/latest.tar | ||
- run: | ||
name: Test Docker image | ||
command: | | ||
docker run -d -e NOMINATIM_PBF_URL=$NOMINATIM_PBF_URL --name nominatim-k8s $IMAGE_NAME:latest | ||
# Dummy container to store tests | ||
docker create -v /etc/newman --name tests alpine:3.4 /bin/true | ||
docker cp tests/. tests:/etc/newman | ||
# Run tests | ||
docker run --network container:nominatim-k8s jwilder/dockerize -wait http://localhost:8080/search -timeout 300s -wait-retry-interval 5s | ||
docker run --network container:nominatim-k8s --volumes-from tests -t postman/newman:4.4.0-alpine run nominatim.postman_collection.json | ||
publish-tag: | ||
executor: docker-executor | ||
steps: | ||
- attach_workspace: | ||
at: /tmp/workspace | ||
- setup_remote_docker | ||
- run: | ||
name: Load cached Docker image | ||
command: | | ||
docker load -i /tmp/workspace/latest.tar | ||
- run: | ||
name: Publish Docker Image to Docker Hub | ||
command: | | ||
echo "$DOCKERHUB_PASSWORD" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin | ||
IMAGE_TAG=${CIRCLE_TAG/v/''} | ||
docker tag $IMAGE_NAME:latest $IMAGE_NAME:$IMAGE_TAG | ||
docker push $IMAGE_NAME:latest | ||
docker push $IMAGE_NAME:$IMAGE_TAG | ||
# If the minor version can be extracted then tag and push | ||
MINOR_VERSION=$(echo $CIRCLE_TAG | sed -n "s/^v\([0-9]*.[0-9]*\).[0-9]*$/\1/p") | ||
if [[ ${#MINOR_VERSION} -gt 0 ]]; then | ||
docker tag $IMAGE_NAME:latest $IMAGE_NAME:$MINOR_VERSION | ||
docker push $IMAGE_NAME:$MINOR_VERSION | ||
fi | ||
workflows: | ||
version: 2 | ||
build: | ||
jobs: | ||
- build | ||
- test: | ||
requires: | ||
- build | ||
build-and-publish-tags: | ||
jobs: | ||
- build: | ||
filters: | ||
tags: | ||
only: /^v.*/ | ||
branches: | ||
ignore: /.*/ | ||
- test: | ||
requires: | ||
- build | ||
filters: | ||
tags: | ||
only: /^v.*/ | ||
branches: | ||
ignore: /.*/ | ||
- publish-tag: | ||
context: org-global | ||
requires: | ||
- test | ||
filters: | ||
tags: | ||
only: /^v.*/ | ||
branches: | ||
ignore: /.*/ |
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
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,4 +1,4 @@ | ||
FROM peterevans/trusty-gcloud:1.2.19 as builder | ||
FROM peterevans/trusty-gcloud:1.2.22 as builder | ||
|
||
MAINTAINER Peter Evans <[email protected]> | ||
|
||
|
@@ -42,7 +42,7 @@ RUN cd /srv \ | |
&& make | ||
|
||
|
||
FROM peterevans/trusty-gcloud:1.2.19 | ||
FROM peterevans/trusty-gcloud:1.2.22 | ||
|
||
# Let the container know that there is no TTY | ||
ARG DEBIAN_FRONTEND=noninteractive | ||
|
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.