summaryrefslogblamecommitdiff
path: root/.gitlab-ci.yml
blob: 15dba17b51817632b19cdcff409be3e45085a674 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
       
            
         
         
 
                                        
              


                            
                                          

                           

                                                               
 
                      
          

                                 


                                                
                                                  
                
 










                        


            
                
                     
                  
 

           
                 
                 
         
                                 
                                  
                               
               
            
                          
                                                       
                                                         
                                                                                                            
                                                

            
 
           
                 
         
                           
                                  
                               
               
            
                          
                                                       

                                                                                                           
                                                


            















                                                                                                           
          
                 
         
                              
                                  
               
            
                                                 
                                                       

                                                                                                           
                                                
 
      
                 

                           
                                  
               

                          
                                                       

                                                                                                           
                                                
 












                                                                                                           














                                                                                                           
                                                
 
















                                                                                                           
                   
                 

           
                               
               
                                                        





                                  
                   
                 

           
                               
               
                                                        





                                    
           
                 

                                
                                  

                                      
               

                          
                                                       

                                                                                                 
                                                
 
                
                 
         
                                            
                                  
               
            
                          
                                                       

                                                                                                           
                                                
 
                  
                 
         
                                                  
               
            
                          
                                                       


                                                                                                           
                   
                 
         
                                                                                                
               
            
                          



                                                                                                           
       
                 

                                 
                                
                                  
               


                                                      
 
        
                 
         

                                      
                              
                                   
               
            
                                                       

            
                 
         
                                                                                                                                 
                                                                                                       
                                                                                                                                                               

                                                                                                                    
               

                          
                                                       

                                                                                                           
 
                 
                 
         
                                                                                                                                 
                                                                                                       
                                                                                                                                                               

                                                                                                                    
                               
               

                          
                                                       

                                                                                                           


            

       

                              














                                                                                                             







                                  
















                                                                                                             
                                                                      
                    















                                                                                                           

                                  



                                                                         
                                                            
                                                                                   
                                                                                                                                                                                     

                                                                                                                                
                                            
               


                            
                          
                                                                  
                                                                                                                                      

                        
           





                                                                             

                                  


                                                              

                                                                                                                                                                                                 

                                                                                                                                
                                            
               


                            
                          
                                                                  
                                                                                                                     

                        
           





                                                                             
                         
                













                                                                                                           

                                 




                                                                                   
                                                                                                                                                                                     

                                                                                                                                
               


                       
                          
                                                                  
                                                                                                                                      






                                                                             

                                 


                                                              
                                                                                                                                                                                                 

                                                                                                                                
               


                       
                          
                                                                  
                                                                                                                     







                                                                             

                                     




                                                                                   
                                                                                                                                                                                     

                                                                                                                                
               


                           
                          
                                                                  
                                                                                                                                      








                                                                             

                                     


                                                              
                                                                                                                                                                                                 

                                                                                                                                
               


                           
                          
                                                                  
                                                                                                                     








                                                                             













                                                                                                            





























                                                                                                            






























                                                                                                            
                 

              
                                                                              
               
            
                          
                                                       



                                                                                                            

            
 














                                                                                                            
            

              
                                                                                             










                                                                                                            





























                                                                                                              














                                                                                                              


































                                                                                                                                                                                                                                 
                       
              










                                                                                                            

                                              
              























                                                                                                            
              






















                                                                                                                    
              























                                                                                                            
              






















                                                                                                                    






























                                                                                                           





















































                                                                                                           

               
                
              















                                                            
              














                                                               



                           
                                  
                                                             
               









                                       
                                  
                                                             
               





                     
                           
              
         
                                                        
                                  
               
            
                          


                                                                                                           
                                                
 



                                                             





                                                                                                           




                                                                         





                                                                                                 
 

























                                                                                                           

























                                                                                                           
                         

              
                                                            
                                  
               
            
                          
                                                       

                                                                                                           
                                                
 








                                                                        



                                                                                                 
               

              
                                             
                                  
               
            





                                                                                                           


              
                                                                             
                                  
               
            
                          
                                                       

                                                                                                           
                                                
 
                 

              
                                             
                                  
               
            
                          
                                                       

                                                                                                           
                                                
 



















                                                                                                           
                                   
                       


                                                              
                                                                                 
                                                                                                     
                                                                                        
               


                       
                          
                                                       

                                                                                                           
                                                           


            

                            




                                                                                   
                                                                                                                
                                                                                                              




                                       
                          
                                                                  
                                                                                                                                      
                                     





                                                                             

                            


                                                              
                                                                                                                            
                                                                                                              




                                       
                          
                                                                  
                                                                                                                     
                                     






                                                                             

                                




                                                                                   
                                                                                                                
                                                                                                              




                                       
                          
                                                                  
                                                                                                                                      
                                     







                                                                             

                                


                                                              
                                                                                                                            
                                                                                                              

                                       


                           
                          
                                                                  
                                                                                                                     
                                     







                                                                             
                        

              

                                                 
               






                                                                                                           
 
                   

              

                                                 
               





                                                                                                           
 



                              




                     
                  

                               

                                                                                                           








                               




                     
                  
            
                       
                                            










                            


               

                           

                             





                     
stages:
  - prebuild
  - build
  - stats

# with :; prevent from run it on windows
before_script:
  - ":; uname -a"
  - ":; cat /etc/os-release"
  - ":; pwd"
  - ":; cat /proc/sys/kernel/core_pattern"
  - ":; mkdir logs || true"
  - ":; ${UPDATEREPOS}"
  - ":; ${DOCKERRETRY} ${PMUPDATE} >logs/apt.log"
  - ":; ${DOCKERRETRY} ${PMINSTALL} ${PACKAGES} >>logs/apt.log"

image: debian:unstable
variables:
  GET_SOURCES_ATTEMPTS: "5"
  ARTIFACT_DOWNLOAD_ATTEMPTS: "5"
  UPDATEREPOS: "tools/ci/scripts/updaterepos.sh"
  PMUPDATE: "apt-get update"
  PMINSTALL: "apt-get install -y -qq"
  DOCKERRETRY: "./tools/ci/scripts/dockerretry.sh"
  GIT_DEPTH: "1"

.job-push: &job-push
  artifacts:
    paths:
    - logs
    when: always
    expire_in: 3 week
  except:
    - triggers
  dependencies: []

.job-always: &job-always
  artifacts:
    paths:
    - logs
    when: always
    expire_in: 3 week
  dependencies: []

# pre build

gcc-5_c++11_i386:
  stage: prebuild
  script:
  - ./tools/ci/jobs/gcc5_c++11.sh
  - ./tools/ci/scripts/runtests.sh
  image: vicamo/debian:sid-i386
  <<: *job-push
  variables:
    PACKAGES: gcc-5 g++-5 
              make autoconf automake autopoint gettext 
              libxml2-dev libcurl4-gnutls-dev libpng-dev 
              libsdl-gfx1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev 
              gdb valgrind netcat-openbsd procps
  tags:
    - docker

gcc-6-i386:
  stage: prebuild
  script:
  - ./tools/ci/jobs/gcc6.sh
  - ./tools/ci/scripts/runtests.sh
  image: vicamo/debian:sid-i386
  <<: *job-push
  variables:
    PACKAGES: gcc-6 g++-6 
              make autoconf automake autopoint gettext 
              libxml2-dev libcurl4-gnutls-dev libpng-dev 
              libsdl-gfx1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev
              gdb valgrind netcat-openbsd procps
  tags:
    - docker

gcc-7-i386:
  stage: prebuild
  script:
  - ./tools/ci/jobs/gcc7.sh
  - ./tools/ci/scripts/runtests.sh
  image: vicamo/debian:sid-i386
  <<: *job-push
  variables:
    PACKAGES: gcc-7 g++-7 
              make autoconf automake autopoint gettext 
              libxml2-dev libcurl4-gnutls-dev libpng-dev 
              libsdl-gfx1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev
              gdb valgrind netcat-openbsd procps
  tags:
    - docker

