Commit 7bdcfe2a authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

Added CI job definitions and context.


Signed-off-by: Daniel Scheffler's avatarDaniel Scheffler <danschef@gfz-potsdam.de>
parent f6dbf2e4
Pipeline #5481 canceled with stage
......@@ -202,3 +202,6 @@ fabric.properties
# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
# VCS
.idea/vcs.xml
before_script:
- git lfs pull
stages:
- test
- deploy
test_sensormapgeo:
stage: test
script:
- source /root/miniconda3/bin/activate ci_env
- export GDAL_DATA=/root/miniconda3/envs/ci_env/share/gdal
- export PYTHONPATH=$PYTHONPATH:/root # /root <- directory needed later
# run nosetests
- make nosetests
# create the docs
- pip install sphinx_rtd_theme # Read-the-docs theme for SPHINX documentation
- pip install sphinx-autodoc-typehints
- make docs
artifacts:
paths:
- htmlcov/
- docs/_build/html/
- nosetests.html
- nosetests.xml
when: always
test_styles:
stage: test
script:
- source /root/miniconda3/bin/activate ci_env
- export GDAL_DATA=/root/miniconda3/envs/ci_env/share/gdal
- export PYTHONPATH=$PYTHONPATH:/root # /root <- directory needed later
- make lint
artifacts:
paths:
- tests/linting/flake8.log
- tests/linting/pycodestyle.log
- tests/linting/pydocstyle.log
when: always
test_sensormapgeo_install:
stage: test
script:
- source /root/miniconda3/bin/activate
- conda create -y -q --name sensormapgeo_testinstall python=3
- source activate sensormapgeo_testinstall
# resolve some requirements with conda
- conda install --yes -q -c conda-forge numpy gdal pyresample pyqt scikit-image rasterio pyproj lxml geopandas ipython
# run installer
- python setup.py install
# test if its importable
- cd ..
- pwd
- ls
- python -c "import sensormapgeo; print(sensormapgeo)"
- python -c "from sensormapgeo import SensorMapGeometryTransformer, SensorMapGeometryTransformer3D"
only:
- master
- feature/add_CI
pages: # this job must be called 'pages' to advise GitLab to upload content to GitLab Pages
stage: deploy
dependencies:
- test_sensormapgeo
script:
# Create the public directory
- rm -rf public
- mkdir public
- mkdir -p public/doc
- mkdir -p public/coverage
- mkdir -p public/nosetests_reports
# Copy over the docs
- cp -r docs/_build/html/* public/doc/
# Copy over the coverage reports
- cp -r htmlcov/* public/coverage/
# Copy over the nosetests reports
- cp nosetests.* public/nosetests_reports/
# Check if everything is working great
- ls -al public
- ls -al public/doc
- ls -al public/coverage
- ls -al public/nosetests_reports
artifacts:
paths:
- public
expire_in: 30 days
only:
- master
deploy_pypi:
stage: deploy
dependencies:
- test_sensormapgeo
script:
- source /root/miniconda3/bin/activate
- source activate ci_env
- pip install -U twine
- python setup.py sdist
- twine upload dist/* # requires creds as environment variables
only:
- /^v\d+\.\d+\.\d+([abc]\d*)?$/ # PEP-440 compliant version (tags)
except:
- dev
......@@ -22,6 +22,6 @@
# You should have received a copy of the GNU Lesser General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
__version__ = '0.0.1'
__version__ = '0.1.0'
__versionalias__ = '20200106.01'
__author__ = 'Daniel Scheffler'
......@@ -37,7 +37,7 @@ version = {}
with open("sensormapgeo/version.py") as version_file:
exec(version_file.read(), version)
requirements = ['numpy', 'gdal', 'pyresample', 'py_tools_ds']
requirements = ['numpy', 'gdal', 'pyresample>=1.11.0', 'py_tools_ds']
setup_requirements = []
......@@ -69,7 +69,7 @@ setup(
setup_requires=setup_requirements,
test_suite='tests',
tests_require=test_requirements,
url='https://github.com/danschef/sensormapgeo',
url='https://gitext.gfz-potsdam.de/EnMAP/sensormapgeo',
version=version['__version__'],
zip_safe=False,
)
#!/usr/bin/env bash
context_dir="./context"
dockerfile="sensormapgeo_ci.docker"
tag="sensormapgeo_ci:0.1.0"
gitlab_runner="sensormapgeo_gitlab_CI_runner"
echo "#### Build runner docker image"
sudo docker rmi ${tag}
sudo docker build -f ${context_dir}/${dockerfile} -m 20G -t ${tag} ${context_dir}
echo "#### Create gitlab-runner (daemon) container with tag; ${tag}"
sudo docker stop ${gitlab_runner}
sudo docker rm ${gitlab_runner}
sudo docker run -d --name ${gitlab_runner} --restart always \
-v /var/run/docker.sock:/var/run/docker.sock gitlab/gitlab-runner:latest
echo "#### Register container at gitlab, get token here https://gitext.gfz-potsdam.de/EnMAP/sensormapgeo/settings/ci_cd"
read -p "Please enter gitlab token: " token
echo ""
read -p "Please enter gitlab runner name: " runner_name
echo "New gitlab runner image will named ${gitlab_runner}"
sudo docker exec -it ${gitlab_runner} /bin/bash -c "export RUNNER_EXECUTOR=docker && gitlab-ci-multi-runner register -n \
--url 'https://gitext.gfz-potsdam.de/ci' \
--registration-token '${token}' \
--run-untagged=true \
--locked=true \
--tag-list sensormapgeo_ci_client \
--description '${runner_name}' \
--docker-image '${tag}' "
ls
name: sensormapgeo
channels: &id1
- http://conda.anaconda.org/conda-forge
dependencies:
- python=3.*.*
- numpy
- gdal
- pyresample>=1.11.0
# py_tools_ds
- pyqt
- scikit-image
- rasterio
- pyproj
- lxml
- geopandas
- ipython
- pip:
- py_tools_ds
- sphinx-argparse
- flake8
- pycodestyle
- pylint
- pydocstyle
- nose
- nose2
- nose-htmloutput
- coverage
- rednose
FROM gms_base_centos:0.3
# copy some needed stuff to /root
COPY *.yml /root/
# update the ci_env environment (that already contains all packages installed via 'docker_pyenvs' repo)
RUN /bin/bash -i -c "\
source /root/miniconda3/bin/activate ; \
source activate ci_env; \
conda env update -n ci_env -f /root/environment_sensormapgeo.yml"
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment