-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
165 lines (157 loc) · 3.99 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
stages:
- build-ci
- build
- docker-build
- test
variables:
VCPKG_DEFAULT_BINARY_CACHE: $CI_PROJECT_DIR/.cache/vcpkg
build-ci:
stage: build-ci
image: docker:latest
tags: [fast]
services:
- docker:dind
before_script:
- docker login -u gitlab-ci-token -p ${CI_JOB_TOKEN} ${CI_REGISTRY}
script:
- docker build --pull -t $CI_REGISTRY_IMAGE/ci:$CI_COMMIT_REF_SLUG .devcontainer
- docker push $CI_REGISTRY_IMAGE/ci:$CI_COMMIT_REF_SLUG
only:
changes:
- .devcontainer/**/*
- vcpkg.json
# - .gitlab-ci.yml
build-storm-tape:debug:
stage: build
image: $CI_REGISTRY_IMAGE/ci:$CI_COMMIT_REF_SLUG
tags: [fast]
before_script:
- mkdir -p $VCPKG_DEFAULT_BINARY_CACHE
script:
- git config --global --add safe.directory $CI_PROJECT_DIR
- cmake --preset debug -DCPACK_RPM_BUILD_SOURCE_DIRS_PREFIX=/storm
- cmake --build build/debug --target package --parallel
- build/debug/tests/all.t
artifacts:
paths:
- build/debug/storm-tape-*.tar.gz
cache:
- key: $CI_JOB_NAME
paths:
- $VCPKG_DEFAULT_BINARY_CACHE
only:
changes:
- src/*
- test/**/*
- cmake/**/*
- docker/**/*
- CMakeLists.txt
- CMakePresets.json
- vcpkg.json
- .gitlab-ci.yml
build-storm-tape:release:
stage: build
image: $CI_REGISTRY_IMAGE/ci:$CI_COMMIT_REF_SLUG
tags: [fast]
before_script:
- mkdir -p $VCPKG_DEFAULT_BINARY_CACHE
script:
- git config --global --add safe.directory $CI_PROJECT_DIR
- cmake --preset release -DCPACK_RPM_BUILD_SOURCE_DIRS_PREFIX=/storm
- cmake --build build/release --target package --parallel
artifacts:
paths:
- build/release/storm-tape-*.tar.gz
cache:
- key: $CI_JOB_NAME
paths:
- $VCPKG_DEFAULT_BINARY_CACHE
only:
refs:
- tags
package-storm-tape:
stage: build
image: $CI_REGISTRY_IMAGE/ci:$CI_COMMIT_REF_SLUG
tags: [fast]
before_script:
- mkdir -p $VCPKG_DEFAULT_BINARY_CACHE
script:
- git config --global --add safe.directory $CI_PROJECT_DIR
- cmake -S . -B build/mc -G "Ninja Multi-Config" -DBUILD_TESTING=OFF -DCPACK_RPM_BUILD_SOURCE_DIRS_PREFIX=/storm
- cd build/mc
- cmake --build . --parallel --config Debug
- cmake --build . --parallel --config Release
- cpack -C "Debug;Release" -G RPM
artifacts:
paths:
- build/mc/storm-tape-*.rpm
cache:
- key: $CI_JOB_NAME
paths:
- $VCPKG_DEFAULT_BINARY_CACHE
only:
changes:
- src/*
- CMakeLists.txt
- version.txt
build-docker:debug:
stage: docker-build
image: docker:latest
tags: [fast]
services:
- docker:dind
needs:
- build-storm-tape:debug
before_script:
- docker login -u gitlab-ci-token -p ${CI_JOB_TOKEN} ${CI_REGISTRY}
script:
- mv build/debug/storm-tape-*.tar.gz ./docker
- docker build docker --pull -t $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-debug
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-debug
only:
changes:
- src/*
- test/**/*
- cmake/**/*
- docker/**/*
- CMakeLists.txt
- CMakePresets.json
- vcpkg.json
- .gitlab-ci.yml
build-docker:release:
stage: docker-build
image: docker:latest
tags: [fast]
services:
- docker:dind
needs:
- build-storm-tape:release
before_script:
- docker login -u gitlab-ci-token -p ${CI_JOB_TOKEN} ${CI_REGISTRY}
script:
- mv build/release/storm-tape-*.tar.gz ./docker
- docker build docker --pull --build-arg STORM_BUILD_TYPE=release -t $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
only:
refs:
- tags
test:
stage: test
image:
name: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-debug
entrypoint: [""]
tags: [fast]
needs:
- build-docker:debug
script:
- ./test/test_script.sh
only:
changes:
- src/*
- test/**/*
- cmake/**/*
- docker/**/*
- CMakeLists.txt
- CMakePresets.json
- vcpkg.json
- .gitlab-ci.yml