Skip to content

Commit 05bbd6c

Browse files
committed
docs: add GitLab pipelines example [skip ci]
1 parent fe2b2f5 commit 05bbd6c

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

README.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,63 @@ jobs:
223223
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
224224
```
225225
226+
# GitLab PipeLines
227+
228+
The following gives an example for setting up a C++ environment inside GitLab pipelines.
229+
230+
.gitlab-ci.yaml
231+
232+
```yaml
233+
image: ubuntu:latest
234+
235+
stages:
236+
- test
237+
238+
.setup_linux: &setup_linux |
239+
DEBIAN_FRONTEND=noninteractive
240+
241+
# set time-zone
242+
TZ=Canada/Pacific
243+
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
244+
245+
# for downloading
246+
apt-get update -qq
247+
apt-get install -y --no-install-recommends curl gnupg ca-certificates
248+
249+
# keys used by apt
250+
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3B4FE6ACC0B21F32
251+
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 40976EAF437D05B5
252+
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 1E9377A2BA9EF27F
253+
254+
.setup_cpp: &setup_cpp |
255+
curl -LJO "https://github.com/aminya/setup-cpp/releases/download/v0.5.6/setup_cpp_linux"
256+
chmod +x setup_cpp_linux
257+
./setup_cpp_linux --compiler $compiler --cmake true --ninja true --ccache true --vcpkg true
258+
source ~/.profile
259+
260+
.test: &test |
261+
# Build and Test
262+
# ...
263+
264+
test_linux_llvm:
265+
stage: test
266+
variables:
267+
compiler: llvm
268+
script:
269+
- *setup_linux
270+
- *setup_cpp
271+
- *test
272+
273+
test_linux_gcc:
274+
stage: test
275+
variables:
276+
compiler: gcc
277+
script:
278+
- *setup_linux
279+
- *setup_cpp
280+
- *test
281+
```
282+
226283
# Articles
227284

228285
[Setup-Cpp on Dev.to](https://dev.to/aminya/setup-cpp-3ia4)

0 commit comments

Comments
 (0)