From 6444a75f5c8ac6a20258b535a378e96524fefd0b Mon Sep 17 00:00:00 2001
From: lukas leufen <l.leufen@fz-juelich.de>
Date: Tue, 21 Apr 2020 14:57:37 +0200
Subject: [PATCH] add docs first setup

---
 .gitlab-ci.yml             | 29 +++++++++++++++++++++++++++++
 conftest.py                |  1 -
 docs/requirements_docs.txt |  4 ++++
 run.py                     |  3 ---
 run_hourly.py              |  4 ----
 run_zam347.py              |  5 -----
 6 files changed, 33 insertions(+), 13 deletions(-)
 create mode 100644 docs/requirements_docs.txt

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index f3ec1ab9..705fa0e9 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,6 +1,7 @@
 stages:
   - init
   - test
+  - docs
   - pages
 
 ### Static Badges ###
@@ -131,6 +132,31 @@ coverage:
       - badges/
       - coverage/
 
+#### Documentation ####
+sphinx docs:
+  stage: docs
+  tags:
+    - machinelearningtools
+    - zam347
+  before_script:
+    - chmod +x ./CI/update_badge.sh
+    - ./CI/update_badge.sh > /dev/null
+  script:
+    - pip install -r requirements.txt
+    - pip install -r docs/requirements_docs.txt
+    - chmod +x ./CI/create_documentation.sh
+    - ./CI/create_documentation.sh
+  after_script:
+    - ./CI/update_badge.sh > /dev/null
+  when: always
+  artifacts:
+    name: pages
+    when: always
+    paths:
+      - badges/
+      - webpage/
+
+
 #### Pages ####
 pages:
   stage: pages
@@ -147,6 +173,9 @@ pages:
     - mkdir -p public/test
     - cp -af test_results/. public/test
     - ls public/test
+    - mkdir -p public/test
+    - cp -af test_results/. public/test
+    - ls public/test
     - ls public
   when: always
   artifacts:
diff --git a/conftest.py b/conftest.py
index 92d2159c..c59ec4dc 100644
--- a/conftest.py
+++ b/conftest.py
@@ -22,4 +22,3 @@ def pytest_runtest_teardown(item, nextitem):
                 shutil.rmtree(os.path.join(path, "TestExperiment"), ignore_errors=True)
     else:
         pass  # nothing to do if next test is from same test class
-
diff --git a/docs/requirements_docs.txt b/docs/requirements_docs.txt
new file mode 100644
index 00000000..0fb01800
--- /dev/null
+++ b/docs/requirements_docs.txt
@@ -0,0 +1,4 @@
+sphinx==3.0.1
+sphinx-autoapi==1.3.0
+sphinx-rtd-theme==0.4.3
+recommonmark==0.6.0
\ No newline at end of file
diff --git a/run.py b/run.py
index 98097128..a733581d 100644
--- a/run.py
+++ b/run.py
@@ -1,7 +1,6 @@
 __author__ = "Lukas Leufen"
 __date__ = '2019-11-14'
 
-
 import argparse
 
 from src.run_modules.experiment_setup import ExperimentSetup
@@ -13,7 +12,6 @@ from src.run_modules.training import Training
 
 
 def main(parser_args):
-
     with RunEnvironment():
         ExperimentSetup(parser_args, stations=['DEBW107', 'DEBY081', 'DEBW013', 'DEBW076', 'DEBW087', 'DEBW001'],
                         station_type='background', trainable=False, create_new_model=False, window_history_size=6,
@@ -28,7 +26,6 @@ def main(parser_args):
 
 
 if __name__ == "__main__":
-
     parser = argparse.ArgumentParser()
     parser.add_argument('--experiment_date', metavar='--exp_date', type=str, default=None,
                         help="set experiment date as string")
diff --git a/run_hourly.py b/run_hourly.py
index 3c3135c4..559bf1a1 100644
--- a/run_hourly.py
+++ b/run_hourly.py
@@ -1,9 +1,7 @@
 __author__ = "Lukas Leufen"
 __date__ = '2019-11-14'
 
-
 import argparse
-import logging
 
 from src.run_modules.experiment_setup import ExperimentSetup
 from src.run_modules.model_setup import ModelSetup
@@ -14,7 +12,6 @@ from src.run_modules.training import Training
 
 
 def main(parser_args):
-
     with RunEnvironment():
         ExperimentSetup(parser_args, stations=['DEBW107', 'DEBY081', 'DEBW013', 'DEBW076', 'DEBW087', 'DEBW001'],
                         station_type='background', trainable=True, sampling="hourly", window_history_size=48)
@@ -28,7 +25,6 @@ def main(parser_args):
 
 
 if __name__ == "__main__":
-
     parser = argparse.ArgumentParser()
     parser.add_argument('--experiment_date', metavar='--exp_date', type=str, default=None,
                         help="set experiment date as string")
diff --git a/run_zam347.py b/run_zam347.py
index 1e140f48..d95067bb 100644
--- a/run_zam347.py
+++ b/run_zam347.py
@@ -1,7 +1,6 @@
 __author__ = "Lukas Leufen"
 __date__ = '2019-11-14'
 
-
 import argparse
 import json
 import logging
@@ -15,7 +14,6 @@ from src.run_modules.training import Training
 
 
 def load_stations():
-
     try:
         filename = 'German_background_stations.json'
         with open(filename, 'r') as jfile:
@@ -31,9 +29,7 @@ def load_stations():
 
 
 def main(parser_args):
-
     with RunEnvironment():
-
         ExperimentSetup(parser_args, stations=load_stations(), station_type='background', trainable=False,
                         create_new_model=True)
         PreProcessing()
@@ -46,7 +42,6 @@ def main(parser_args):
 
 
 if __name__ == "__main__":
-
     parser = argparse.ArgumentParser()
     parser.add_argument('--experiment_date', metavar='--exp_date', type=str, default=None,
                         help="set experiment date as string")
-- 
GitLab