diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0f0ec0d5..f47f4aed 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -30,6 +30,7 @@ stages: variables: MAGE_8_VERSION: "v8.3.6" + CUSTOM_PYTHON_VERSION: "3.10.14-build1" dl-mage8-doc: stage: downloads @@ -83,6 +84,21 @@ dl-mage8-windows: - mage8-windows/mailleurTT.exe - mage8-windows/libbief.dll +dl-python-linux: + stage: downloads + tags: + - linux + rules: + - if: $CI_COMMIT_BRANCH == 'setup.py' || $CI_COMMIT_TAG + script: + - curl -L -o python.tar.xz https://gitlab.irstea.fr/parouby/custom-python-build/-/releases/$CUSTOM_PYTHON_VERSION/downloads/packages/python.tar.xz + - mkdir -p linux-python/ + - cd linux-python + - tar xvf ../python.tgz + artifacts: + paths: + - linux-python + ############# # CONFIGURE # ############# @@ -408,6 +424,41 @@ windows-package-exe: - copy ..\packages\pamhyr.nsi pamhyr.nsi - .\make-windows-exe.bat +linux-python-with-sources: + stage: package + tags: + - release + - linux + needs: + - job: dl-python-linux + artifacts: true + - job: set-version + artifacts: true + - job: build-lang + artifacts: true + rules: + - if: $CI_COMMIT_BRANCH == 'setup.py' || $CI_COMMIT_TAG + artifacts: + paths: + - linux-sources-with-python.tar.xz + script: + - git archive --format=tar.gz --output=src.tar.gz $CI_COMMIT_BRANCH + - cd linux-python + - mkdir -p pamhyr + - cd pamhyr + - tar xvf ../../src.tar.gz + - cp -v ../../VERSION ./ + - cp -v ../../src/lang/*.qm ./src/lang/ + - cd .. + - cp ../package/setup.sh ./setup.sh + - sed -i 's|python3|$(dirname $0)/python/python|' setup.sh + - sed -i 's|.pamhyr-env|$(dirname $0)/.pamhyr-env|' setup.sh + - sed -i 's|./pamhyr|$(dirname $0)/pamhyr|' setup.sh + - cd .. + - mv linux-python pamhyr + - tar cf linux-sources-with-python.tar.xz pamhyr + - mv pamhyr linux-python # Keep 'pamhyr' path avalaible + ######## # HASH # ######## diff --git a/packages/setup.sh b/packages/setup.sh index 700b3908..1c6c1383 100755 --- a/packages/setup.sh +++ b/packages/setup.sh @@ -20,42 +20,32 @@ function perr() { } function try() { - echo "run: $1" + echo "$1" res=$($1) if [ $? -ne 0 ]; then - perr "Command failed with exit value $?: '$1'" - perr " $res" + perr " !!! Command failed with exit value $?: '$1'" + perr " - $res" exit 2 fi } -if [ $# -ne 1 ]; +if [ $# -ne 0 ]; then - perr "usage: $0 " + perr "usage: $0" exit 1 fi -version=$1 - -# Download last version -try "curl https://gitlab.irstea.fr/theophile.terraz/pamhyr/-/archive/$version/pamhyr-$version.tar.gz -o pamhyr-$version.tar.gz" - -# Setup last version -try "tar xf pamhyr-$version.tar.gz" -mv pamhyr-$version/ pamhyr/ - OLD_PWD=$PWD -cd pamhyr try "python3 -m venv .pamhyr-env" try "source .pamhyr-env/bin/activate" try "python3 -m pip install -r requirements.txt" -echo '#! /usr/bin/env bash' > pamhyr.sh -echo 'source .pamhyr-env/bin/activate' >> pamhyr.sh -echo 'python3 ./src/pamhyr.py' >> pamhyr.sh +echo '#! /usr/bin/env bash' > pamhyr +echo 'source .pamhyr-env/bin/activate' >> pamhyr +echo 'python3 ./pamhyr/src/pamhyr.py $@' >> pamhyr -try "chmod +x pamhyr.sh" +try "chmod +x pamhyr" cd $OLD_PWD