From 7dfe711853781e08f6c7c856bdf490094ff6afd7 Mon Sep 17 00:00:00 2001 From: lb584 <lb584@cam.ac.uk> Date: Thu, 27 Oct 2022 12:23:57 +0100 Subject: [PATCH] adding CI support for git --- .gitlab-ci.yml | 36 ++++++++++++++++++++++++++ tests/unit/coordinator/__init__.py | 0 tests/unit/coordinator/example_test.py | 16 ++++++++++++ 3 files changed, 52 insertions(+) create mode 100644 .gitlab-ci.yml create mode 100644 tests/unit/coordinator/__init__.py create mode 100644 tests/unit/coordinator/example_test.py diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..f535d1c --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,36 @@ +# This file is a template, and might need editing before it works on your project. +# Official language image. Look for the different tagged releases at: +# https://hub.docker.com/r/library/python/tags/ +image: lb584/ews_coordinator:latest + +# Change pip's cache directory to be inside the project directory since we can +# only cache local items. +variables: + PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip" + PACKAGES_DIR: "$CI_PROJECT_DIR/packages/" + +# Pip's cache doesn't store the python packages +# https://pip.pypa.io/en/stable/reference/pip_install/#caching +# +# If you want to also cache the installed packages, you have to install +# them in a virtualenv and cache it as well. +cache: + paths: + - .cache/pip + - venv/ + +before_script: + - python3 -V # Print out python version for debugging +# - apt-get install --assume-yes git + - echo $PACKAGES_DIR + - mkdir $PACKAGES_DIR + - git clone "https://nouser:$ENV_SUIT_V2_ACCESS@gitlab.developers.cam.ac.uk/gilligan-epid/wheat-rusts/ews_environmental_suitability_v2.git" $PACKAGES_DIR/met_extractor_v2 + - ls $PACKAGES_DIR + - source /storage/app/miniconda3/bin/activate /storage/app/EWS_prod/envs/conda/py3EWS/ + - pwd + - export PYTHONPATH="$PYTHONPATH:./met_data_extraction:./tests:$PACKAGES_DIR/met_extractor_v2/environmental_suitability" + +test: + script: + - echo $PYTHONPATH + - python3 -m unittest tests/unit/coordinator/example_test.py diff --git a/tests/unit/coordinator/__init__.py b/tests/unit/coordinator/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/unit/coordinator/example_test.py b/tests/unit/coordinator/example_test.py new file mode 100644 index 0000000..b5bc92e --- /dev/null +++ b/tests/unit/coordinator/example_test.py @@ -0,0 +1,16 @@ +import unittest + + +class ExampleTest(unittest.TestCase): + + def setUp(self) -> None: + super().setUp() + + + def test_v1_dewperiod_expected_results1(self): + self.assertTrue(True) + + +if __name__ == '__main__': + print("hello") + unittest.main() -- GitLab