An error occurred while loading the file. Please try again.
-
Delaigue Olivier authored5026b001
# .gitlab-ci.yml -- Pamhyr gitlab-ci
# Copyright (C) 2023 INRAE
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
stages:
- downloads
- build
- test
- package
- release
#############
# DOWNLOADS #
#############
dl-mage-linux:
stage: downloads
tags:
- linux
rules:
- if: $CI_COMMIT_BRANCH == 'ci-test' || $CI_COMMIT_BRANCH == 'master' || $CI_COMMIT_TAG
script:
- curl -L -o mage.tgz https://gitlab.irstea.fr/jean-baptiste.faure/mage/-/releases/Test6/downloads/packages/mage_linux.tgz
- mkdir -p mage-linux
- cd mage-linux
- tar xvf ../mage.tgz
artifacts:
paths:
- mage-linux/mage
- mage-linux/mage_extraire
- mage-linux/mailleurPF
dl-mage-windows:
stage: downloads
tags:
- linux
rules:
- if: $CI_COMMIT_BRANCH == 'ci-test' || $CI_COMMIT_BRANCH == 'master' || $CI_COMMIT_TAG
script:
- curl -L -o mage.tgz https://gitlab.irstea.fr/jean-baptiste.faure/mage/-/releases/Test6/downloads/packages/mage_windows.tgz
- mkdir -p mage-windows
- cd mage-windows
- tar xvf ../mage.tgz
artifacts:
paths:
- mage-windows/mage.exe
- mage-windows/mage_extraire.exe
- mage-windows/mailleurPF.exe
#########
# BUILD #
#########
set-version:
stage: build
tags:
- linux
script:
7172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
- cd packages
- ./version.sh "$CI_COMMIT_BRANCH" "$CI_COMMIT_TAG" "$CI_COMMIT_SHORT_SHA"
artifacts:
paths:
- VERSION
build-lang:
stage: build
tags:
- linux
script:
- cd ./src/lang/
- ./create_ts.sh
artifacts:
paths:
- src/lang/*.qm
build-linux:
stage: build
tags:
- linux
needs:
- job: dl-mage-linux
artifacts: true
- job: set-version
artifacts: true
- job: build-lang
artifacts: true
script:
- mkdir -p linux
- cd linux
# Setup virtual env
- python3 -m venv linux-venv
- . linux-venv/bin/activate
- pip3 install -r ../requirements.txt
# Run Pyinstaller
- pyinstaller -y --paths linux-venv/lib/python3.8/site-packages ../src/pamhyr.py
# Create directory
- mkdir -p pamhyr
# Copy Pamhyr info
- cp -v ../VERSION pamhyr/
- cp -v ../AUTHORS pamhyr/
- cp -v ../LICENSE pamhyr/
# Copy mage
- mkdir -p pamhyr/mage
- cp -v ../mage-linux/* pamhyr/mage/
# Copy Pamhyr
- cp -r dist/pamhyr pamhyr/
# Copy Pamhyr resources
- mkdir -p pamhyr/pamhyr/View
- mkdir -p pamhyr/pamhyr/View/ui
- mkdir -p pamhyr/pamhyr/View/ui/Widgets
- cp -r ../src/View/ui/*.ui pamhyr/pamhyr/View/ui/
- cp -r ../src/View/ui/ressources/ pamhyr/pamhyr/View/ui
- cp -r ../src/View/ui/Widgets/*.ui pamhyr/pamhyr/View/ui/Widgets
# Copy lang
- mkdir -p pamhyr/pamhyr/lang
- cp -r ../src/lang/*.qm pamhyr/pamhyr/lang
# Copy tests cases
- mkdir -p pamhyr/tests_cases/
- mkdir -p pamhyr/tests_cases/Saar
- cp ../tests_cases/Saar/Saar.pamhyr pamhyr/tests_cases/Saar/
artifacts:
paths:
- linux/pamhyr
build-windows:
stage: build
tags:
- wine
141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
needs:
- job: dl-mage-windows
artifacts: true
- job: set-version
artifacts: true
- job: build-lang
artifacts: true
script:
- mkdir windows
- cd windows
# Setup env
- python -m pip install -r ..\requirements.txt
# Run Pyinstaller
- pyinstaller -y ../src/pamhyr.py
# Create directory
- mkdir pamhyr
- dir
# Copy Pamhyr
- copy /y dist\pamhyr pamhyr\
# Copy Pamhyr info
- copy /y ..\LICENSE pamhyr\pamhyr\
- copy /y ..\AUTHORS pamhyr\pamhyr\
- copy /y ..\VERSION pamhyr\pamhyr\
# Copy mage
- mkdir pamhyr\mage
- copy /y ..\mage-windows\* pamhyr\mage\
# Copy Pamhyr resources
- mkdir pamhyr\pamhyr\View
- mkdir pamhyr\pamhyr\View\ui
- mkdir pamhyr\pamhyr\View\ui\Widgets
- copy /y ..\src\View\ui\*.ui pamhyr\pamhyr\View\ui\
- copy /y ..\src\View\ui\ressources\ pamhyr\pamhyr\View\ui
- copy /y ..\src\View\ui\Widgets\*.ui pamhyr\pamhyr\View\ui\Widgets
# Copy lang
- mkdir pamhyr\pamhyr\lang
- copy /y ..\src\lang\*.qm pamhyr\pamhyr\lang
# Copy tests cases
- mkdir pamhyr\tests_cases\
- mkdir pamhyr\tests_cases\Saar
- copy ..\tests_cases\Saar\Saar.pamhyr pamhyr\tests_cases\Saar\
artifacts:
paths:
- windows/pamhyr
#########
# TESTS #
#########
test:
stage: test
script:
- echo "TODO PAMHYR tests"
############
# PACKAGES #
############
linux-package-tar:
stage: package
tags:
- release
- linux
needs:
- job: build-linux
artifacts: true
rules:
- if: $CI_COMMIT_BRANCH == 'ci-test' || $CI_COMMIT_BRANCH == 'master' || $CI_COMMIT_TAG
artifacts:
paths:
- linux/pamhyr-gnulinux.tar.xz
211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
script:
- cd linux
- tar --xz -cf pamhyr-gnulinux.tar.xz ./pamhyr --checkpoint=.100
windows-package-zip:
stage: package
tags:
- release
- linux
needs:
- job: build-windows
artifacts: true
rules:
- if: $CI_COMMIT_BRANCH == 'ci-test' || $CI_COMMIT_BRANCH == 'master' || $CI_COMMIT_TAG
artifacts:
paths:
- windows/pamhyr-windows.zip
script:
- cd windows
- zip -r pamhyr-windows.zip pamhyr
windows-package-exe:
stage: package
tags:
- release
- wine
needs:
- job: build-windows
artifacts: true
rules:
- if: $CI_COMMIT_BRANCH == 'ci-test' || $CI_COMMIT_BRANCH == 'master' || $CI_COMMIT_TAG
artifacts:
paths:
- windows/pamhyr-windows.exe
script:
- cd windows
- copy /y ..\packages\make-windows-exe.bat make-windows-exe.bat
- copy /y ..\packages\pamhyr.nsi pamhyr.nsi
- .\make-windows-exe.bat
###########
# RELEASE #
###########
tag-release:
stage: release
tags:
- release
- linux
needs:
- job: linux-package-tar
artifacts: true
- job: windows-package-zip
artifacts: true
- job: windows-package-exe
artifacts: true
rules:
- if: $CI_COMMIT_TAG
artifacts:
paths:
- linux/pamhyr-gnulinux.tar.xz
- packages/pamhyr-windows.zip
- packages/pamhyr-windows.exe
script:
- cd packages
release:
name: '$CI_COMMIT_TAG'
description: 'Automatic release from tag $CI_COMMIT_TAG'
tag_name: '$CI_COMMIT_TAG'
ref: '$CI_COMMIT_SHA'
281282283284285286287288289290291292293294295
assets:
links:
- name: 'GNU/Linux (tar.xz)'
url: '${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/raw/packages/pamhyr-gnulinux.tar.xz'
filepath: '/linux/pamhyr-gnulinux.tar.xz'
link_type: 'package'
- name: 'Windows (exe)'
url: '${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/raw/packages/pamhyr-windows.exe'
filepath: '/windows/pamhyr-windows.exe'
link_type: 'package'
- name: 'Windows (zip)'
url: '${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/raw/packages/pamhyr-windows.zip'
filepath: '/windows/pamhyr-windows.zip'
link_type: 'package'