From c51da37c7245a20d9c71cf6210d29332ec188c76 Mon Sep 17 00:00:00 2001 From: LAMBERT Jean-charles Date: Wed, 18 Dec 2019 18:15:04 +0100 Subject: [PATCH] add CI --- .gitlab-ci.yml | 289 +++++++++++++++++++++++++++++++++++ CI/script/build-wheel.sh | 12 ++ CI/script/build.sh | 19 +++ CI/script/repair-wheel.sh | 7 + CI/scriptOSX/build-unsio.sh | 9 ++ CI/scriptOSX/build-wheel.sh | 11 ++ CI/scriptOSX/repair-wheel.sh | 14 ++ CI/scriptOSX/test-unsio.sh | 12 ++ 8 files changed, 373 insertions(+) create mode 100644 .gitlab-ci.yml create mode 100755 CI/script/build-wheel.sh create mode 100755 CI/script/build.sh create mode 100755 CI/script/repair-wheel.sh create mode 100755 CI/scriptOSX/build-unsio.sh create mode 100755 CI/scriptOSX/build-wheel.sh create mode 100755 CI/scriptOSX/repair-wheel.sh create mode 100755 CI/scriptOSX/test-unsio.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..5a6470c --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,289 @@ +# +# Copyright Jean-Charles Lambert, 2018-2019 +# +# - YAML file for Continous Integration / Continous Deployement +# - uns_projects and python-unsiotools packages (RPM or DEB) are automatically +# generated at new commit for different linux distribution +# - add manylinux building for python-module +# +# - Documentation : +# https://docs.gitlab.com/ee/ci/yaml/ + +stages: +- build +- testpypi +- pypi + +variables : + TWINE_USERNAME: jcl + TWINE_PASSWORD: $TEST_PY_PASSWD + WHEEL : 0 + TESTPYPI : 0 + PYPI : 0 + OSX : 0 + TESTPYPIOSX : 0 + PYPIOSX : 0 + +before_script: + # clone + #- git clone https://gitlab.lam.fr/jclamber/unsio.git + #- cd unsio + #- git branch -r + #- git checkout origin/new_cmake + +# +# BUILD wheels for all linux flavors/python +# +manylinux2010 : + stage : build + image : portus.lam.fr/jclamber/unsio-manylinux2010 + only : + variables: + - $WHEEL == "1" + script: + # build + - CI/script/build.sh cmake3 + - CI/script/build-wheel.sh + - CI/script/repair-wheel.sh + - /opt/python/cp37-cp37m/bin/python setup.py sdist -d wheel + cache: + key: manylinux2010 + paths: + - wheel/ + artifacts: + name: "manylinux2010" + paths: + - test-*.res + - wheel/* + expire_in: 1 week + +# Push wheel to testpypi repos +push-testpypi-manylinux2010: + stage: testpypi + image : portus.lam.fr/jclamber/unsio-manylinux2010 + only : + variables: + - $TESTPYPI == "1" + script: + - /opt/python/cp37-cp37m/bin/python -m twine upload --disable-progress-bar -u $TWINE_USERNAME -p $TWINE_PASSWORD --repository-url https://test.pypi.org/legacy/ ./wheel/python*uns*manylinux2010* ./wheel/python*uns*gz + cache: + key: manylinux2010 + paths: + - wheel/ + +# Push wheel to pypi repos +push-pypi-manylinux2010: + stage: pypi + image : portus.lam.fr/jclamber/unsio-manylinux2010 + only : + variables: + - $PYPI == "1" + script: + - /opt/python/cp37-cp37m/bin/python -m twine upload --disable-progress-bar -u $TWINE_USERNAME -p $TWINE_PASSWORD ./wheel/python*uns*manylinux2010* ./wheel/python*uns*gz + cache: + key: manylinux2010 + paths: + - wheel/ +# +# MANYLINUX1 +# +manylinux1 : + stage : build + image : portus.lam.fr/jclamber/unsio-manylinux1 + only : + variables: + - $WHEEL == "1" + script: + # build + - CI/script/build.sh cmake + - CI/script/build-wheel.sh + - CI/script/repair-wheel.sh + cache: + key: manylinux1 + paths: + - wheel/ + artifacts: + name: "manylinux1" + paths: + - test-*.res + - wheel/* + expire_in: 1 week + +# Push wheel to testpypi repos +push-testpypi-manylinux1: + stage: testpypi + image : portus.lam.fr/jclamber/unsio-manylinux1 + only : + variables: + - $TESTPYPI == "1" + script: + - /opt/python/cp37-cp37m/bin/python -m twine upload --disable-progress-bar -u $TWINE_USERNAME -p $TWINE_PASSWORD --repository-url https://test.pypi.org/legacy/ ./wheel/python*uns*manylinux1* + cache: + key: manylinux1 + paths: + - wheel/ + +# Push wheel to pypi repos +push-pypi-manylinux1: + stage: pypi + image : portus.lam.fr/jclamber/unsio-manylinux1 + only : + variables: + - $PYPI == "1" + script: + - /opt/python/cp37-cp37m/bin/python -m twine upload --disable-progress-bar -u $TWINE_USERNAME -p $TWINE_PASSWORD ./wheel/python*uns*manylinux1* + cache: + key: manylinux1 + paths: + - wheel/ + +# +# BUILD wheels for macosx +# +OSX: + stage : build + tags: + - osx_10.13.6 + only : + variables: + - $OSX == "1" + script: + # build + - CI/scriptOSX/build-unsio.sh + - CI/scriptOSX/build-wheel.sh + - CI/scriptOSX/repair-wheel.sh + - CI/scriptOSX/test-unsio.sh + cache: + key: osx + paths: + - wheel/ + artifacts: + name: "osx-wheel" + paths: + - test-*.res + - wheel/* + expire_in: 1 week + +# Push wheel to testpypi repos +push-testpypi-OSX: + stage: testpypi + tags: + - osx_10.13.6 + only : + variables: + - $TESTPYPIOSX == "1" + script: + - python3.7 -m twine upload --disable-progress-bar -u $TWINE_USERNAME -p $TWINE_PASSWORD --repository-url https://test.pypi.org/legacy/ ./wheel/python*uns*macosx* + cache: + key: osx + paths: + - wheel/ + +# Push wheel to pypi repos +push-pypi-OSX: + stage: pypi + tags: + - osx_10.13.6 + only : + variables: + - $PYPIOSX == "1" + script: + - python3.7 -m twine upload --disable-progress-bar -u $TWINE_USERNAME -p $TWINE_PASSWORD ./wheel/python*uns*macosx* + cache: + key: osx + paths: + - wheel/ +# +# RPM Distros +# +opensuse42.3 : + stage : build + image: ppfb.lam.fr:5000/jcl-dev/opensuse42.3 + only : + - tags + script: + # build + - ../CI/build-rpm.sh 0opensuse42.3 + artifacts: + name: "opensuse42.3" + paths: + - unsio/build/*.rpm + - unsio/dist/*.rpm + - unsio/dist/*.gz + +fedora28 : + stage : build + image: ppfb.lam.fr:5000/jcl-dev/fedora28 + only : + - tags + script: + # build + - ../CI/build-rpm.sh 0fc28 + artifacts: + name: "fedora28" + paths: + - unsio/build/*.rpm + - unsio/dist/*.rpm + - unsio/dist/*.gz + +fedora27 : + stage : build + image: ppfb.lam.fr:5000/jcl-dev/fedora27 + only : + - tags + script: + # build + - ../CI/build-rpm.sh 0fc27 + artifacts: + name: "fedora27" + paths: + - unsio/build/*.rpm + - unsio/dist/*.rpm + - unsio/dist/*.gz + +mageia6 : + stage : build + image: ppfb.lam.fr:5000/jcl-dev/mageia6 + only : + - tags + script: + # build + - ../CI/build-rpm.sh 0mga6 + artifacts: + name: "mageia6" + paths: + - unsio/build/*.rpm + - unsio/dist/*.rpm + - unsio/dist/*.gz +# +# DEB distos +# +ubuntu 18.04: + stage : build + image: ppfb.lam.fr:5000/jcl-dev/ubuntu18.04 + only : + - tags + script: + # build + - ../CI/build-deb.sh 0ubuntu18.04 + artifacts: + name: "ubuntu18.04" + paths: + - unsio/build/*.deb + - unsio/my_deb/*.deb + - unsio/my_deb/*.gz + +ubuntu 16.04: + stage : build + image: ppfb.lam.fr:5000/jcl-dev/ubuntu16.04 + only : + - tags + script: + # build + - ../CI/build-deb.sh 0ubuntu16.04 + artifacts: + name: "ubuntu16.04" + paths: + - unsio/build/*.deb + - unsio/my_deb/*.deb + - unsio/my_deb/*.gz diff --git a/CI/script/build-wheel.sh b/CI/script/build-wheel.sh new file mode 100755 index 0000000..b503a32 --- /dev/null +++ b/CI/script/build-wheel.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +# build wheel +#PATH=/opt/usr/bin/:/opt/python/cp27-cp27m/bin:${PATH} pip wheel ./unsio/ -w wheelhouse + +rm -f wheel/*uns*manylinux*.whl wheel/*uns*tar.gz wheelhouse/*uns*manylinux*.whl + +# build wheel +for PYBIN in /opt/python/*/bin/; do + echo "Compiling using pip version ${PYBIN}...." + PATH=/opt/usr/bin/:${PYBIN}:${PATH} pip wheel --no-deps ./ -w wheelhouse +done diff --git a/CI/script/build.sh b/CI/script/build.sh new file mode 100755 index 0000000..19100ba --- /dev/null +++ b/CI/script/build.sh @@ -0,0 +1,19 @@ +#!/bin/bash +# +# Give as paramameter cmake (manylinux1) or cmake3 (manylinux2010) +# + +mycmake=$1 + +# clone & build unsio +git clone https://gitlab.lam.fr/jclamber/unsio.git +cd unsio +$mycmake . -DCMAKE_INSTALL_PREFIX=/usr/local +make -j 4 && make install +# Activate nemo environment +source /opt/usr/nemo/nemo_start.sh +# build uns_projects +cd .. +$mycmake . -DCMAKE_INSTALL_PREFIX=/usr +make -j 4 +make install diff --git a/CI/script/repair-wheel.sh b/CI/script/repair-wheel.sh new file mode 100755 index 0000000..d9699af --- /dev/null +++ b/CI/script/repair-wheel.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +# Bundle external shared libraries into the wheels +for whl in wheelhouse/*unsio*.whl; do + echo "repairing $whl...." + auditwheel repair "$whl" -w ./wheel +done diff --git a/CI/scriptOSX/build-unsio.sh b/CI/scriptOSX/build-unsio.sh new file mode 100755 index 0000000..b72e4e5 --- /dev/null +++ b/CI/scriptOSX/build-unsio.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +# Configure building environment +# We must deactivate RPATH (-DNO_RPATH=1) to allow to unsiolib to +# be included into the wheels + +cmake . -DNO_RPATH=1 +make -j 2 +make install diff --git a/CI/scriptOSX/build-wheel.sh b/CI/scriptOSX/build-wheel.sh new file mode 100755 index 0000000..4f147b9 --- /dev/null +++ b/CI/scriptOSX/build-wheel.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +rm -f wheel/*unsio*osx*.whl wheelhouse/*unsio*osx*.whl +# Activate python environement +# Build wheel +for PYENV in ${HOME}/venv/unsio*; do + echo "Activate ${PYENV}...." + source ${PYENV}/bin/activate + pip wheel --no-deps ./ -w wheelhouse + deactivate +done diff --git a/CI/scriptOSX/repair-wheel.sh b/CI/scriptOSX/repair-wheel.sh new file mode 100755 index 0000000..2bdca20 --- /dev/null +++ b/CI/scriptOSX/repair-wheel.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +# Activate python37 to have delocate-wheel +# delocate-wheel works the same with all python versions +source ${HOME}/venv/unsio37/bin/activate + +# Bundle external shared libraries into the wheels +for whl in wheelhouse/*unsio*.whl; do + echo "repairing $whl...." + delocate-wheel "$whl" -w ./wheel +done + +# de-activate python37 +deactivate diff --git a/CI/scriptOSX/test-unsio.sh b/CI/scriptOSX/test-unsio.sh new file mode 100755 index 0000000..e9eeeb4 --- /dev/null +++ b/CI/scriptOSX/test-unsio.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +# Install unsio wheel for every python +# Run test program +for PYVER in 34 35 36 37; do + PYENV=${HOME}/venv/unsio${PYVER} + echo "Activate ${PYENV}...." + source ${PYENV}/bin/activate + pip install wheel/*unsio*${PYVER}*-macosx*.whl + python -m unsio.test.ctestunsio --out test-${PYVER}.res + deactivate +done -- GitLab