3232 exit 1
3333fi
3434
35- # Report the inferred directory whwere python is found
35+ # Report the inferred directory where python is found
3636echo " PYTHON_DIR: ${PYTHON_DIR} "
3737
38+ # The pagmo version to be used for releases.
39+ export PAGMO_VERSION_RELEASE=" 2.19.0"
40+
41+ # Check if this is a release build.
42+ if [[ " ${GITHUB_REF} " == " refs/tags/v" * ]]; then
43+ echo " Tag build detected"
44+ export PYGMO_RELEASE_BUILD=" yes"
45+ else
46+ echo " Non-tag build detected"
47+ fi
48+
3849# Python mandatory deps.
3950/opt/python/${PYTHON_DIR} /bin/pip install cloudpickle numpy
4051# Python optional deps.
@@ -45,8 +56,14 @@ echo "PYTHON_DIR: ${PYTHON_DIR}"
4556cd /root/install
4657
4758# Install pagmo
48- git clone https://github.com/esa/pagmo2.git
49- cd pagmo2
59+ if [[ " ${PYGMO_RELEASE_BUILD} " == " yes" ]]; then
60+ curl -L -o pagmo2.tar.gz https://github.com/esa/pagmo2/archive/refs/tags/v${PAGMO_VERSION_RELEASE} .tar.gz
61+ tar xzf pagmo2.tar.gz
62+ cd pagmo2-${PAGMO_VERSION_RELEASE}
63+ else
64+ git clone https://github.com/esa/pagmo2.git
65+ cd pagmo2
66+ fi
5067
5168mkdir build
5269cd build
@@ -84,14 +101,23 @@ sleep 20
84101/opt/python/${PYTHON_DIR} /bin/python -c " import pygmo; pygmo.test.run_test_suite(1); pygmo.mp_island.shutdown_pool(); pygmo.mp_bfe.shutdown_pool()"
85102
86103# Upload to pypi. This variable will contain something if this is a tagged build (vx.y.z), otherwise it will be empty.
87- if [[ " ${PYGMO_RELEASE_VERSION} " != " " ]]; then
88- echo " Release build detected, creating the source code archive."
89- cd ${GITHUB_WORKSPACE}
90- TARBALL_NAME=${GITHUB_WORKSPACE} /build/wheel/dist2/pygmo-${PYGMO_RELEASE_VERSION} .tar
91- git archive --format=tar --prefix=pygmo2/ -o ${TARBALL_NAME} ${BRANCH_NAME}
92- tar -rf ${TARBALL_NAME} --transform " s,^build/wheel/pygmo.egg-info,pygmo2," build/wheel/pygmo.egg-info/PKG-INFO
93- gzip -9 ${TARBALL_NAME}
94- echo " ... uploading all to PyPi."
104+ # if [[ "${PYGMO_RELEASE_VERSION}" != "" ]]; then
105+ # echo "Release build detected, creating the source code archive."
106+ # cd ${GITHUB_WORKSPACE}
107+ # TARBALL_NAME=${GITHUB_WORKSPACE}/build/wheel/dist2/pygmo-${PYGMO_RELEASE_VERSION}.tar
108+ # git archive --format=tar --prefix=pygmo2/ -o ${TARBALL_NAME} ${BRANCH_NAME}
109+ # tar -rf ${TARBALL_NAME} --transform "s,^build/wheel/pygmo.egg-info,pygmo2," build/wheel/pygmo.egg-info/PKG-INFO
110+ # gzip -9 ${TARBALL_NAME}
111+ # echo "... uploading all to PyPi."
112+ # /opt/python/${PYTHON_DIR}/bin/pip install twine
113+ # /opt/python/${PYTHON_DIR}/bin/twine upload -u ci4esa ${GITHUB_WORKSPACE}/build/wheel/dist2/pygmo*
114+ # fi
115+
116+ # Upload to PyPI.
117+ if [[ " ${PYGMO_RELEASE_BUILD} " == " yes" ]]; then
95118 /opt/python/${PYTHON_DIR} /bin/pip install twine
96119 /opt/python/${PYTHON_DIR} /bin/twine upload -u ci4esa ${GITHUB_WORKSPACE} /build/wheel/dist2/pygmo*
97120fi
121+
122+ set +e
123+ set +x
0 commit comments