clang-3.9:
  stage: prebuild
  script:
  - ./tools/ci/jobs/clang39.sh
  - ./tools/ci/scripts/runtests.sh
  <<: *job-push
  variables:
    PACKAGES: clang-3.9 libc++-dev libc++abi-dev 
              make autoconf automake autopoint gettext 
              libxml2-dev libcurl4-gnutls-dev libpng-dev 
              libsdl-gfx1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev
              gdb valgrind netcat-openbsd procps

gcc-6:
  stage: prebuild
  script:
  - ./tools/ci/jobs/gcc6.sh
  - ./tools/ci/scripts/runtests.sh
  <<: *job-push
  variables:
    PACKAGES: gcc-6 g++-6 
              make autoconf automake autopoint gettext 
              libxml2-dev libcurl4-gnutls-dev libpng-dev 
              libsdl-gfx1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev
              gdb valgrind netcat-openbsd procps

gcc-7:
  stage: prebuild
  script:
  - ./tools/ci/jobs/gcc7.sh
  - ./tools/ci/scripts/runtests.sh
  <<: *job-push
  variables:
    PACKAGES: gcc-7 g++-7 
              make autoconf automake autopoint gettext 
              libxml2-dev libcurl4-gnutls-dev libpng-dev 
              libsdl-gfx1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev
              gdb valgrind netcat-openbsd procps

gcc-6_default:
  stage: prebuild
  script:
  - ./tools/ci/jobs/any_compiler.sh --enable-werror
  - ./tools/ci/scripts/runtests.sh
  <<: *job-push
  variables:
    LOGFILE: gcc6.log
    CC: gcc-6
    CXX: g++-6
    CXXFLAGS: "-Wall -Wextra"
    PACKAGES: gcc-6 g++-6 
              make autoconf automake autopoint gettext 
              libxml2-dev libcurl4-gnutls-dev libpng-dev 
              libsdl-gfx1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev
              gdb valgrind netcat-openbsd procps

gcc-7_default:
  stage: prebuild
  script:
  - ./tools/ci/jobs/any_compiler.sh --enable-werror
  - ./tools/ci/scripts/runtests.sh
  <<: *job-push
  variables:
    LOGFILE: gcc6.log
    CC: gcc-7
    CXX: g++-7
    CXXFLAGS: "-Wall -Wextra"
    PACKAGES: gcc-7 g++-7 
              make autoconf automake autopoint gettext 
              libxml2-dev libcurl4-gnutls-dev libpng-dev 
              libsdl-gfx1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev
              gdb valgrind netcat-openbsd procps

mxe_gcc6_shared_32:
  stage: prebuild
  script:
  - ls /mxe
  - ./tools/ci/jobs/mxe_gcc6.sh
  <<: *job-push
  image: registry.gitlab.com/manaplus/mxe:gcc6_shared_32
  variables:
    PACKAGES: bash
    CROSS: i686-w64-mingw32.shared
  tags:
    - docker

mxe_gcc6_shared_64:
  stage: prebuild
  script:
  - ls /mxe
  - ./tools/ci/jobs/mxe_gcc6.sh
  <<: *job-push
  image: registry.gitlab.com/manaplus/mxe:gcc6_shared_64
  variables:
    PACKAGES: bash
    CROSS: x86_64-w64-mingw32.shared
  tags:
    - docker

gcc-5_sdl2:
  stage: prebuild
  script:
  - ./tools/ci/jobs/gcc5_sdl2.sh
  - ./tools/ci/scripts/runtests.sh
  - ./tools/ci/jobs/gcc5_sdl2_c++11.sh
  - ./tools/ci/scripts/runtests.sh
  <<: *job-push
  variables:
    PACKAGES: gcc-5 g++-5 
              make autoconf automake autopoint gettext 
              libxml2-dev libcurl4-gnutls-dev libpng-dev 
              libsdl2-gfx-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-net-dev libsdl2-ttf-dev
              gdb valgrind netcat-openbsd procps

gcc-7_game_only:
  stage: prebuild
  script:
  - ./tools/ci/jobs/gcc7.sh --without-dyecmd
  - ./tools/ci/scripts/runtests.sh
  <<: *job-push
  variables:
    PACKAGES: gcc-7 g++-7 
              make autoconf automake autopoint gettext 
              libxml2-dev libcurl4-gnutls-dev libpng-dev 
              libsdl-gfx1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev
              gdb valgrind netcat-openbsd procps

gcc-7_dyecmd_only:
  stage: prebuild
  script:
  - ./tools/ci/jobs/gcc7.sh --without-manaplusgame
  <<: *job-push
  variables:
    PACKAGES: gcc-7 g++-7 
              make autoconf automake autopoint gettext 
              libxml2-dev libcurl4-gnutls-dev libpng-dev 
              libsdl-gfx1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev

gcc-7_unittestsbin:
  stage: prebuild
  script:
  - ./tools/ci/jobs/gcc7_silent.sh --enable-unittestsbin --without-manaplusgame --without-dyecmd
  <<: *job-push
  variables:
    PACKAGES: gcc-7 g++-7 
              make autoconf automake autopoint gettext 
              libxml2-dev libcurl4-gnutls-dev libpng-dev 
              libsdl-gfx1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev

mplint:
  stage: prebuild
  script:
  - ./tools/ci/jobs/mplint.sh src
  - ./tools/ci/jobs/mplint.sh po
  - ./tools/ci/jobs/mplint.sh data
  <<: *job-push
  variables:
    PACKAGES: gcc g++ git 
              make autoconf automake autopoint gettext

linters:
  stage: prebuild
  script:
  - ./tools/ci/jobs/pngcheck.sh
  - ./tools/ci/jobs/imagemagiccheck.sh
  - ./tools/ci/jobs/cpplint.sh
  - ./tools/ci/jobs/nsiqcppstyle.sh
  <<: *job-push
  variables:
    PACKAGES: python wget pngcheck imagemagick git grep

gcc-5_h_all:
  stage: prebuild
  script:
  - ./tools/ci/jobs/gcc5_h.sh -std=c++0x -DDEBUGBUILD -DTMWA_SUPPORT -DENABLE_NLS -DUSE_OPENGL -DENABLE_LIBXML -I/usr/include/SDL
  - ./tools/ci/jobs/gcc5_h.sh -std=c++0x -DDEBUGBUILD -DTMWA_SUPPORT -DENABLE_LIBXML -I/usr/include/SDL
  - ./tools/ci/jobs/gcc5_h.sh -std=c++0x -DDEBUGBUILD -DTMWA_SUPPORT -DENABLE_NLS -DUSE_OPENGL -DENABLE_LIBXML -DUNITTESTS -DUNITTESTS_CATCH -I/usr/include/SDL
  - ./tools/ci/jobs/gcc5_h.sh -std=c++0x -DDEBUGBUILD -DTMWA_SUPPORT -DENABLE_NLS -DENABLE_LIBXML -I/usr/include/SDL
  - ./tools/ci/jobs/gcc5_h.sh -std=c++0x -DDEBUGBUILD -DENABLE_NLS -DUSE_OPENGL -DENABLE_LIBXML -I/usr/include/SDL
  <<: *job-push
  variables:
    PACKAGES: gcc-5 g++-5 
              make autoconf automake autopoint gettext 
              libxml2-dev libcurl4-gnutls-dev libpng-dev 
              libsdl-gfx1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev

