From bca488d6d2c9ffc519c486041d5d84e3d8f07786 Mon Sep 17 00:00:00 2001
From: u214892 <u214892@sbb.ch>
Date: Wed, 6 Nov 2019 11:02:44 -0500
Subject: [PATCH] #254 Technical Guidelines

---
 .gitlab-ci.yml   | 28 ++++++++++++++++++++++++----
 CONTRIBUTING.rst | 26 +++++++++++++++-----------
 make_docs.py     |  8 +++++++-
 3 files changed, 46 insertions(+), 16 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 698ceca1..8aeb6fca 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -12,7 +12,8 @@ image: themattrix/tox
 stages:
     - tests
     - integration_testing
-    - benchmarks_and_profiling
+    - profiling
+    - benchmarks
     - deploy_docs
 cache:
     paths:
@@ -61,10 +62,10 @@ build_and_deploy_docs:
         name: ${CI_COMMIT_REF_SLUG}
         url: http://${BUCKET_NAME}.s3-website.${AWS_DEFAULT_REGION}.amazonaws.com/
 
-benchmarks_and_profiling:
+profiling:
     dependencies:
         - tests
-    stage: benchmarks_and_profiling
+    stage: profiling
     only:
         variables:
             - $BENCHMARKS_AND_PROFILING
@@ -78,7 +79,26 @@ benchmarks_and_profiling:
         - conda update -n root conda -y
         - conda install -c conda-forge tox-conda
     script:
-        - xvfb-run tox -e benchmarks,profiling -v --recreate
+        - xvfb-run tox -e profiling -v --recreate
+
+benchmarks:
+    dependencies:
+        - tests
+    stage: benchmarks
+    only:
+        variables:
+            - $BENCHMARKS_AND_PROFILING
+    before_script:
+        - apt update
+        - apt install -y libgl1-mesa-glx xvfb xdg-utils libcairo2-dev libjpeg-dev libgif-dev
+        - wget -nv https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/Miniconda3-latest-Linux-x86_64.sh
+        - bash /tmp/Miniconda3-latest-Linux-x86_64.sh -b -p /tmp/miniconda3
+        - export PATH=/tmp/miniconda3/bin:$PATH
+        - pip install tox awscli
+        - conda update -n root conda -y
+        - conda install -c conda-forge tox-conda
+    script:
+        - xvfb-run tox -e benchmarks -v --recreate
 
 test_conda_setup:
     stage: integration_testing
diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst
index a6cb14eb..360d3167 100644
--- a/CONTRIBUTING.rst
+++ b/CONTRIBUTING.rst
@@ -114,6 +114,17 @@ Before you submit a merge request, check that it meets these guidelines:
 3. The merge request should work for Python 3.6, 3.7 and for PyPy. Check
    https://gitlab.aicrowd.com/flatland/flatland/pipelines
    and make sure that the tests pass for all supported Python versions.
+   We force pipelines to be run successfully for merge requests to be merged.
+4. Although we cannot enforce it technically, we ask for merge requests to be reviewed by at least one core member
+   in order to ensure that the Technical Guidelines below are respected and that the code is well tested:
+
+4.1  The remarks from the review should be resolved/implemented and communicated using the 'discussions resolved':
+
+.. image:: images/DiscussionsResolved.png
+
+4.2  When a merge request is merged, source branches should be deleted and commits squashed:
+
+.. image:: images/SourceBranchSquash.png
 
 Tips
 ----
@@ -206,17 +217,6 @@ Technical Guidelines
 --------------------
 
 
-Merge Requests
-~~~~~~~~~~~~~~
-
-Although we cannot enforce it technically, we ask for
-* merge requests to be reviewed
-* review points to be implemented using the 'discussions resolved'
-.. image:: images/DiscussionsResolved.PNG
-* source branches to be deleted and commits to be squashed
-.. image:: images/SourceBranchSquash.PNG
-
-
 Naming Conventions
 ~~~~~~~~~~~~~~~~~~
 
@@ -362,7 +362,11 @@ We use the abc_ class decorator and a way to declaratively define the attributes
             def save(self, output, data):
                 """Save the data object to the output."""
 
+
+
+
 And then
+
     .. code-block:: python
 
         # abc_subclass.py
diff --git a/make_docs.py b/make_docs.py
index 81fe5873..f56ded3a 100644
--- a/make_docs.py
+++ b/make_docs.py
@@ -36,6 +36,13 @@ for md_file in glob.glob(r'./*.md') + glob.glob(r'./docs/specifications/*.md') +
         out.write(rst_content)
         out.flush()
 
+img_dest = 'docs/images/'
+if not os.path.exists(img_dest):
+    os.makedirs(img_dest)
+for image_file in glob.glob(r'./images/*.png'):
+    shutil.copy(image_file, img_dest)
+
+
 subprocess.call(['sphinx-apidoc', '--force', '-a', '-e', '-o', 'docs/', 'flatland', '-H', 'API Reference', '--tocfile',
                  '05_apidoc'])
 
@@ -47,7 +54,6 @@ if not os.path.exists(img_dest):
     os.makedirs(img_dest)
 for image_file in glob.glob(r'./specifications/img/*'):
     shutil.copy(image_file, img_dest)
-
 subprocess.call(['python', '-msphinx', '-M', 'html', '.', '_build'])
 
 
-- 
GitLab