From dd736a6b54bfd860f14c0e8933ab2f41a4d3bbdf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?David=20Schw=C3=B6rer?= <dave@ipp.mpg.de>
Date: Sat, 6 Mar 2021 13:09:57 +0100
Subject: [PATCH] add instructions for deploying

---
 .gitlab-ci.yml                              | 24 ++++++++++++++++++---
 tools/pylib/_boutcore_build/build-wheels.sh | 20 +++++++++++++----
 2 files changed, 37 insertions(+), 7 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 296e3ba5e..e9d270097 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,9 +1,27 @@
-image: quay.io/pypa/manylinux2014_x86_64
+stages:
+  - test
+  - build
+  - deploy
 
-manylinux2014:
+
+wheel/manylinux2014:
+  stage: build
+  image: quay.io/pypa/manylinux2014_x86_64
   script:
     - bash --login tools/pylib/_boutcore_build/build-wheels.sh manylinux2014_x86_64
   artifacts:
     paths:
-      - /io/wheelhouse/*whl
+      - wheelhouse/*whl
+      - dist/*.tar.*
+
 
+deploy/pypi:
+  stage: deploy
+  image: python:slim
+  script:
+    # TWINE_USERNAME and TWINE_PASSWORD are provided by CI secret variables
+    - pip install twine
+    - ls -l
+    - twine upload --repository testpypi wheelhouse/*.whl
+  needs:
+    - wheel/manylinux2014
diff --git a/tools/pylib/_boutcore_build/build-wheels.sh b/tools/pylib/_boutcore_build/build-wheels.sh
index e85ac1f55..b81864e9d 100644
--- a/tools/pylib/_boutcore_build/build-wheels.sh
+++ b/tools/pylib/_boutcore_build/build-wheels.sh
@@ -1,5 +1,6 @@
 set -ex
-yum -y install mpich-devel fftw-devel netcdf-cxx-devel
+yum -y install fftw-devel netcdf-cxx-devel
+yum -y install openmpi3-devel || yum -y install openmpi-1.10-devel
 if ! module load mpi ; then
     . /etc/profile
     module load mpi
@@ -21,7 +22,7 @@ function repair_wheel {
     fi
 }
 
-for PYBIN in /opt/python/*/bin;
+for PYBIN in /opt/python/cp3*/bin;
 do
     make clean
     $PYBIN/pip install numpy cython
@@ -29,13 +30,16 @@ do
     "${PYBIN}/pip" wheel . --no-deps -w wheelhouse/
 done
 
+# Build sdist
+$PYBIN/python setup.py sdist || :
+
 for whl in wheelhouse/*.whl; do
-    LD_LIBRARY_PATH=$(pwd)/../../../lib/ repair_wheel "$whl"
+    LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(pwd)/../../../lib/ repair_wheel "$whl"
 done
 
 ls -l /io/wheelhouse
 
-for PYBIN in /opt/python/*/bin/; do
+for PYBIN in /opt/python/cp3*/bin/; do
     "${PYBIN}/pip" install $NAME --no-index -f /io/wheelhouse
     if test -e "${PYBIN}/nosetests"
     then
@@ -45,3 +49,11 @@ for PYBIN in /opt/python/*/bin/; do
 	)
     fi
 done
+
+ls -l wheelhouse || :
+mkdir -p wheelhouse
+rm -f wheelhouse/*whl
+ls -l wheelhouse
+cp /io/wheelhouse/*whl wheelhouse/
+ls -l wheelhouse
+ls -l
-- 
GitLab