diff --git a/.gitignore b/.gitignore index ffcd96a54b7ad85860aa7c9701413c927cbe6e95..a8cadd0b80f9e0d36ca345bfa239763035ff08b1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .coverage +cov.xml .DS_Store node_modules *.pyc diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..87aebece83817b8a02076730bfe6ade823851c0f --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,68 @@ +image: ${DEVOPS_REGISTRY}usgs/centos:latest + +stages: + - test + - integration + - deploy + +variables: + CI_REGISTRY: ${CODE_REGISTRY} + CI_REGISTRY_IMAGE: ${CODE_REGISTRY_IMAGE} + +## -------------------------------------------------- +# Templates +## -------------------------------------------------- + +.check_code: + cache: {} + image: usgs/centos:latest + script: + - yum install -y wget which + - wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh + - bash miniconda.sh -b -p $HOME/miniconda + - export PATH="$HOME/miniconda/bin:$PATH" + - conda config --set always_yes yes --set changeps1 no + - conda update --yes conda + - conda info -a + # Install Project Dependencies + - conda config --add channels conda-forge + - conda install python=${PYTHON_VERSION} obspy pycurl + - pip install pipenv + - export LC_ALL=C.UTF-8 + - export LANG=C.UTF-8 + - pipenv --site-packages install --dev --pre --skip-lock + # Run Code Checks + - pipenv run black --check . + - pipenv run pytest --cov-report xml:cov.xml --cov=test/ + artifacts: + paths: + - cov.xml + reports: + junit: cov.xml + stage: test + tags: + - development + variables: + PYTHON_VERSION: 3.8 + +## -------------------------------------------------- +# Test Stage +## -------------------------------------------------- + +Check Python 3.6: + extends: + - .check_code + variables: + PYTHON_VERSION: '3.6' + +Check Python 3.7: + extends: + - .check_code + variables: + PYTHON_VERSION: '3.7' + +Check Python 3.8: + extends: + - .check_code + variables: + PYTHON_VERSION: '3.8' diff --git a/Dockerfile b/Dockerfile index 215b2e55ddc73f37486f795fa145803debabda66..c236da2cd14ad6ff8b07d825adbf301fa58130a3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -ARG FROM_IMAGE=usgs/centos:8 +ARG FROM_IMAGE=usgs/centos:latest FROM ${FROM_IMAGE} LABEL maintainer="Jeremy Fee <jmfee@usgs.gov>" diff --git a/Pipfile b/Pipfile index b0aa5ae3de134408090b63ad77df4bb2b180f967..6576f15b5b09a5fbe724a1c3a61cba7544d8a224 100644 --- a/Pipfile +++ b/Pipfile @@ -21,7 +21,7 @@ databases = {extras = ["postgresql", "sqlite"],version = "*"} fastapi = "*" httpx = "==0.11.1" openpyxl = "*" -pydantic = "==1.4" +pydantic = "*" sqlalchemy = "*" sqlalchemy-utc = "*" typing = "*"