gcc-5_h_all_i386:
  stage: prebuild
  script:
  - ./tools/ci/jobs/gcc5_h.sh -std=c++0x -DDEBUGBUILD -DTMWA_SUPPORT -DENABLE_NLS -DUSE_OPENGL -DENABLE_LIBXML -I/usr/include/SDL
  - ./tools/ci/jobs/gcc5_h.sh -std=c++0x -DDEBUGBUILD -DTMWA_SUPPORT -DENABLE_LIBXML -I/usr/include/SDL
  - ./tools/ci/jobs/gcc5_h.sh -std=c++0x -DDEBUGBUILD -DTMWA_SUPPORT -DENABLE_NLS -DUSE_OPENGL -DENABLE_LIBXML -DUNITTESTS -DUNITTESTS_CATCH -I/usr/include/SDL
  - ./tools/ci/jobs/gcc5_h.sh -std=c++0x -DDEBUGBUILD -DTMWA_SUPPORT -DENABLE_NLS -DENABLE_LIBXML -I/usr/include/SDL
  - ./tools/ci/jobs/gcc5_h.sh -std=c++0x -DDEBUGBUILD -DENABLE_NLS -DUSE_OPENGL -DENABLE_LIBXML -I/usr/include/SDL
  image: vicamo/debian:sid-i386
  <<: *job-push
  variables:
    PACKAGES: gcc-5 g++-5 
              make autoconf automake autopoint gettext 
              libxml2-dev libcurl4-gnutls-dev libpng-dev 
              libsdl-gfx1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev
  tags:
    - docker

# tests

# disabled due gitlab bug
.gcc-7_sanitize_doctest_tests:
  stage: build
  script:
  - ./tools/ci/jobs/gcc7_sanitize_tests.sh --enable-unittests=doctest --without-dyecmd --without-manaplusgame
  - ldd ./src/manaplustests | grep "libasan"
  <<: *job-push
  variables:
    PACKAGES: gcc-7 g++-7 
              make autoconf automake autopoint gettext 
              libxml2-dev libcurl4-gnutls-dev libpng-dev 
              libsdl-gfx1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev 
              valgrind
    JOBS: 1
  tags:
    - docker

triggers:
  stage: build
  script:
  - ./tools/ci/scripts/triggers.sh
  <<: *job-push
  variables:
    PACKAGES: curl

gcc-7_sanitize_doctest_tests_i386:
  stage: build
  script:
  - ./tools/ci/jobs/gcc7_sanitize_tests.sh --enable-unittests=doctest --without-dyecmd --without-manaplusgame
  - ldd ./src/manaplustests | grep "libasan"
  image: vicamo/debian:sid-i386
  <<: *job-push
  variables:
    PACKAGES: gcc-7 g++-7 
              make autoconf automake autopoint gettext 
              libxml2-dev libcurl4-gnutls-dev libpng-dev 
              libsdl-gfx1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev 
              valgrind
    JOBS: 1
  tags:
    - docker

# too slow for one thread, with two threads rundom out of memory issue
gcc-7_sanitize_i386:
  stage: build
  script:
  - ./tools/ci/jobs/gcc7_sanitize.sh
  - ./tools/ci/scripts/runtests.sh
  image: vicamo/debian:sid-i386
  <<: *job-push
  variables:
    PACKAGES: gcc-7 g++-7 
              make autoconf automake autopoint gettext 
              libxml2-dev libcurl4-gnutls-dev libpng-dev 
              libsdl-gfx1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev
              gdb valgrind netcat-openbsd procps
    JOBS: 1
  tags:
    - docker

# disabled due gitlab bug
.gcc-7_SDL_SDL-1.2_sanitize2_test:
  stage: build
  script:
  - ./tools/ci/scripts/downloadlib.sh ${LIBNAME} ${LIBVERSION}
  - echo /usr/local/spm/bin/${LIBNAME}_${LIBVERSION}/runenv.sh ${runenvz}
  - export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libasan.so.4
  - /usr/local/spm/bin/${LIBNAME}_${LIBVERSION}/runenv.sh ${runenvx} ${runenvz} env
  - /usr/local/spm/bin/${LIBNAME}_${LIBVERSION}/runenv.sh ${runenvx} ${runenvz} ./tools/ci/jobs/gcc7_sanitize_tests.sh --enable-unittests=yes --without-manaplusgame --without-dyecmd
  - export LD_PRELOAD
  - /usr/local/spm/bin/${LIBNAME}_${LIBVERSION}/runenv.sh ${runenvx} ${runenvz} ./tools/ci/scripts/checkldd.sh src/manaplustests
  - ldd ./src/manaplustests | grep "libasan"
  <<: *job-push
  variables:
    LIBNAME: SDL
    LIBVERSION: SDL-1.2_asan
    PACKAGES: gcc-7 g++-7 
              make autoconf automake autopoint gettext pkg-config 
              libx11-dev libxext-dev libxt-dev libxv-dev x11proto-core-dev libgl1-mesa-dev libasound2-dev libglu1-mesa-dev libicu-dev 
              valgrind 
              wget unzip
    JOBS: 1
    ASAN_OPTIONS: "detect_leaks=0"
    runenvz: /usr/local/spm/bin/${LIBNAME}_${LIBVERSION}/runzlib_master.sh
    runenvx: /usr/local/spm/bin/${LIBNAME}_${LIBVERSION}/runlibxml2_master.sh
  tags:
    - docker

# disabled due gitlab bug
.gcc-7_SDL_default_sanitize2_test:
  stage: build
  script:
  - ./tools/ci/scripts/downloadlib.sh ${LIBNAME} ${LIBVERSION}
  - export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libasan.so.4
  - /usr/local/spm/bin/${LIBNAME}_${LIBVERSION}/runenv.sh ${runenvx} ${runenvz} ./tools/ci/jobs/gcc7_sanitize_tests.sh --enable-unittests=yes --with-sdl2 --without-manaplusgame --without-dyecmd
  - export LD_PRELOAD
  - /usr/local/spm/bin/${LIBNAME}_${LIBVERSION}/runenv.sh ${runenvx} ${runenvz} ./tools/ci/scripts/checkldd.sh src/manaplustests
  - ldd ./src/manaplustests | grep "libasan"
  <<: *job-push
  variables:
    LIBNAME: SDL
    LIBVERSION: default_asan
    PACKAGES: gcc-7 g++-7 
              make autoconf automake autopoint gettext pkg-config 
              libx11-dev libxext-dev libxt-dev libxv-dev x11proto-core-dev libgl1-mesa-dev libasound2-dev libicu-dev 
              valgrind 
              wget unzip
    JOBS: 1
    ASAN_OPTIONS: "detect_leaks=0"
    runenvz: /usr/local/spm/bin/${LIBNAME}_${LIBVERSION}/runzlib_master.sh
    runenvx: /usr/local/spm/bin/${LIBNAME}_${LIBVERSION}/runlibxml2_master.sh
  tags:
    - docker

# disabled due gitlab bug
.gcc-7_sanitize:
  stage: build
  script:
  - ./tools/ci/jobs/gcc7_sanitize.sh
  - ./tools/ci/scripts/runtests.sh
  <<: *job-push
  variables:
    PACKAGES: gcc-7 g++-7 
              make autoconf automake autopoint gettext 
              libxml2-dev libcurl4-gnutls-dev libpng-dev 
              libsdl-gfx1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev
              gdb valgrind netcat-openbsd procps
  tags:
    - docker

# disabled due gitlab bug
.gcc-7_SDL_SDL-1.2_sanitize_test:
  stage: build
  script:
  - ./tools/ci/scripts/downloadlib.sh ${LIBNAME} ${LIBVERSION}
  - echo /usr/local/spm/bin/${LIBNAME}_${LIBVERSION}/runenv.sh ${runenvz}
  - /usr/local/spm/bin/${LIBNAME}_${LIBVERSION}/runenv.sh ${runenvx} ${runenvz} env
  - /usr/local/spm/bin/${LIBNAME}_${LIBVERSION}/runenv.sh ${runenvx} ${runenvz} ./tools/ci/jobs/gcc7_sanitize_tests.sh --enable-unittests=yes --without-manaplusgame --without-dyecmd
  - /usr/local/spm/bin/${LIBNAME}_${LIBVERSION}/runenv.sh ${runenvx} ${runenvz} ./tools/ci/scripts/checkldd.sh src/manaplustests
  - ldd ./src/manaplustests | grep "libasan"
  <<: *job-push
  variables:
    LIBNAME: SDL
    LIBVERSION: SDL-1.2
    PACKAGES: gcc-7 g++-7 
              make autoconf automake autopoint gettext pkg-config 
              libx11-dev libxext-dev libxt-dev libxv-dev x11proto-core-dev libgl1-mesa-dev libasound2-dev libglu1-mesa-dev libicu-dev 
              valgrind 
              wget unzip
    runenvz: /usr/local/spm/bin/${LIBNAME}_${LIBVERSION}/runzlib_master.sh
    runenvx: /usr/local/spm/bin/${LIBNAME}_${LIBVERSION}/runlibxml2_master.sh
  tags:
    - docker

