# .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 . stages: - build - test - package - release ######### # BUILD # ######### build-mage-linux: stage: build tags: - linux rules: - if: $CI_COMMIT_BRANCH == 'master' || $CI_COMMIT_TAG script: - curl -L -o mage.tgz https://gitlab.irstea.fr/jean-baptiste.faure/mage/-/releases/Test5/downloads/packages/mage_linux.tgz - mkdir -p mage - cd mage - tar xvf ../mage.tgz artifacts: paths: - mage/mage - mage/mage_extraire - mage/mailleurPF # build-mage-linux: # stage: build # tags: # - linux # rules: # - if: $CI_COMMIT_BRANCH == 'master' || $CI_COMMIT_TAG # variables: # GIT_SUBMODULE_STRATEGY: recursive # GIT_SUBMODULE_DEPTH: 20 # script: # - cd mage/src/ # - mkdir -p build # - cd build # - cmake .. # - make # artifacts: # paths: # - mage/src/build/mage # - mage/src/build/mage_extraire # - mage/src/build/mailleurPF build-mage-windows: stage: build tags: - linux rules: - if: $CI_COMMIT_BRANCH == 'master' || $CI_COMMIT_TAG script: - curl -L -o mage.tgz https://gitlab.irstea.fr/jean-baptiste.faure/mage/-/releases/Test5/downloads/packages/mage_windows.tgz - mkdir -p mage - cd mage - tar xvf ../mage.tgz artifacts: paths: - mage/mage.exe - mage/mage_extraire.exe - mage/mailleurPF.exe # build-mage-windows: # stage: build # tags: # - wine # rules: # - if: $CI_COMMIT_BRANCH == 'master' || $CI_COMMIT_TAG # variables: # GIT_SUBMODULE_STRATEGY: recursive # GIT_SUBMODULE_DEPTH: 20 # script: # - cd mage/src/ # - sed s/add_compile_definitions(win)/add_compile_definitions(windows)/ CMakeLists.txt > __tmp__ # - echo set(CMAKE_Fortran_COMPILER "C:/Program\ Files/gcc/bin/gfortran.exe") > CMakeLists.txt # - echo set(CMAKE_MAKE_PROGRAM "C:/Program Files\ \(x86\)/GnuWin32/bin/make.exe") >> CMakeLists.txt # - type __tmp__ >> CMakeLists.txt # - mkdir build # - cd build # - cmake -G "MinGW Makefiles" .. # - make # artifacts: # paths: # - mage/src/build/mage.exe # - mage/src/build/mage_extraire.exe # - mage/src/build/mailleurPF.exe build: stage: build tags: - linux script: - 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 ######### # TESTS # ######### test: stage: test script: - echo "TODO PAMHYR tests" ############ # PACKAGES # ############ linux-package: stage: package tags: - release - linux needs: - job: build-lang artifacts: true - job: build artifacts: true - job: build-mage-linux artifacts: true rules: - if: $CI_COMMIT_BRANCH == 'master' || $CI_COMMIT_TAG artifacts: paths: - packages/pamhyr-gnulinux-amd64.tar.xz script: - cd packages - ./linux.sh windows-package: stage: package tags: - release - wine needs: - job: build-lang artifacts: true - job: build artifacts: true - job: build-mage-windows artifacts: true rules: - if: $CI_COMMIT_BRANCH == 'master' || $CI_COMMIT_TAG artifacts: paths: - packages/pamhyr-win-amd64.exe script: - cd packages - ./windows.bat ########### # RELEASE # ########### tag-release: stage: release tags: - release - linux needs: - job: linux-package artifacts: true - job: windows-package artifacts: true rules: - if: $CI_COMMIT_TAG artifacts: paths: - packages/pamhyr-gnulinux-amd64.tar.xz - packages/pamhyr-win-amd64.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' assets: links: - name: 'GNU/Linux amd64 (tar.xz)' url: '${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/raw/packages/pamhyr-gnulinux-amd64.tar.xz' filepath: '/packages/pamhyr-gnulinux-amd64.tar.xz' link_type: 'package' - name: 'Windows amd64 (exe)' url: '${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/raw/packages/pamhyr-win-amd64.exe' filepath: '/packages/pamhyr-win-amd64.exe' link_type: 'package'