-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
171 lines (144 loc) · 5.5 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
default:
image: docker.sift.net/jharwell/rcppsw/ubuntu-22.04:latest
before_script:
# Run minimal bootstrap to get TICPP
- git clone https://gitlab-deploy-token:${BOOTSTRAP_DEPLOY_TOKEN}@git.sift.net/jharwell/bootstrap.git
- cd bootstrap
- ./bootstrap.sh
--rprefix=$HOME/.local
--rroot=.
--disablerepo rcsw
--disablerepo rcppsw
--disablerepo cosm
--disablerepo fordyca
--disablerepo argos
--disablerepo sierra
--disablerepo titerra
--force
- cd ..
# Install RCSW so RCPPSW can find it
- git clone https://oauth2:${JHARWELL_CI_TOKEN}@git.sift.net/jharwell/rcsw.git
- cd rcsw
- git checkout devel
- git submodule set-url libra ../libra.git
- git submodule sync --recursive
- git submodule foreach --recursive git fetch
- git submodule update --init
- mkdir build && cd build
- cmake
-DCMAKE_INSTALL_PREFIX=/usr/local
-DCMAKE_BUILD_TYPE=DEV
..
- JOBS=$(grep -c ^processor /proc/cpuinfo)
- make -j${JOBS} install
- cd ../..
# If all tests pass, deploy.
stages:
- build-and-test
- package-and-deploy
################################################################################
# Job to build and run tests
################################################################################
build-and-test:
tags:
- docker
stage: build-and-test
coverage: /Total:\|(\d+\.?\d+\%)/
script:
# Build RCPPSW
- git submodule set-url libra ../libra.git
- git submodule sync --recursive
- git submodule foreach --recursive git fetch
- git submodule update --init
- mkdir -p build && cd build
- cmake
-DCMAKE_INSTALL_PREFIX=/usr/local
-DCMAKE_BUILD_TYPE=DEV
-DRCPPSW_AL_MT_SAFE_TYPES=YES
-DLIBRA_TESTS=yes
-DLIBRA_CODE_COV=YES
-DLIBRA_ER=ALL
..
# Run tests
- make build-and-test
- make coverage-report
- lcov --list coverage.info # put coverage on stdout so the regex will parse it
################################################################################
# Jobs to build and upload packages
################################################################################
package-and-deploy:
stage: package-and-deploy
tags:
- docker
only:
- master
- devel
script:
- git submodule set-url libra ../libra.git
- git submodule sync --recursive
- git submodule foreach --recursive git fetch
- git submodule update --init
- mkdir -p build && cd build
- cmake
-DCMAKE_INSTALL_PREFIX=/usr/local
-DCMAKE_BUILD_TYPE=DEV
-DLIBRA_ER=ALL
..
- JOBS=$(nproc)
- make -j${JOBS}
- make package
- VERSION_MAJOR=$(sed -nE 's/.*PROJECT_VERSION_MAJOR ([0-9]+).*/\1/p' ../cmake/project-local.cmake)
- VERSION_MINOR=$(sed -nE 's/.*PROJECT_VERSION_MINOR ([0-9]+).*/\1/p' ../cmake/project-local.cmake)
- VERSION_PATCH=$(sed -nE 's/.*PROJECT_VERSION_PATCH ([0-9]+).*/\1/p' ../cmake/project-local.cmake)
- PACKAGE_VERSION=$VERSION_MAJOR.$VERSION_MINOR.$VERSION_PATCH
- RCPPSW_DEB_PACKAGE=$(ls *.deb)
- RCPPSW_TGZ_PACKAGE=$(ls *.tar.gz)
- PACKAGE_REGISTRY_URL="${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/rcppsw/${PACKAGE_VERSION}"
- |
curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file ${RCPPSW_DEB_PACKAGE} ${PACKAGE_REGISTRY_URL}/${RCPPSW_DEB_PACKAGE}
- |
curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file ${RCPPSW_TGZ_PACKAGE} ${PACKAGE_REGISTRY_URL}/${RCPPSW_TGZ_PACKAGE}
- BETA_TAG_VERSION=${PACKAGE_VERSION}.beta
- BETA_TAG_MESSAGE="Development release ${BETA_TAG_VERSION}"
- git config --global user.email "${GITLAB_USER_EMAIL}"
- git config --global user.name "${GITLAB_USER_NAME}"
- git remote set-url origin https://oauth2:${JHARWELL_CI_TOKEN}@git.sift.net/${CI_PROJECT_PATH}
- git tag ${BETA_TAG_VERSION} -m "$BETA_TAG_MESSAGE"
- git push -o ci.skip origin ${BETA_TAG_VERSION} # don't trigger another run
- curl --location --output /usr/local/bin/release-cli "https://gitlab.com/api/v4/projects/gitlab-org%2Frelease-cli/packages/generic/release-cli/latest/release-cli-linux-amd64"
- chmod +x /usr/local/bin/release-cli
- echo "release-cli create --name "${BETA_TAG_MESSAGE}" --tag-name $CI_COMMIT_TAG --assets-link "{\"name\":\"${RCPPSW_TGZ_PACKAGE}\",\"url\":\"${PACKAGE_REGISTRY_URL}/${RCPPSW_TGZ_PACKAGE}\"}" --assets-link"{\"name\":\"${RCPPSW_DEB_PACKAGE}\",\"url\":\"${PACKAGE_REGISTRY_URL}/${RCPPSW_DEB_PACKAGE}\"}""
- release-cli
create
--name ${BETA_TAG_VERSION}
--tag-name ${BETA_TAG_VERSION}
--description "${BETA_TAG_MESSAGE}"
--assets-link "{\"name\":\"${RCPPSW_TGZ_PACKAGE}\",\"url\":\"${PACKAGE_REGISTRY_URL}/${RCPPSW_TGZ_PACKAGE}\"}"
--assets-link "{\"name\":\"${RCPPSW_DEB_PACKAGE}\",\"url\":\"${PACKAGE_REGISTRY_URL}/${RCPPSW_DEB_PACKAGE}\"}"
################################################################################
# Job to build documentation
################################################################################
pages:
stage: package-and-deploy
tags:
- docker
only:
- master
- devel
script:
- git submodule set-url libra ../libra.git
- git submodule sync --recursive
- git submodule foreach --recursive git fetch
- git submodule update --init
- mkdir -p build && cd build
- cmake
-DCMAKE_INSTALL_PREFIX=$HOME/.local
..
- make apidoc
- cd ..
- export PATH=$PATH:$HOME/.local/bin
- cd docs && make html && cd ..
- cp -r docs/_build/html/ ./public/
artifacts:
paths:
- public