# disabled due gitlab bug
.gcc-7_SDL_default_sanitize_test:
  stage: build
  script:
  - ./tools/ci/scripts/downloadlib.sh ${LIBNAME} ${LIBVERSION}
  - /usr/local/spm/bin/${LIBNAME}_${LIBVERSION}/runenv.sh ${runenvx} ${runenvz} ./tools/ci/jobs/gcc7_sanitize_tests.sh --enable-unittests=yes --with-sdl2 --without-manaplusgame --without-dyecmd
  - /usr/local/spm/bin/${LIBNAME}_${LIBVERSION}/runenv.sh ${runenvx} ${runenvz} ./tools/ci/scripts/checkldd.sh src/manaplustests
  - ldd ./src/manaplustests | grep "libasan"
  <<: *job-push
  variables:
    LIBNAME: SDL
    LIBVERSION: default
    PACKAGES: gcc-7 g++-7 
              make autoconf automake autopoint gettext pkg-config 
              libx11-dev libxext-dev libxt-dev libxv-dev x11proto-core-dev libgl1-mesa-dev libasound2-dev libicu-dev 
              valgrind 
              wget unzip
    runenvz: /usr/local/spm/bin/${LIBNAME}_${LIBVERSION}/runzlib_master.sh
    runenvx: /usr/local/spm/bin/${LIBNAME}_${LIBVERSION}/runlibxml2_master.sh
  tags:
    - docker


# disabled due gitlab bug
.gcc-7_SDL_SDL-1.2_old_sanitize_test:
  stage: build
  script:
  - ./tools/ci/scripts/downloadlib.sh ${LIBNAME} ${LIBVERSION}
  - echo /usr/local/spm/bin/${LIBNAME}_${LIBVERSION}/runenv.sh ${runenvz}
  - /usr/local/spm/bin/${LIBNAME}_${LIBVERSION}/runenv.sh ${runenvx} ${runenvz} env
  - /usr/local/spm/bin/${LIBNAME}_${LIBVERSION}/runenv.sh ${runenvx} ${runenvz} ./tools/ci/jobs/gcc7_sanitize_tests.sh --enable-unittests=yes --without-manaplusgame --without-dyecmd
  - /usr/local/spm/bin/${LIBNAME}_${LIBVERSION}/runenv.sh ${runenvx} ${runenvz} ./tools/ci/scripts/checkldd.sh src/manaplustests
  - ldd ./src/manaplustests | grep "libasan"
  <<: *job-push
  variables:
    LIBNAME: SDL
    LIBVERSION: SDL-1.2_old
    PACKAGES: gcc-7 g++-7 
              make autoconf automake autopoint gettext pkg-config 
              libx11-dev libxext-dev libxt-dev libxv-dev x11proto-core-dev libgl1-mesa-dev libasound2-dev libglu1-mesa-dev libicu-dev 
              valgrind 
              libjpeg-dev libtiff-dev
              wget unzip
    runenvz: /usr/local/spm/bin/${LIBNAME}_${LIBVERSION}/runzlib_v1.2.5.sh
    runenvx: /usr/local/spm/bin/${LIBNAME}_${LIBVERSION}/runlibxml2_v2.9.1.sh
    POST_CXXFLAGS: "-Wno-undef"
  tags:
    - docker

# disabled due gitlab bug
.gcc-7_SDL_default_old_sanitize_test:
  stage: build
  script:
  - ./tools/ci/scripts/downloadlib.sh ${LIBNAME} ${LIBVERSION}
  - /usr/local/spm/bin/${LIBNAME}_${LIBVERSION}/runenv.sh ${runenvx} ${runenvz} ./tools/ci/jobs/gcc7_sanitize_tests.sh --enable-unittests=yes --with-sdl2 --without-manaplusgame --without-dyecmd
  - /usr/local/spm/bin/${LIBNAME}_${LIBVERSION}/runenv.sh ${runenvx} ${runenvz} ./tools/ci/scripts/checkldd.sh src/manaplustests
  - ldd ./src/manaplustests | grep "libasan"
  <<: *job-push
  variables:
    LIBNAME: SDL
    LIBVERSION: default_old
    PACKAGES: gcc-7 g++-7 
              make autoconf automake autopoint gettext pkg-config 
              libx11-dev libxext-dev libxt-dev libxv-dev x11proto-core-dev libgl1-mesa-dev libasound2-dev libicu-dev 
              valgrind 
              libjpeg-dev libtiff-dev
              wget unzip
    runenvz: /usr/local/spm/bin/${LIBNAME}_${LIBVERSION}/runzlib_v1.2.5.sh
    runenvx: /usr/local/spm/bin/${LIBNAME}_${LIBVERSION}/runlibxml2_v2.9.1.sh
    POST_CXXFLAGS: "-Wno-undef"
  tags:
    - docker

gcc-7_tests_simd:
  stage: build
  script:
  - ./tools/ci/jobs/gcc7_tests_simd.sh --without-dyecmd --without-manaplusgame
  <<: *job-push
  variables:
    PACKAGES: gcc-7 g++-7 
              make autoconf automake autopoint gettext 
              libxml2-dev libcurl4-gnutls-dev libpng-dev 
              libsdl-gfx1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev 
              valgrind
  tags:
    - docker

gcc-7_tests_O0:
  stage: build
  script:
  - ./tools/ci/jobs/gcc7_tests_simd.sh --without-dyecmd --without-manaplusgame
  <<: *job-push
  variables:
    POST_CXXFLAGS: "-O0"
    PACKAGES: gcc-7 g++-7 
              make autoconf automake autopoint gettext 
              libxml2-dev libcurl4-gnutls-dev libpng-dev 
              libsdl-gfx1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev 
              valgrind
  tags:
    - docker

gcc-7_tests_O1:
  stage: build
  script:
  - ./tools/ci/jobs/gcc7_tests_simd.sh --without-dyecmd --without-manaplusgame
  <<: *job-push
  variables:
    POST_CXXFLAGS: "-O1"
    PACKAGES: gcc-7 g++-7 
              make autoconf automake autopoint gettext 
              libxml2-dev libcurl4-gnutls-dev libpng-dev 
              libsdl-gfx1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev 
              valgrind
  tags:
    - docker

gcc-7_tests_lto:
  stage: build
  script:
  - ./tools/ci/jobs/gcc7_tests.sh --without-dyecmd --without-manaplusgame
  <<: *job-push
  variables:
    POST_CXXFLAGS: "-ffast-math -O9 -flto -fwhole-program -funswitch-loops"
    PACKAGES: gcc-7 g++-7 
              make autoconf automake autopoint gettext 
              libxml2-dev libcurl4-gnutls-dev libpng-dev 
              libsdl-gfx1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev 
              valgrind
  tags:
    - docker

gcc-7_tests_lto_i386:
  stage: build
  script:
  - ./tools/ci/jobs/gcc7_tests.sh --without-dyecmd --without-manaplusgame
  <<: *job-push
  image: vicamo/debian:sid-i386
  variables:
    POST_CXXFLAGS: "-ffast-math -O9 -flto -fwhole-program -funswitch-loops"
    PACKAGES: gcc-7 g++-7 
              make autoconf automake autopoint gettext 
              libxml2-dev libcurl4-gnutls-dev libpng-dev 
              libsdl-gfx1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev 
              valgrind
  tags:
    - docker

