Skip to content

Commit

Permalink
Merge branch 'ci' into 'master'
Browse files Browse the repository at this point in the history
Add api server and dev publish images

Closes #557

See merge request ghsc/esi/shakecast/shakecast-lite!557
  • Loading branch information
dslosky-usgs committed Dec 17, 2020
2 parents 164af46 + a690142 commit 0f7cdbf
Showing 1 changed file with 62 additions and 16 deletions.
78 changes: 62 additions & 16 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,40 +8,86 @@ include:
variables:
IMAGE_NAME: "$CI_PROJECT_NAME:${CI_PIPELINE_ID}"
SERVER_REGISTRY_IMAGE_NAME: "shakecast/server"
API_REGISTRY_IMAGE_NAME: "shakecast/api-server"
DOCKER_DRIVER: overlay2


services:
- docker:19.03.13-dind

before_script:
- docker info

stages:
- build
- test
- release
- deploy

build-test-images:
stage: build
.python-test:
tags:
- shakecast-dev
only:
- merge_requests
before_script:
- cd ${CI_PROJECT_DIR}
- chmod +x test_env.sh
- ./test_env.sh

.shakecast-dev:
tags:
- shakecast-dev

.release:
before_script:
- echo ${CI_COMMIT_REF_NAME} > shakecast/version


# BUILD STEPS
build-test-images:
stage: build
extends:
- .shakecast-dev
- .dind
only:
- merge_requests
script:
- docker build -f sc-server.dockerfile . -t shakecast-server:test
- docker build -f web-server.dockerfile . -t shakecast-web-server:test


# TESTING THE PYTHON APP
app-test:
stage: test
image: shakecast/centos
extends:
- .shakecast-dev
- .python-test
script:
- python -m shakecast.tests.bundle

api-test:
stage: test
image: shakecast/centos
extends:
- .shakecast-dev
- .python-test
script:
- python -m shakecast.api &
- sleep 5
- curl localhost:5000

# RELEASE CONTAINERS
release-dev:
stage: release
extends:
- .dind
- .release
tags:
- shakecast-dev
- build
only:
- merge_requests
before_script:
- cd ${CI_PROJECT_DIR}
- chmod +x test_env.sh
- ./test_env.sh
- master
except:
- schedules
script:
- coverage run -m shakecast.tests.bundle
- docker build -f sc-server.dockerfile . -t $CODE_REGISTRY_IMAGE/$SERVER_REGISTRY_IMAGE_NAME:dev
- docker build -f web-server.dockerfile . -t $CODE_REGISTRY_IMAGE/$API_REGISTRY_IMAGE_NAME:dev
- docker push $CODE_REGISTRY_IMAGE/$SERVER_REGISTRY_IMAGE_NAME:dev
- docker push $CODE_REGISTRY_IMAGE/$API_REGISTRY_IMAGE_NAME:dev
after_script:
- docker rmi $CODE_REGISTRY_IMAGE/$SERVER_REGISTRY_IMAGE_NAME:dev
- docker rmi $CODE_REGISTRY_IMAGE/$API_REGISTRY_IMAGE_NAME:dev

0 comments on commit 0f7cdbf

Please sign in to comment.