-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path.gitlab-ci.yml
173 lines (152 loc) · 4.1 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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
stages:
- build
- test
- publish
#--------------------------
# Build templates
#--------------------------
.build-template: &build-template_definition
stage: build
script:
- ci/fedora-packages.sh
- ci/common-rpm-build.sh
- mkdir ${CI_JOB_NAME}
- cp -rv build/RPMS build/SRPMS ${CI_JOB_NAME}
- tree ${CI_JOB_NAME}
variables:
BRANCH: ${CI_COMMIT_REF_NAME}
artifacts:
paths:
- "$CI_JOB_NAME"
#--------------------------
# Build jobs
#--------------------------
alma8:
image: gitlab-registry.cern.ch/linuxsupport/alma8-base
<<: *build-template_definition
alma9:
image: gitlab-registry.cern.ch/linuxsupport/alma9-base
<<: *build-template_definition
fedora-39:
image: fedora:39
<<: *build-template_definition
fedora-40:
image: fedora:40
<<: *build-template_definition
fedora-rawhide:
image: fedora:rawhide
<<: *build-template_definition
allow_failure: true
when: manual
pypi:
stage: build
image: gitlab-registry.cern.ch/linuxsupport/alma9-base
when: manual
allow_failure: true
script:
- dnf install -y epel-release
- dnf install -y tree python3 python3-wheel python3-pypandoc
- python3 setup.py sdist
- cp -rv dist/ ${CI_JOB_NAME}
- tree ${CI_JOB_NAME}
artifacts:
paths:
- "$CI_JOB_NAME"
#--------------------------
# Test templates
#--------------------------
.test-template: &test-template_definition
stage: test
script:
- dnf install -y git
- PLATFORM=${CI_JOB_NAME%-*}
- ci/write-repo-file.sh
- dnf install -y ${PLATFORM}/RPMS/*/*.rpm
- shopt -s expand_aliases
- python --version &>/dev/null || alias python=python3
- python test/unit/creat_instance_all.py
variables:
BRANCH: ${CI_COMMIT_REF_NAME}
#--------------------------
# Test jobs
#--------------------------
alma8-test:
image: gitlab-registry.cern.ch/linuxsupport/alma8-base
needs:
- job: alma8
before_script:
- dnf install -y epel-release
<<: *test-template_definition
alma9-test:
image: gitlab-registry.cern.ch/linuxsupport/alma9-base
needs:
- job: alma9
before_script:
- dnf install -y epel-release
<<: *test-template_definition
fedora-39-test:
image: fedora:39
needs:
- job: fedora-39
<<: *test-template_definition
fedora-40-test:
image: fedora:40
needs:
- job: fedora-40
<<: *test-template_definition
#--------------------------
# Publish templates
#--------------------------
.publish-template: &publish-template_definition
stage: publish
image: gitlab-registry.cern.ch/eos/gitlab-eos/alma9:latest
dependencies:
- alma8
- alma9
- fedora-39
- fedora-40
- fedora-rawhide
script:
- automount
- cat "$repo_passwd" | kinit "$repo_user"
- |
for platform in alma8 alma9 fedora-39 fedora-40 fedora-rawhide; do
if [[ "${platform}" == "fedora-rawhide" ]] && [[ ! -d ${platform} ]] ; then
echo "Skipping ${platform} packages..." ;
continue ;
fi
packaging/gfal2-repo-manager.py --action add --base /eos/project-d/dmc/www/repos/ --ref ${CI_COMMIT_REF_NAME} --packages ${platform}/RPMS/*/*.rpm ${platform}/SRPMS/*
done
tags:
- docker-privileged-xl
retry: 2
#--------------------------
# Publish jobs
#--------------------------
rpms:
<<: *publish-template_definition
rules:
- if: '$CI_PROJECT_NAMESPACE != "dmc"'
when: never
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
when: never
- if: '$CI_COMMIT_REF_NAME == "develop" || $CI_COMMIT_TAG != null'
- if: '$CI_COMMIT_REF_NAME != "develop" && $CI_COMMIT_TAG == null'
when: manual
pypi-publish:
needs:
- job: pypi
stage: publish
image: gitlab-registry.cern.ch/linuxsupport/alma9-base
script:
- PLATFORM=${CI_JOB_NAME%-*}
- dnf install -y git python3 python3-pip
- python3 -m pip install --upgrade pip
- python3 -m pip install setuptools twine
- echo -e "[pypi]\nusername = __token__\npassword = ${PYPI_API_KEY}" > ~/.pypirc
- twine check ${PLATFORM}/*
- twine upload ${PLATFORM}/* --verbose
rules:
- if: '$CI_COMMIT_TAG != null'
when: manual
- when: never