gcc-7_tests_gcov:
  stage: build
  script:
  - ./tools/ci/jobs/gcc7_tests_gcov.sh --without-dyecmd --without-manaplusgame
  <<: *job-push
  variables:
    PACKAGES: gcc-7 g++-7 
              make autoconf automake autopoint gettext 
              libxml2-dev libcurl4-gnutls-dev libpng-dev 
              libsdl-gfx1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev 
              gcovr 
              valgrind
  tags:
    - docker

gcc-7_tests_i386:
  stage: build
  script:
  - ./tools/ci/jobs/gcc7_tests.sh --without-dyecmd --without-manaplusgame
  image: vicamo/debian:sid-i386
  <<: *job-push
  variables:
    PACKAGES: gcc-7 g++-7 
              make autoconf automake autopoint gettext 
              libxml2-dev libcurl4-gnutls-dev libpng-dev 
              libsdl-gfx1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev 
              valgrind
  tags:
    - docker

gcc-7_tests:
  stage: build
  script:
  - ./tools/ci/jobs/gcc7_tests.sh --without-dyecmd --without-manaplusgame --enable-glibcdebug
  - ./tools/ci/jobs/gcc7_tests.sh --without-dyecmd --without-manaplusgame --enable-stldebug
  <<: *job-push
  variables:
    PACKAGES: gcc-7 g++-7 
              make autoconf automake autopoint gettext 
              libxml2-dev libcurl4-gnutls-dev libpng-dev 
              libsdl-gfx1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev 
              valgrind
  tags:
    - docker

gcc-7_tests_glibcdebug_i386:
  stage: build
  script:
  - ./tools/ci/jobs/gcc7_tests.sh --without-dyecmd --without-manaplusgame --enable-glibcdebug
  image: vicamo/debian:sid-i386
  <<: *job-push
  variables:
    PACKAGES: gcc-7 g++-7 
              make autoconf automake autopoint gettext 
              libxml2-dev libcurl4-gnutls-dev libpng-dev 
              libsdl-gfx1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev 
              valgrind
  tags:
    - docker

gcc-7_sdl2_tests_gcov:
  stage: build
  script:
  - ./tools/ci/jobs/gcc7_sdl2_tests_gcov.sh --without-dyecmd --without-manaplusgame
  <<: *job-push
  variables:
    PACKAGES: gcc-7 g++-7 
              make autoconf automake autopoint gettext 
              libxml2-dev libcurl4-gnutls-dev libpng-dev 
              libsdl2-dev libsdl2-gfx-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-net-dev libsdl2-ttf-dev 
              gcovr
              valgrind
  tags:
    - docker

gcc-7_sdl2_tests_i386:
  stage: build
  script:
  - ./tools/ci/jobs/gcc7_tests.sh --with-sdl2 --without-dyecmd --without-manaplusgame
  image: vicamo/debian:sid-i386
  <<: *job-push
  variables:
    PACKAGES: gcc-7 g++-7 
              make autoconf automake autopoint gettext 
              libxml2-dev libcurl4-gnutls-dev libpng-dev 
              libsdl2-dev libsdl2-gfx-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-net-dev libsdl2-ttf-dev 
              valgrind
  tags:
    - docker

gcc-7_tests_valgrind:
  stage: build
  script:
  - ./tools/ci/jobs/gcc7_tests.sh --without-dyecmd --without-manaplusgame || true
  - echo test valgrind
  - valgrind -q --read-var-info=yes --track-origins=yes --malloc-fill=11 --free-fill=55 --show-reachable=yes --leak-check=full --leak-resolution=high --partial-loads-ok=yes --error-limit=no ./src/manaplustests 2>logs/valg.log
  - grep "invalid" logs/valg.log && exit 1 || true
  <<: *job-push
  variables:
    PACKAGES: gcc-7 g++-7 
              make autoconf automake autopoint gettext 
              libxml2-dev libcurl4-gnutls-dev libpng-dev 
              libsdl-gfx1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev 
              valgrind
  tags:
    - docker

gcc-7_tests_valgrind_i386:
  stage: build
  script:
  - ./tools/ci/jobs/gcc7_tests.sh --without-dyecmd --without-manaplusgame || true
  - echo test valgrind
  - valgrind -q --read-var-info=yes --track-origins=yes --malloc-fill=11 --free-fill=55 --show-reachable=yes --leak-check=full --leak-resolution=high --partial-loads-ok=yes --error-limit=no ./src/manaplustests 2>logs/valg.log
  - grep "invalid" logs/valg.log && exit 1 || true
  image: vicamo/debian:sid-i386
  <<: *job-push
  variables:
    PACKAGES: gcc-7 g++-7 
              make autoconf automake autopoint gettext 
              libxml2-dev libcurl4-gnutls-dev libpng-dev 
              libsdl-gfx1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev 
              valgrind
  tags:
    - docker

gcc-7_separate_doctest:
  stage: build
  script:
  - ./tools/ci/jobs/gcc7_silent.sh --enable-unittestsbin=doctest --without-manaplusgame --without-dyecmd
  - ./tools/ci/scripts/separateunittests.sh
  <<: *job-push
  variables:
    PACKAGES: gcc-7 g++-7 
              make autoconf automake autopoint gettext 
              libxml2-dev libcurl4-gnutls-dev libpng-dev 
              libsdl-gfx1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev 
              python

# disabled due kernel issue in shared runners.
.gcc-7_separate_doctest_sanitize:
  stage: build
  script:
  - ./tools/ci/jobs/gcc7_silent.sh --enable-unittestsbin=doctest --without-manaplusgame --without-dyecmd
  - ./tools/ci/scripts/separateunittests.sh
  - ldd ./src/manaplustests | grep "libasan"
  <<: *job-push
  variables:
    LSAN_OPTIONS: "suppressions=./tools/ci/scripts/lsansuppression_tests.txt"
    POST_CXXFLAGS: "-fsanitize=address -fsanitize=undefined
                    -fsanitize=shift -fsanitize=integer-divide-by-zero -fsanitize=unreachable
                    -fsanitize=vla-bound -fsanitize=null -fsanitize=return
                    -fsanitize=signed-integer-overflow -fsanitize=bounds -fsanitize=alignment
                    -fsanitize=object-size -fsanitize=float-divide-by-zero -fsanitize=float-cast-overflow
                    -fsanitize=nonnull-attribute -fsanitize=returns-nonnull-attribute -fsanitize=bool
                    -fsanitize=enum -fsanitize=vptr -fsanitize=bounds-strict"
    PACKAGES: gcc-7 g++-7 
              make autoconf automake autopoint gettext 
              libxml2-dev libcurl4-gnutls-dev libpng-dev 
              libsdl-gfx1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev 
              python
  tags:
    - docker

# disabled due kernel issue in shared runners.
.gcc-7_separate_doctest_sanitize_sdl2:
  stage: build
  script:
  - ./tools/ci/jobs/gcc7_silent.sh --enable-unittestsbin=doctest --without-manaplusgame --without-dyecmd --with-sdl2
  - ./tools/ci/scripts/separateunittests.sh
  - ldd ./src/manaplustests | grep "libasan"
  <<: *job-push
  variables:
    LSAN_OPTIONS: "suppressions=./tools/ci/scripts/lsansuppression_tests.txt"
    POST_CXXFLAGS: "-fsanitize=address -fsanitize=undefined
                    -fsanitize=shift -fsanitize=integer-divide-by-zero -fsanitize=unreachable
                    -fsanitize=vla-bound -fsanitize=null -fsanitize=return
                    -fsanitize=signed-integer-overflow -fsanitize=bounds -fsanitize=alignment
                    -fsanitize=object-size -fsanitize=float-divide-by-zero -fsanitize=float-cast-overflow
                    -fsanitize=nonnull-attribute -fsanitize=returns-nonnull-attribute -fsanitize=bool
                    -fsanitize=enum -fsanitize=vptr -fsanitize=bounds-strict"
    PACKAGES: gcc-7 g++-7 
              make autoconf automake autopoint gettext 
              libxml2-dev libcurl4-gnutls-dev libpng-dev 
              libsdl2-gfx-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-net-dev libsdl2-ttf-dev
              python
  tags:
    - docker

