This project manages its dependencies using npm. Learn more
.gitlab-ci.yml 14.74 KiB
# .gitlab-ci.yml -- Pamhyr gitlab-ci
# Copyright (C) 2023-2024  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
  - configure
  - test
  - build
  - package
  - hash
  - antivirus
  - release
#############
# DOWNLOADS #
#############
variables:
  MAGE_8_VERSION: "v8.3.6"
dl-mage8-doc:
  stage: downloads
  tags:
    - linux
  rules:
    - if: $CI_COMMIT_BRANCH == 'ci-test' || $CI_COMMIT_BRANCH == 'master' || $CI_COMMIT_TAG
  script:
    - mkdir -p doc
    - cd doc
    - curl -L -o mage8.pdf https://gitlab.irstea.fr/jean-baptiste.faure/mage/-/releases/$MAGE_8_VERSION/downloads/documents/Mage-8_Documentation.pdf
  artifacts:
    paths:
      - doc/mage8.pdf
dl-mage8-linux:
  stage: downloads
  tags:
    - linux
  rules:
    - if: $CI_COMMIT_BRANCH == 'ci-test' || $CI_COMMIT_BRANCH == 'master' || $CI_COMMIT_TAG
  script:
    - curl -L -o mage8.tgz https://gitlab.irstea.fr/jean-baptiste.faure/mage/-/releases/$MAGE_8_VERSION/downloads/packages/mage_linux.tgz
    - mkdir -p mage8-linux
    - cd mage8-linux
    - tar xvf ../mage8.tgz
  artifacts:
    paths:
      - mage8-linux/mage
      - mage8-linux/mage_as7
      - mage8-linux/mage_extraire
      - mage8-linux/mailleurTT
      - mage8-linux/libbief.so
dl-mage8-windows:
  stage: downloads
  tags:
    - linux
