forked from key4hep/key4hep-spack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
126 lines (113 loc) · 4.26 KB
/
.gitlab-ci.yml
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# for compatibility with old git versions on centos
variables:
GIT_STRATEGY: clone
K4_JOBTYPE: Release
SPACK_VERSION: ""
stages:
- compilation
- deployment
### create an artifact with a pre-configured spack on each push
setup_spack_push:
stage: compilation
tags:
- k4-build-spack-nightlies
only:
refs:
- pushes
- merge_requests
- schedules
script:
# set up spack inside the k4-spack repo
- source scripts/ci_setup_spack.sh
artifacts:
paths:
- key4hep-spack_centos7-cvmfs.tar.gz
- key4hep-spack.tar.gz
expire_in: 1 week
#### Nightly build of key4hep-stack
# this job expects the following setup on the runner:
# * environment variables GITHUB_TOKEN and GITHUB_USER
# set in .bashrc or via gitlab ci - to be able to query the commits on github
# * (for the nightlies) existing installation of key4hep-stack (stable version) in /cvmfs/sw.hsf.org/spackages
# (or whatever is defined in upstreams.yaml)
# this may be read-only - could be delivered by cvmfs
# * writeable directory in /cvmfs/sw-nightlies.hsf.org
# (or whatever is defined in config.yaml)
#
# for the cvmfs deployment:
# * the gitlab-runner user must be able to ssh into the cvmfs publisher
# * the cvmfs publisher must be able to rsync with the build machine
build-spack-nightlies:
stage: compilation
tags:
- k4-build-spack-nightlies
only:
refs:
- schedules # Only execute this on scheduled "nightly" pipelines
variables:
- $K4_JOBTYPE == "Nightlies"
script:
# set up spack inside the k4-spack repo
- source scripts/ci_setup_spack.sh
- source spack/share/spack/setup-env.sh
- cp ${PWD}/spack/var/spack/repos/key4hep-spack/config/cvmfs_build/config-nightlies.yaml spack/etc/spack/config.yaml
- export K4_LATEST_SETUP_PATH=/cvmfs/sw-nightlies.hsf.org/spackages/latest/setup.sh
# compile onwards and upwards
- spack install --fail-fast --no-checksum key4hep-stack@master-`date -I`
### deploy the nightlies to cvmfs
deploy-cvmfs-nightlies:
stage: deployment
needs: ["build-spack-nightlies"]
tags:
- k4-build-spack-nightlies
only:
refs:
- schedules # Only execute this on scheduled "nightly" pipelines
variables:
- $K4_JOBTYPE == "Nightlies"
script:
- ssh [email protected] ' bash -c ./cvmfs_deploy.sh'
#### Release build of key4hep-stack
# this job expects the following setup on the runner:
# * writeable directory in /cvmfs/sw.hsf.org
# (or whatever is defined in config.yaml)
#
# for the cvmfs deployment:
# * the gitlab-runner user must be able to ssh into the cvmfs publisher
# * the cvmfs publisher must be able to rsync with the build machine
build-spack-release:
stage: compilation
tags:
- k4-build-spack-release
only:
refs:
- tags
- schedules # Only execute this on scheduled pipelines
variables:
- $K4_JOBTYPE == "Release"
script:
# set up spack inside the k4-spack repo
- source scripts/ci_setup_spack.sh
# get the right config files to the right places
- cp ${PWD}/spack/var/spack/repos/key4hep-spack/config/cvmfs_build/config.yaml spack/etc/spack/config.yaml
- rm spack/etc/spack/upstreams.yaml
- export K4_LATEST_SETUP_PATH=/cvmfs/sw.hsf.org/spackages/latest/setup.sh
# if this workflow has been started by a tag, use the tag version. if not, use todays date
- if [ -z "$CI_COMMIT_TAG" ]; then export K4STACK_VERSION=`date -I`; else export K4STACK_VERSION=$CI_COMMIT_TAG; fi
- if [ ! -z "$CI_BUILD_TAG" ]; then export K4STACK_VERSION=$CI_BUILD_TAG; fi
# compile onwards and upwards
- echo $K4STACK_VERSION
- spack install --fail-fast key4hep-stack@$K4STACK_VERSION
deploy-cvmfs-release:
stage: deployment
needs: ["build-spack-release"]
tags:
- k4-build-spack-release
only:
refs:
- tags
- schedules # Only execute this on scheduled "nightly" pipelines
variables:
- $K4_JOBTYPE == "Release"
script:
- ssh [email protected] ' bash -c ./cvmfs_deploy.sh'