gcc-7_separate_doctest_sanitize_i386:
  stage: build
  script:
  - ./tools/ci/jobs/gcc7_silent.sh --enable-unittestsbin=doctest --without-manaplusgame --without-dyecmd
  - ./tools/ci/scripts/separateunittests.sh
  - ldd ./src/manaplustests | grep "libasan"
  <<: *job-push
  image: vicamo/debian:sid-i386
  variables:
    LSAN_OPTIONS: "suppressions=./tools/ci/scripts/lsansuppression_tests.txt"
    POST_CXXFLAGS: "-fsanitize=address -fsanitize=undefined
                    -fsanitize=shift -fsanitize=integer-divide-by-zero -fsanitize=unreachable
                    -fsanitize=vla-bound -fsanitize=null -fsanitize=return
                    -fsanitize=signed-integer-overflow -fsanitize=bounds -fsanitize=alignment
                    -fsanitize=object-size -fsanitize=float-divide-by-zero -fsanitize=float-cast-overflow
                    -fsanitize=nonnull-attribute -fsanitize=returns-nonnull-attribute -fsanitize=bool
                    -fsanitize=enum -fsanitize=vptr -fsanitize=bounds-strict"
    PACKAGES: gcc-7 g++-7 
              make autoconf automake autopoint gettext 
              libxml2-dev libcurl4-gnutls-dev libpng-dev 
              libsdl-gfx1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev 
              python
  tags:
    - docker

gcc-7_separate_doctest_sanitize_sdl2_i386:
  stage: build
  script:
  - ./tools/ci/jobs/gcc7_silent.sh --enable-unittestsbin=doctest --without-manaplusgame --without-dyecmd --with-sdl2
  - ./tools/ci/scripts/separateunittests.sh
  - ldd ./src/manaplustests | grep "libasan"
  <<: *job-push
  image: vicamo/debian:sid-i386
  variables:
    LSAN_OPTIONS: "suppressions=./tools/ci/scripts/lsansuppression_tests.txt"
    POST_CXXFLAGS: "-fsanitize=address -fsanitize=undefined
                    -fsanitize=shift -fsanitize=integer-divide-by-zero -fsanitize=unreachable
                    -fsanitize=vla-bound -fsanitize=null -fsanitize=return
                    -fsanitize=signed-integer-overflow -fsanitize=bounds -fsanitize=alignment
                    -fsanitize=object-size -fsanitize=float-divide-by-zero -fsanitize=float-cast-overflow
                    -fsanitize=nonnull-attribute -fsanitize=returns-nonnull-attribute -fsanitize=bool
                    -fsanitize=enum -fsanitize=vptr -fsanitize=bounds-strict"
    PACKAGES: gcc-7 g++-7 
              make autoconf automake autopoint gettext 
              libxml2-dev libcurl4-gnutls-dev libpng-dev 
              libsdl2-gfx-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-net-dev libsdl2-ttf-dev
              python
  tags:
    - docker

gcc-7_lto:
  stage: build
  script:
  - ./tools/ci/jobs/gcc7_lto.sh
  - ./tools/ci/scripts/runtests.sh
  <<: *job-push
  variables:
    PACKAGES: gcc-7 g++-7 
              make autoconf automake autopoint gettext 
              libxml2-dev libcurl4-gnutls-dev libpng-dev 
              libsdl-gfx1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev
              gdb valgrind netcat-openbsd procps
    POST_CXXFLAGS: "-Wno-null-dereference"

gcc-7_lto_i386:
  stage: build
  script:
  - ./tools/ci/jobs/gcc7_lto.sh
  - ./tools/ci/scripts/runtests.sh
  image: vicamo/debian:sid-i386
  <<: *job-push
  variables:
    PACKAGES: gcc-7 g++-7 
              make autoconf automake autopoint gettext 
              libxml2-dev libcurl4-gnutls-dev libpng-dev 
              libsdl-gfx1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev
              gdb valgrind netcat-openbsd procps
    POST_CXXFLAGS: "-Wno-null-dereference"
  tags:
    - docker

gcc-7_glibcdebug:
  stage: build
  script:
  - ./tools/ci/jobs/gcc7.sh --enable-glibcdebug --without-dyecmd
  - ./tools/ci/scripts/runtests.sh
  <<: *job-push
  variables:
    PACKAGES: gcc-7 g++-7 
              make autoconf automake autopoint gettext 
              libxml2-dev libcurl4-gnutls-dev libpng-dev 
              libsdl-gfx1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev
              gdb valgrind netcat-openbsd procps

gcc-7_glibcdebug_i386:
  stage: build
  script:
  - ./tools/ci/jobs/gcc7.sh --enable-glibcdebug --without-dyecmd
  - ./tools/ci/scripts/runtests.sh
  <<: *job-push
  image: vicamo/debian:sid-i386
  variables:
    PACKAGES: gcc-7 g++-7 
              make autoconf automake autopoint gettext 
              libxml2-dev libcurl4-gnutls-dev libpng-dev 
              libsdl-gfx1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev
              gdb valgrind netcat-openbsd procps

gcc-7_glibcdebug_sdl2:
  stage: build
  script:
  - ./tools/ci/jobs/gcc7.sh --with-sdl2 --enable-glibcdebug --without-dyecmd
  - ./tools/ci/scripts/runtests.sh
  <<: *job-push
  variables:
    PACKAGES: gcc-7 g++-7 
              make autoconf automake autopoint gettext 
              libxml2-dev libcurl4-gnutls-dev libpng-dev 
              libsdl2-gfx-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-net-dev libsdl2-ttf-dev
              gdb valgrind netcat-openbsd procps

gcc-7_glibcdebug_sdl2_i386:
  stage: build
  script:
  - ./tools/ci/jobs/gcc7.sh --with-sdl2 --enable-glibcdebug --without-dyecmd
  - ./tools/ci/scripts/runtests.sh
  <<: *job-push
  image: vicamo/debian:sid-i386
  variables:
    PACKAGES: gcc-7 g++-7 
              make autoconf automake autopoint gettext 
              libxml2-dev libcurl4-gnutls-dev libpng-dev 
              libsdl2-gfx-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-net-dev libsdl2-ttf-dev
              gdb valgrind netcat-openbsd procps

# simple builds

gcc-gentoo_sdl1:
  stage: build
  script:
  - ./tools/ci/jobs/any_compiler.sh --enable-werror
  - ./tools/ci/scripts/runtests.sh
  image: registry.gitlab.com/manaplus/images:gentoo_gcc_sdl1
  <<: *job-push
  variables:
    LOGFILE: gcc.log
    CC: gcc
    CXX: g++
    CXXFLAGS: "-Wall -Wextra"
    PMUPDATE: "echo"
    PMINSTALL: "echo"
  tags:
    - docker

gcc-gentoo_sdl2:
  stage: build
  script:
  - ./tools/ci/jobs/any_compiler.sh --with-sdl2 --enable-werror
  - ./tools/ci/scripts/runtests.sh
  image: registry.gitlab.com/manaplus/images:gentoo_gcc_sdl2
  <<: *job-push
  variables:
    LOGFILE: gcc.log
    CC: gcc
    CXX: g++
    CXXFLAGS: "-Wall -Wextra"
    PMUPDATE: "echo"
    PMINSTALL: "echo"
  tags:
    - docker

gcc-3_sdl1:
  stage: build
  script:
  - ./tools/ci/jobs/gcc3.sh
  - ./tools/ci/scripts/runtests.sh
  image: registry.gitlab.com/manaplus/images:gentoo_gcc3_sdl1
  <<: *job-push
  variables:
    PMUPDATE: "echo"
    PMINSTALL: "echo"
  tags:
    - docker

gcc-3_sdl2:
  stage: build
  script:
  - ./tools/ci/jobs/gcc3.sh --with-sdl2
  - ./tools/ci/scripts/runtests.sh
  image: registry.gitlab.com/manaplus/images:gentoo_gcc3_sdl2
  <<: *job-push
  variables:
    PMUPDATE: "echo"
    PMINSTALL: "echo"
  tags:
    - docker

