.gitlab-ci.yml 3.82 KiB
---
include:
- project: 'ghsc/hazdev/pipeline-build-template'
ref: 'master'
file: 'templates/library.yml'
image: ${DEVOPS_REGISTRY}usgs/centos:latest
stages:
- test
- integration
- deploy
variables:
CI_REGISTRY: ${CODE_REGISTRY}
CI_REGISTRY_IMAGE: ${CODE_REGISTRY_IMAGE}
## --------------------------------------------------
# Templates
## --------------------------------------------------
.adjust_image_names:
before_script:
- IMAGE_NAME=usgs/${APP_NAME}:${CI_COMMIT_REF_SLUG}
- IMAGE_NAME=${IMAGE_NAME/:master/:latest}
- INTERNAL_IMAGE_NAME=${CI_REGISTRY_IMAGE}/${IMAGE_NAME}
- STACK_NAME=${APP_NAME}
.build_docker_image:
cache: {}
extends:
- .adjust_image_names
- .dind
script:
- docker build
--pull
--build-arg FROM_IMAGE=${FROM_IMAGE}
--build-arg GIT_BRANCH_NAME=${CI_COMMIT_REF_NAME}
--build-arg GIT_COMMIT_SHA=${CI_COMMIT_SHA}
--tag local/${IMAGE_NAME} .
- docker tag local/${IMAGE_NAME} ${IMAGE_NAME}
- docker push ${IMAGE_NAME}
- docker image rm ${IMAGE_NAME}
- docker tag local/${IMAGE_NAME} ${INTERNAL_IMAGE_NAME}
- docker push ${INTERNAL_IMAGE_NAME}
- docker image rm ${INTERNAL_IMAGE_NAME}
stage: integration
tags:
- build
variables:
FROM_IMAGE: ${CODE_REGISTRY}/devops/images/usgs/centos:latest
.check_code:
cache: {}
image: ${DEVOPS_REGISTRY}usgs/conda:latest
script:
# Add conda to path
- source /etc/profile.d/conda.sh
# Install Project Dependencies
- conda config --add channels conda-forge
- conda install python=${PYTHON_VERSION} obspy pycurl
- pip install pipenv
- pipenv --site-packages install --dev --pre --skip-lock
# Run Code Checks
- pipenv run black --check .
- pipenv run pytest --cov-report xml:cov.xml --cov=geomagio
artifacts:
paths: