File: Jenkinsfile

package info (click to toggle)
vecgeom 1.2.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 23,928 kB
  • sloc: cpp: 88,717; ansic: 6,894; python: 1,035; sh: 582; sql: 538; makefile: 29
file content (112 lines) | stat: -rw-r--r-- 4,062 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
//----------------------------------------------------------------------------------------------------------------------
// This declarative Jenkins pipeline encodes all the steps required for the nightly/continuous of a single platform.
// Other jobs may call this pipeline to execute the build, test and installation of a set platforms.
//
// Author: Pere Mato
//----------------------------------------------------------------------------------------------------------------------

pipeline {
  parameters {
    string(name: 'EXTERNALS', defaultValue: 'devgeantv/latest', description: 'LCG software stack in CVMFS')
    choice(name: 'MODE', choices: ['experimental', 'nightly', 'continuous'], description: 'CDash mode')
    string(name: 'ExtraCMakeOptions', defaultValue: '', description: 'CMake extra configuration options')
    string(name: 'LABEL', defaultValue: 'centos7', description: 'Jenkins label for physical nodes or container image for docker')
    choice(name: 'COMPILER', choices: ['gcc7', 'gcc8', 'gcc9', 'gcc10', 'clang8', 'clang10', 'native'])
    choice(name: 'BUILDTYPE', choices: ['Release', 'Debug'])
    choice(name: 'OPTION', choices: ['default', 'SPEC', 'AVX', 'GDML'])
    choice(name: 'BACKEND', choices: ['scalar', 'vc'])
    string(name: 'DOCKER_LABEL', defaultValue: 'docker-host-noafs', description: 'Label for the the nodes able to launch docker images')
    string(name: 'SourceBranch', defaultValue: 'master', description: 'Source branch in repository')
    string(name: 'TargetBranch', defaultValue: 'master', description: 'Target branch in repository')
    string(name: 'gitlabMergedByUser')
    string(name: 'gitlabMergeRequestIid')
  }

  environment {
    CMAKE_INSTALL_PREFIX = 'install'
    CMAKE_SOURCE_DIR     = 'vecgeom'
    CMAKE_BINARY_DIR     = 'build'
  }

  agent none

  stages {
    //------------------------------------------------------------------------------------------------------------------
    //---Build & Test stages--------------------------------------------------------------------------------------------
    //------------------------------------------------------------------------------------------------------------------
    stage('Prepa'){
      steps {
        init()
      }
    }
    stage('InDocker') {
      when {
        beforeAgent true
        expression { params.LABEL =~ 'centos|ubuntu' && !(params.LABEL =~ 'physical')}
      }
      agent {
        docker {
          image "gitlab-registry.cern.ch/sft/docker/$LABEL"
          label "$DOCKER_LABEL"
          args  """-v /cvmfs:/cvmfs 
                   -v /ccache:/ccache 
                   -v /ec:/ec
                   -e SHELL 
                   -e gitlabMergedByUser 
                   -e gitlabMergeRequestIid
                   --net=host
                   --hostname ${LABEL}-docker
                """
        }
      }
      stages {
        stage('Build&Test') {
          steps {
            buildAndTest()
          }
          post {
            success {
              deleteDir()
            }
          }
        }
      }
    }
    stage('InBareMetal') {
      when {
        beforeAgent true
        expression { params.LABEL =~ 'cuda|physical' }
      }
      agent {
        label "$LABEL"
      }
      stages {
        stage('Build&Test') {
          steps {
            buildAndTest()
          }
          post {
            success {
              deleteDir()
            }
          }
        }
      }
    }
  }
}

def init() {
  currentBuild.displayName = "#${BUILD_NUMBER}" + ' ' + params.OPTION + '-' + params.BACKEND + '-' + params.LABEL + '-' + params.COMPILER + '-' + params.BUILDTYPE
}

def buildAndTest() {
  sh label: 'build_and_test', script: """
    if [[ ${LABEL} =~ cuda ]]; then
        source /cvmfs/sft.cern.ch/lcg/contrib/cuda/11.4/x86_64-centos7/setup.sh
    fi
    source /cvmfs/sft.cern.ch/lcg/views/${EXTERNALS}/x86_64-centos7-${COMPILER}-opt/setup.sh
    env | sort | sed 's/:/:?     /g' | tr '?' '\n'
    ctest -VV -S vecgeom/jenkins/vecgeom-ctest.cmake,$MODE
  """
}