gcc-7_all_and_unittestsbin:
  stage: build
  script:
  - ./tools/ci/jobs/gcc7_silent.sh --enable-unittestsbin
  - ./tools/ci/scripts/runtests.sh
  <<: *job-push
  variables:
    PACKAGES: gcc-7 g++-7 
              make autoconf automake autopoint gettext 
              libxml2-dev libcurl4-gnutls-dev libpng-dev 
              libsdl-gfx1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev
              gdb valgrind netcat-openbsd procps

gcc7_memdebug_sdl1:
  stage: build
  script:
  - ./tools/ci/jobs/gcc7.sh --enable-memdebug --enable-werror
  <<: *job-push
  variables:
    PACKAGES: gcc-7 g++-7 
              make autoconf automake autopoint gettext 
              libxml2-dev libcurl4-gnutls-dev libpng-dev 
              libsdl-gfx1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev

gcc7_memdebug_sdl2:
  stage: build
  script:
  - ./tools/ci/jobs/gcc7.sh --with-sdl2 --enable-memdebug --enable-werror
  <<: *job-push
  variables:
    PACKAGES: gcc-7 g++-7 
              make autoconf automake autopoint gettext 
              libxml2-dev libcurl4-gnutls-dev libpng-dev 
              libsdl2-gfx-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-net-dev libsdl2-ttf-dev

gcc7_googleprofiler_sdl1:
  stage: build
  script:
  - ./tools/ci/jobs/gcc7.sh --enable-googleprofiler --enable-werror
  - ./tools/ci/scripts/runtests.sh
  <<: *job-push
  variables:
    PACKAGES: gcc-7 g++-7 
              make autoconf automake autopoint gettext 
              libxml2-dev libcurl4-gnutls-dev libpng-dev 
              libsdl-gfx1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev
              gdb valgrind netcat-openbsd procps libgoogle-perftools-dev

gcc7_googleprofiler_sdl2:
  stage: build
  script:
  - ./tools/ci/jobs/gcc7.sh --with-sdl2 --enable-googleprofiler --enable-werror
  - ./tools/ci/scripts/runtests.sh
  <<: *job-push
  variables:
    PACKAGES: gcc-7 g++-7 
              make autoconf automake autopoint gettext 
              libxml2-dev libcurl4-gnutls-dev libpng-dev 
              libsdl2-gfx-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-net-dev libsdl2-ttf-dev
              gdb valgrind netcat-openbsd procps libgoogle-perftools-dev

gcc7_checks_sdl1:
  stage: build
  script:
  - ./tools/ci/jobs/gcc7.sh --enable-checks --enable-werror
  - ./tools/ci/scripts/runtests.sh
  <<: *job-push
  variables:
    PACKAGES: gcc-7 g++-7 
              make autoconf automake autopoint gettext 
              libxml2-dev libcurl4-gnutls-dev libpng-dev 
              libsdl-gfx1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev
              gdb valgrind netcat-openbsd procps

gcc7_checks_sdl2:
  stage: build
  script:
  - ./tools/ci/jobs/gcc7.sh --with-sdl2 --enable-checks --enable-werror
  - ./tools/ci/scripts/runtests.sh
  <<: *job-push
  variables:
    PACKAGES: gcc-7 g++-7 
              make autoconf automake autopoint gettext 
              libxml2-dev libcurl4-gnutls-dev libpng-dev 
              libsdl2-gfx-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-net-dev libsdl2-ttf-dev
              gdb valgrind netcat-openbsd procps

gcc7_without_mumble_sdl1:
  stage: build
  script:
  - ./tools/ci/jobs/gcc7.sh --without-mumble --enable-werror
  - ./tools/ci/scripts/runtests.sh
  <<: *job-push
  variables:
    PACKAGES: gcc-7 g++-7 
              make autoconf automake autopoint gettext 
              libxml2-dev libcurl4-gnutls-dev libpng-dev 
              libsdl-gfx1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev
              gdb valgrind netcat-openbsd procps

gcc7_without_mumble_sdl2:
  stage: build
  script:
  - ./tools/ci/jobs/gcc7.sh --with-sdl2 --without-mumble --enable-werror
  - ./tools/ci/scripts/runtests.sh
  <<: *job-push
  variables:
    PACKAGES: gcc-7 g++-7 
              make autoconf automake autopoint gettext 
              libxml2-dev libcurl4-gnutls-dev libpng-dev 
              libsdl2-gfx-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-net-dev libsdl2-ttf-dev
              gdb valgrind netcat-openbsd procps

gcc-7_cilkplus:
  stage: build
  script:
  - ./tools/ci/jobs/gcc7.sh --enable-cilkplus
  - ./tools/ci/scripts/runtests.sh
  <<: *job-push
  variables:
    PACKAGES: gcc-7 g++-7 
              make autoconf automake autopoint gettext 
              libxml2-dev libcurl4-gnutls-dev libpng-dev 
              libsdl-gfx1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev
              gdb valgrind netcat-openbsd procps

gcc_portable:
  stage: build
  script:
  - ./tools/ci/jobs/gcc7.sh --with-opengl --enable-tmwa --enable-portable=yes
  - ./tools/ci/scripts/runtests.sh
  <<: *job-push
  variables:
    PACKAGES: gcc-7 g++-7 
              make autoconf automake autopoint gettext 
              libxml2-dev libcurl4-gnutls-dev libpng-dev 
              libsdl-gfx1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev
              gdb valgrind netcat-openbsd procps

gcc-7_no_asserts:
  stage: build
  script:
  - ./tools/ci/jobs/gcc7.sh --disable-asserts
  - ./tools/ci/scripts/runtests.sh
  <<: *job-push
  variables:
    PACKAGES: gcc-7 g++-7 
              make autoconf automake autopoint gettext 
              libxml2-dev libcurl4-gnutls-dev libpng-dev 
              libsdl-gfx1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev
              gdb valgrind netcat-openbsd procps

gcc-7_default_i386:
  stage: build
  script:
  - ./tools/ci/jobs/any_compiler.sh --enable-werror
  - ./tools/ci/scripts/runtests.sh
  <<: *job-push
  image: vicamo/debian:sid-i386
  variables:
    LOGFILE: gcc7.log
    CC: gcc-7
    CXX: g++-7
    CXXFLAGS: "-Wall -Wextra"
    PACKAGES: gcc-7 g++-7 
              make autoconf automake autopoint gettext 
              libxml2-dev libcurl4-gnutls-dev libpng-dev 
              libsdl-gfx1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev
              gdb valgrind netcat-openbsd procps
  tags:
    - docker

# error compilation. cant find SDL.
.gcc-7_zlib_ng_develop:
  stage: build
  script:
  - ./tools/ci/scripts/downloadlib.sh ${LIBNAME} ${LIBVERSION}
  - /usr/local/spm/bin/${LIBNAME}_${LIBVERSION}/runenv.sh ./tools/ci/jobs/gcc7.sh
  - /usr/local/spm/bin/${LIBNAME}_${LIBVERSION}/runenv.sh ./tools/ci/scripts/checkldd.sh src/manaplus
  - /usr/local/spm/bin/${LIBNAME}_${LIBVERSION}/runenv.sh ./tools/ci/scripts/runtests.sh
  <<: *job-push
  variables:
    LIBNAME: zlib_ng
    LIBVERSION: develop
    PACKAGES: gcc-7 g++-7 
              make autoconf automake autopoint gettext 
              libxml2-dev libcurl4-gnutls-dev libpng-dev 
              libsdl-gfx1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev
              wget unzip gdb valgrind netcat-openbsd procps
  tags:
    - docker

