
stages:
- BuildTestinstall
- DocCoverage
- deploy

dailyBuildMasterAll:
        #cache:
                #untracked: true
                #paths:
                #- build/
        image: gitlab-registry.in2p3.fr/cta-lapp/phoenix_libs2/phoenixcmake/phoenix_cmake_ubuntu_2204:latest
        stage: BuildTestinstall
        script:
        - export LD_LIBRARY_PATH=/usr/lib
        - env
        - mkdir -p build
        - cd build
        - >
                cmake ..
                -DCMAKE_INSTALL_PREFIX=/usr
                -DSELF_TESTS_MODE=yes
                -DCMAKE_MODULE_PATH=/usr/share/cmake/Modules
        - make all
        - make install
        - make test || cat ./Testing/Temporary/LastTest.log

        only:
        - branches
        - tags
        tags:
                - MUST_big_runner
        
#dailyBuildDynamicAndStatic:
        #image: gitlab-registry.in2p3.fr/cta-lapp/phoenix_libs2/phoenixcmake/phoenix_cmake_ubuntu_2204:latest
        #stage: BuildTestinstall
        #script:
        #- export LD_LIBRARY_PATH=/usr/lib
        #- env
        #- mkdir -p build
        #- cd build
        #- >
                #cmake ..
                #-DCMAKE_INSTALL_PREFIX=/usr
                #-DRELEASE_MODE=yes
                #-DSELF_TESTS_MODE=yes
                #-DPHOENIX_BUILD_TYPE=DynamicAndStatic
        #- make all
        #- make install
        #- make test
        #only:
        #- branches
        #- tags
        #tags:
                #- MUST_big_runner

#dailyBuildStaticOnly:
        #image: gitlab-registry.in2p3.fr/cta-lapp/phoenix_libs2/phoenixcmake/phoenix_cmake_ubuntu_2204:latest
        #stage: BuildTestinstall
        #script:
        #- export LD_LIBRARY_PATH=/usr/lib
        #- env
        #- mkdir -p build
        #- cd build
        #- >
                #cmake ..
                #-DCMAKE_INSTALL_PREFIX=/usr
                #-DRELEASE_MODE=yes
                #-DSELF_TESTS_MODE=yes
                #-DPHOENIX_BUILD_TYPE=StaticOnly
        #- make all
        #- make install
        #- make test
        #only:
        #- branches
        #- tags
        #tags:
                #- MUST_big_runner

TestCoverage:
        image: gitlab-registry.in2p3.fr/cta-lapp/phoenix_libs2/phoenixcmake/phoenix_cmake_ubuntu_2204:latest
        stage: DocCoverage
        script:
        - export LD_LIBRARY_PATH=/usr/lib
        - env
        - mkdir -p build coverage
        - cd build
        - >
                cmake ..
                -DCMAKE_INSTALL_PREFIX=/usr
                -DSELF_TESTS_MODE=yes
                -DCMAKE_BUILD_TYPE=Coverage
                -DCMAKE_MODULE_PATH=/usr/share/cmake/Modules
        - make all
        - make install
        - make test
        - ./uninstall_phoenixsocket
        - cd ../coverage
        - gcovr -r ../ --exclude-throw-branches --html cov_report.html --html-details
        - gcovr -r ../ --exclude-throw-branches --xml Coverage.xml
        - gcovr -r ../ --exclude-throw-branches
        coverage: '/TOTAL.*\s+(\d+\%)$/'
        artifacts:
                paths:
                - coverage
                expire_in: 8d
        only:
        - branches
        - tags
        tags:
                - MUST_big_runner

Doc:
        image: gitlab-registry.in2p3.fr/cta-lapp/phoenix_libs2/phoenixcmake/phoenix_cmake_ubuntu_2204:latest
        stage: DocCoverage
        script:
        - export LD_LIBRARY_PATH=/usr/lib
        - env
        - rm -fr build public
        - mkdir -p build
        - mkdir -p public
        - cd build
        - >
                cmake ..
                -DCMAKE_INSTALL_PREFIX=/usr
                -DDOC_MODE=yes
                -DCMAKE_MODULE_PATH=/usr/share/cmake/Modules
        - make all
        - make doc
        - scp -r doc/html/* ../public
        artifacts:
                paths:
                - public
                expire_in: 8d
        only:
        - branches
        - tags
        tags:
                - MUST_big_runner


pages:
        stage: deploy
        image: gitlab-registry.in2p3.fr/cta-lapp/phoenix_libs2/phoenixcmake/phoenix_cmake_ubuntu_2204:latest
        script:
        - mv coverage public/
        artifacts:
                paths:
                - public
                expire_in: 8d
        tags:
                - MUST_big_runner
    
    
Ubuntu 2004:
        image: gitlab-registry.in2p3.fr/cta-lapp/phoenix_libs2/phoenixdocker/package_ubuntu2004_gcc9:0.1
        stage: DocCoverage
        script:
                - ./cmake/phoenix_createPackages.sh DEB package_ubuntu2004 false
        artifacts:
                paths:
                - package_ubuntu2004
                expire_in: 8d
        only:
        #- branches
        - tags
        tags:
                - MUST_big_runner

Ubuntu 2204:
        image: gitlab-registry.in2p3.fr/cta-lapp/phoenix_libs2/phoenixdocker/package_ubuntu2204_gcc11:0.1
        stage: DocCoverage
        script:
                - ./cmake/phoenix_createPackages.sh DEB package_ubuntu2204 false
        artifacts:
                paths:
                - package_ubuntu2204
                expire_in: 8d
        only:
        #- branches
        - tags
        tags:
                - MUST_big_runner
        
Fedora 31:
        image: gitlab-registry.in2p3.fr/cta-lapp/phoenix_libs2/phoenixdocker/package_fedora31:0.1
        stage: DocCoverage
        script:
                - ./cmake/phoenix_createPackages.sh RPM package_fedora31 false
        artifacts:
                paths:
                - package_fedora31
                expire_in: 8d
        only:
        #- branches
        - tags
        tags:
                - MUST_big_runner

Fedora 36:
        image: gitlab-registry.in2p3.fr/cta-lapp/phoenix_libs2/phoenixdocker/package_fedora36:0.1
        stage: DocCoverage
        script:
                - ./cmake/phoenix_createPackages.sh RPM package_fedora36 false
        artifacts:
                paths:
                - package_fedora36
                expire_in: 8d
        only:
        #- branches
        - tags
        tags:
                - MUST_big_runner
        
Release:
        image: gitlab-registry.in2p3.fr/cta-lapp/phoenix_libs2/phoenixdocker/package_ubuntu2204_python3:0.1
        stage: deploy
        script:
        - echo "Let's do some release"
        - uname -a
        - python3 ./cmake/createReleaseCurl.py -n ${CI_PROJECT_TITLE} -i ${CI_PROJECT_ID} -t ${CI_COMMIT_TAG} -p ${CI_RELEASE_TOKEN}
        only:
        #- branches
        - tags
        tags:
                - MUST_big_runner
        
    