7172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
rules: - if: $CI_COMMIT_BRANCH == 'ci-test' || $CI_COMMIT_BRANCH == 'master' || $CI_COMMIT_TAG script: - curl -L -o mage8.tgz https://gitlab.irstea.fr/jean-baptiste.faure/mage/-/releases/$MAGE_8_VERSION/downloads/packages/mage_windows.tgz - mkdir -p mage8-windows - cd mage8-windows - tar xvf ../mage8.tgz artifacts: paths: - mage8-windows/mage.exe - mage8-windows/mage_as7.exe - mage8-windows/mage_extraire.exe - mage8-windows/mailleurTT.exe - mage8-windows/libbief.dll ############# # CONFIGURE # ############# set-version: stage: configure tags: - linux script: - cd packages - ./version.sh "$CI_COMMIT_BRANCH" "$CI_COMMIT_TAG" "$CI_COMMIT_SHORT_SHA" artifacts: paths: - VERSION build-lang: stage: configure tags: - linux script: - cd ./src/lang/ - ./create_ts.sh artifacts: paths: - src/lang/*.qm ######### # TESTS # ######### unittest: stage: test tags: - linux needs: - job: set-version artifacts: true script: - python3 -m venv venv - . venv/bin/activate - pip3 install -U pip - pip3 install -r ./full-requirements.txt - pip3 install -U -r ./full-requirements.txt - cd src - python3 -m unittest discover -t . test-pep8: stage: test tags: - linux needs: - job: set-version artifacts: true - job: unittest script:
141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
# Setup virtual env - python3 -m venv venv - . venv/bin/activate - pip3 install -U pip - pip3 install -r ./requirements.txt - pip3 install -U -r ./requirements.txt - pip3 install pycodestyle - pycodestyle --exclude="*_to_*.py" ./src allow_failure: true ######### # BUILD # ######### # build-users-doc: # stage: build # tags: # - linux # needs: # - job: set-version # artifacts: true # script: # - cd ./doc/users/ # - ./build.sh # artifacts: # paths: # - doc/users/documentation.pdf # - doc/users/documentation.html # - doc/users/images/ # allow_failure: true build-td: stage: build tags: - linux needs: - job: set-version artifacts: true script: - cd ./doc/users/Tuto1/ - ./build.sh artifacts: paths: - doc/users/Tuto1/step-by-step.pdf - doc/users/Tuto1/pas-a-pas.pdf - doc/users/Tuto1/data/ allow_failure: true build-developers-doc: stage: build tags: - linux needs: - job: set-version artifacts: true script: - cd ./doc/dev/ - ./build.sh # Create html documentation - cd ../../src - python3 -m venv doc-venv - . doc-venv/bin/activate - pip3 install -U pip - pip3 install -r ../full-requirements.txt - pip3 install -U -r ../full-requirements.txt - pip3 install pdoc3 - pdoc --html . # Create archive - tar cf html.tar ./html - cd ../doc/dev
211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
- mv ../../src/html.tar ./ artifacts: paths: - doc/dev/documentation.pdf - doc/dev/documentation.html - doc/dev/html.tar - doc/dev/images/ allow_failure: true build-linux: stage: build tags: - linux rules: - if: $CI_COMMIT_BRANCH == 'ci-test' || $CI_COMMIT_BRANCH == 'master' || $CI_COMMIT_TAG needs: - job: dl-mage8-linux artifacts: true - job: dl-mage8-doc artifacts: true - job: set-version artifacts: true - job: build-lang artifacts: true - job: build-developers-doc artifacts: true # - job: build-users-doc # artifacts: true - job: build-td artifacts: true script: - mkdir -p linux - cd linux # Setup virtual env - python3 -m venv linux-venv - . linux-venv/bin/activate - pip3 install -U pip - pip3 install -r ../requirements.txt - pip3 install -U -r ../requirements.txt # Run Pyinstaller - pyinstaller -y --paths linux-venv/lib/python3.8/site-packages ../src/pamhyr.py # Create directory - mkdir -p pamhyr - mkdir -p pamhyr/_internal # Copy Pamhyr info - cp -v ../VERSION pamhyr/_internal/ - cp -v ../AUTHORS pamhyr/_internal/ - cp -v ../LICENSE pamhyr/_internal/ - cp -v ../src/motd.txt pamhyr/_internal/ # Copy mage - mkdir -p pamhyr/mage8 - cp -v ../mage8-linux/* pamhyr/mage8/ # Copy Pamhyr - cp -r dist/pamhyr/* pamhyr/ # Copy Pamhyr resources - mkdir -p pamhyr/_internal/View - mkdir -p pamhyr/_internal/View/ui - mkdir -p pamhyr/_internal/View/ui/Widgets - cp -r ../src/View/ui/*.ui pamhyr/_internal/View/ui/ - cp -r ../src/View/ui/ressources/ pamhyr/_internal/View/ui - cp -r ../src/View/ui/Widgets/*.ui pamhyr/_internal/View/ui/Widgets # Copy lang - mkdir -p pamhyr/_internal/lang - cp -r ../src/lang/*.qm pamhyr/_internal/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/ # Copy documentations - mkdir -p pamhyr/doc/
281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350
- mkdir -p pamhyr/doc/images/ - mkdir -p pamhyr/doc/html/ # - cp ../doc/users/documentation.pdf pamhyr/doc/Pamhyr2-users.pdf # - cp ../doc/users/documentation.html pamhyr/doc/Pamhyr2-users.html - cp ../doc/mage8.pdf pamhyr/doc/mage8.pdf - cp ../doc/dev/documentation.pdf pamhyr/doc/Pamhyr2-dev.pdf - cp ../doc/dev/documentation.html pamhyr/doc/Pamhyr2-dev.html #- cp ../doc/users/images/* pamhyr/doc/images - cp -r ../doc/dev/images/* pamhyr/doc/images - cp -r ../doc/images/* pamhyr/doc/images # Copy Tuto - mkdir -p pamhyr/doc/Tuto1/ - mkdir -p pamhyr/doc/Tuto1/data - cp ../doc/users/Tuto1/Hogneau_Engees2022.pdf pamhyr/doc/Tuto1/Hogneau_Engees2022.pdf - cp ../doc/users/Tuto1/step-by-step.pdf pamhyr/doc/Tuto1/Tuto1-en.pdf - cp ../doc/users/Tuto1/pas-a-pas.pdf pamhyr/doc/Tuto1/Tuto1-fr.pdf - cp ../doc/users/Tuto1/*.pamhyr pamhyr/doc/Tuto1/ - cp ../doc/users/Tuto1/data/* pamhyr/doc/Tuto1/data/ # Copy TP charriage - mkdir -p pamhyr/doc/TP_charriage/ - cp ../doc/users/TP_charriage/* pamhyr/doc/TP_charriage artifacts: paths: - linux/pamhyr build-windows: stage: build tags: - wine rules: - if: $CI_COMMIT_BRANCH == 'ci-test' || $CI_COMMIT_BRANCH == 'master' || $CI_COMMIT_TAG needs: - job: dl-mage8-windows artifacts: true - job: dl-mage8-doc artifacts: true - job: set-version artifacts: true - job: build-lang artifacts: true - job: build-developers-doc artifacts: true # - job: build-users-doc # artifacts: true - job: build-td artifacts: true script: - mkdir windows - cd windows # Setup env - python -m pip install -U pip - python -m pip install -r ..\requirements.txt - python -m pip install -U -r ..\requirements.txt # Run Pyinstaller # - pyinstaller --noconsole -y ..\src\pamhyr.py - pyinstaller --hide-console hide-early -y ..\src\pamhyr.py # Create directory - mkdir pamhyr - dir - copy ..\packages\make-windows-dir.bat .\make-windows-dir.bat - .\make-windows-dir.bat artifacts: paths: - windows/pamhyr ############ # PACKAGES # ############ linux-package-tar:
351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420
stage: package tags: - release - linux needs: # - job: test-linux - job: build-linux artifacts: true rules: - if: $CI_COMMIT_BRANCH == 'ci-test' || $CI_COMMIT_TAG artifacts: paths: - linux/pamhyr-gnulinux.tar.xz script: - cd linux - tar --xz -cf pamhyr-gnulinux.tar.xz ./pamhyr --checkpoint=.100 windows-package-zip: stage: package tags: - release - linux needs: # - job: test-windows - job: build-windows artifacts: true rules: - if: $CI_COMMIT_BRANCH == 'ci-test' || $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: test-windows - job: build-windows artifacts: true rules: - if: $CI_COMMIT_BRANCH == 'ci-test' || $CI_COMMIT_TAG artifacts: paths: - windows/pamhyr-windows.exe script: - cd windows - copy ..\packages\make-windows-exe.bat make-windows-exe.bat - copy ..\packages\pamhyr.nsi pamhyr.nsi - .\make-windows-exe.bat ######## # HASH # ######## linux-build-hash: stage: hash tags: - release - linux needs: - job: build-linux artifacts: true rules: - if: $CI_COMMIT_BRANCH == 'ci-test' || $CI_COMMIT_BRANCH == 'master' || $CI_COMMIT_TAG script:
421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490
- cd linux - sha256sum -b pamhyr/pamhyr > pamhyr/pamhyr.sha256 artifacts: paths: - linux/pamhyr/pamhyr.sha256 windows-build-hash: stage: hash tags: - release - linux needs: - job: build-windows artifacts: true rules: - if: $CI_COMMIT_BRANCH == 'ci-test' || $CI_COMMIT_BRANCH == 'master' || $CI_COMMIT_TAG script: - cd windows - sha256sum -b pamhyr/pamhyr.exe > pamhyr/pamhyr.exe.sha256 artifacts: paths: - windows/pamhyr/pamhyr.exe.sha256 pkg-hash: stage: hash 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_BRANCH == 'ci-test' || $CI_COMMIT_TAG script: - cd windows - sha256sum -b pamhyr-windows.exe > pamhyr-windows.exe.sha256 - sha256sum -b pamhyr-windows.zip > pamhyr-windows.zip.sha256 - cd .. - cd linux - sha256sum -b pamhyr-gnulinux.tar.xz > pamhyr-gnulinux.tar.xz.sha256 artifacts: paths: - windows/pamhyr-windows.exe.sha256 - windows/pamhyr-windows.zip.sha256 - linux/pamhyr-gnulinux.tar.xz.sha256 ############# # ANTIVIRUS # ############# build-check-clamav: stage: antivirus tags: - release - linux needs: - job: build-linux artifacts: true - job: build-windows artifacts: true rules: - if: $CI_COMMIT_BRANCH == 'ci-test' || $CI_COMMIT_BRANCH == 'master' || $CI_COMMIT_TAG script: - cd packages - ./clamav-scan.sh builds allow_failure: true
491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560
pkg-check-clamav: stage: antivirus 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_BRANCH == 'ci-test' || $CI_COMMIT_TAG script: - cd packages - ./clamav-scan.sh packages allow_failure: true ########### # 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 # - job: build-users-doc # artifacts: true - job: build-developers-doc artifacts: true - job: pkg-hash artifacts: true rules: - if: $CI_COMMIT_TAG artifacts: paths: - linux/pamhyr-gnulinux.tar.xz - windows/pamhyr-windows.zip - windows/pamhyr-windows.exe - linux/pamhyr-gnulinux.tar.xz.sha256 - windows/pamhyr-windows.zip.sha256 - windows/pamhyr-windows.exe.sha256 - doc/dev/documentation.pdf # - doc/users/documentation.pdf script: - cd packages release: name: '$CI_COMMIT_TAG' description: '$CI_COMMIT_TAG_MESSAGE' tag_name: '$CI_COMMIT_TAG' ref: '$CI_COMMIT_SHA' assets: links: - name: 'GNU/Linux CHECKSUM SHA256 (tar.xz)' url: '${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/raw/linux/pamhyr-gnulinux.tar.xz.sha256' filepath: '/linux/pamhyr-gnulinux.tar.xz.sha256' link_type: 'package' - name: 'GNU/Linux (tar.xz)' url: '${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/raw/linux/pamhyr-gnulinux.tar.xz' filepath: '/linux/pamhyr-gnulinux.tar.xz'
561562563564565566567568569570571572573574575576577578579580581582
link_type: 'package' - name: 'Windows CHECKSUM SHA256 (exe)' url: '${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/raw/windows/pamhyr-windows.exe.sha256' filepath: '/windows/pamhyr-windows.exe.sha256' link_type: 'package' - name: 'Windows (exe)' url: '${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/raw/windows/pamhyr-windows.exe' filepath: '/windows/pamhyr-windows.exe' link_type: 'package' - name: 'Windows CHECKSUM SHA256 (zip)' url: '${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/raw/windows/pamhyr-windows.zip.sha256' filepath: '/windows/pamhyr-windows.zip.sha256' link_type: 'package' - name: 'Windows (zip)' url: '${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/raw/windows/pamhyr-windows.zip' filepath: '/windows/pamhyr-windows.zip' link_type: 'package' - name: 'Dev documentations (pdf)' url: '${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/raw/doc/dev/documentation.pdf' filepath: '/doc/dev/documentation.pdf' link_type: 'other'