# disabled due gitlab bug
.gcc-7_SDL_SDL-1.2_sanitize:
  stage: build
  script:
  - ./tools/ci/scripts/downloadlib.sh ${LIBNAME} ${LIBVERSION}
  - echo /usr/local/spm/bin/${LIBNAME}_${LIBVERSION}/runenv.sh ${runenvz}
  - /usr/local/spm/bin/${LIBNAME}_${LIBVERSION}/runenv.sh ${runenvx} ${runenvz} env
  - /usr/local/spm/bin/${LIBNAME}_${LIBVERSION}/runenv.sh ${runenvx} ${runenvz} ./tools/ci/jobs/gcc7_sanitize.sh
  - /usr/local/spm/bin/${LIBNAME}_${LIBVERSION}/runenv.sh ${runenvx} ${runenvz} ./tools/ci/scripts/runtests.sh
  - ldd ./src/manaplus | grep "libasan"
  <<: *job-push
  variables:
    LIBNAME: SDL
    LIBVERSION: SDL-1.2
    PACKAGES: gcc-7 g++-7 
              make autoconf automake autopoint gettext pkg-config 
              libx11-dev libxext-dev libxt-dev libxv-dev x11proto-core-dev libgl1-mesa-dev libasound2-dev libglu1-mesa-dev libicu-dev 
              valgrind netcat-openbsd
              wget unzip
    runenvz: /usr/local/spm/bin/${LIBNAME}_${LIBVERSION}/runzlib_master.sh
    runenvx: /usr/local/spm/bin/${LIBNAME}_${LIBVERSION}/runlibxml2_master.sh
  tags:
    - docker

# disabled due gitlab bug
.gcc-7_SDL_default_sanitize:
  stage: build
  script:
  - ./tools/ci/scripts/downloadlib.sh ${LIBNAME} ${LIBVERSION}
  - /usr/local/spm/bin/${LIBNAME}_${LIBVERSION}/runenv.sh ${runenvx} ${runenvz} ./tools/ci/jobs/gcc7_sanitize.sh --with-sdl2
  - /usr/local/spm/bin/${LIBNAME}_${LIBVERSION}/runenv.sh ${runenvx} ${runenvz} ./tools/ci/scripts/runtests.sh
  - ldd ./src/manaplus | grep "libasan"
  <<: *job-push
  variables:
    LIBNAME: SDL
    LIBVERSION: default
    PACKAGES: gcc-7 g++-7 
              make autoconf automake autopoint gettext pkg-config 
              libx11-dev libxext-dev libxt-dev libxv-dev x11proto-core-dev libgl1-mesa-dev libasound2-dev libicu-dev 
              valgrind netcat-openbsd
              wget unzip
    runenvz: /usr/local/spm/bin/${LIBNAME}_${LIBVERSION}/runzlib_master.sh
    runenvx: /usr/local/spm/bin/${LIBNAME}_${LIBVERSION}/runlibxml2_master.sh
  tags:
    - docker


# disabled due gitlab bug
.gcc-7_SDL_SDL-1.2_old_sanitize:
  stage: build
  script:
  - ./tools/ci/scripts/downloadlib.sh ${LIBNAME} ${LIBVERSION}
  - echo /usr/local/spm/bin/${LIBNAME}_${LIBVERSION}/runenv.sh ${runenvz}
  - /usr/local/spm/bin/${LIBNAME}_${LIBVERSION}/runenv.sh ${runenvx} ${runenvz} env
  - /usr/local/spm/bin/${LIBNAME}_${LIBVERSION}/runenv.sh ${runenvx} ${runenvz} ./tools/ci/jobs/gcc7_sanitize.sh
  - /usr/local/spm/bin/${LIBNAME}_${LIBVERSION}/runenv.sh ${runenvx} ${runenvz} ./tools/ci/scripts/runtests.sh
  - ldd ./src/manaplus | grep "libasan"
  <<: *job-push
  variables:
    LIBNAME: SDL
    LIBVERSION: SDL-1.2_old
    PACKAGES: gcc-7 g++-7 
              make autoconf automake autopoint gettext pkg-config 
              libx11-dev libxext-dev libxt-dev libxv-dev x11proto-core-dev libgl1-mesa-dev libasound2-dev libglu1-mesa-dev libicu-dev 
              valgrind netcat-openbsd
              libjpeg-dev libtiff-dev
              wget unzip
    runenvz: /usr/local/spm/bin/${LIBNAME}_${LIBVERSION}/runzlib_v1.2.5.sh
    runenvx: /usr/local/spm/bin/${LIBNAME}_${LIBVERSION}/runlibxml2_v2.9.1.sh
    POST_CXXFLAGS: "-Wno-undef"
  tags:
    - docker

# disabled due gitlab bug
.gcc-7_SDL_default_old_sanitize:
  stage: build
  script:
  - ./tools/ci/scripts/downloadlib.sh ${LIBNAME} ${LIBVERSION}
  - /usr/local/spm/bin/${LIBNAME}_${LIBVERSION}/runenv.sh ${runenvx} ${runenvz} ./tools/ci/jobs/gcc7_sanitize.sh --with-sdl2
  - /usr/local/spm/bin/${LIBNAME}_${LIBVERSION}/runenv.sh ${runenvx} ${runenvz} ./tools/ci/scripts/runtests.sh
  - ldd ./src/manaplus | grep "libasan"
  <<: *job-push
  variables:
    LIBNAME: SDL
    LIBVERSION: default_old
    PACKAGES: gcc-7 g++-7 
              make autoconf automake autopoint gettext pkg-config 
              libx11-dev libxext-dev libxt-dev libxv-dev x11proto-core-dev libgl1-mesa-dev libasound2-dev libicu-dev 
              valgrind netcat-openbsd
              libjpeg-dev libtiff-dev
              wget unzip
    runenvz: /usr/local/spm/bin/${LIBNAME}_${LIBVERSION}/runzlib_v1.2.5.sh
    runenvx: /usr/local/spm/bin/${LIBNAME}_${LIBVERSION}/runlibxml2_v2.9.1.sh
    POST_CXXFLAGS: "-Wno-undef"
  tags:
    - docker

gcc-7_openglerrors_i386:
  stage: build
  script:
  - ./tools/ci/jobs/gcc7.sh --enable-openglerrors
  - ./tools/ci/scripts/runtests.sh
  <<: *job-push
  image: vicamo/debian:sid-i386
  variables:
    PACKAGES: gcc-7 g++-7 
              make autoconf automake autopoint gettext 
              libxml2-dev libcurl4-gnutls-dev libpng-dev 
              libsdl-gfx1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev
              gdb valgrind netcat-openbsd procps

gcc-7_openglerrors:
  stage: build
  script:
  - ./tools/ci/jobs/gcc7.sh --enable-openglerrors
  - ./tools/ci/scripts/runtests.sh
  <<: *job-push
  variables:
    PACKAGES: gcc-7 g++-7 
              make autoconf automake autopoint gettext 
              libxml2-dev libcurl4-gnutls-dev libpng-dev 
              libsdl-gfx1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev
              gdb valgrind netcat-openbsd procps

doxygen:
  stage: build
  script:
  - ./tools/ci/jobs/doxygen.sh
  artifacts:
    paths:
    - doxygen
    expire_in: 3 week
    when: always
  dependencies: []
  variables:
    PACKAGES: doxygen graphviz 
              libxml2-dev libcurl4-gnutls-dev libpng-dev 
              libsdl-gfx1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev
  tags:
    - docker
  only:
    - master

gitstats:
  stage: build
  script:
  - ./tools/ci/jobs/gitstats.sh
  artifacts:
    paths:
    - stats
    expire_in: 3 week
    when: always
  dependencies: []
  variables:
    GIT_DEPTH: "100000"
    PACKAGES: python zlib1g git-core gnuplot
  tags:
    - docker
  only:
    - master

# stats

pages:
  stage: stats
  script:
  - ./tools/ci/jobs/pages.sh
  dependencies:
    - doxygen
    - gitstats
    - gcc-7_tests_gcov
    - gcc-7_sdl2_tests_gcov
  variables:
    PACKAGES: git-core python
  artifacts:
    paths:
    - public
    expire_in: 3 week
  only:
    - master