/
.gitlab-ci.yml
91 lines (80 loc) · 1.72 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
# Run pipeline only on master branch, tags and merge requests
workflow:
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
- if: $CI_COMMIT_TAG
- if: ($CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_COMMIT_BRANCH == "develop")
image: cvutdcgi/i3t-ci
stages:
- pre-lint # linting without building
- build
- lint
- test
- release
# How to write paths: https://stackoverflow.com/a/55391444
.changes-rules:
cpp:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
changes:
- "Dependencies/*"
- .clang-format
- .clang-tidy
- .gitlab-ci.yml
- .gitmodules
- CMakeLists.txt
- "**/*.{h,cpp}"
- "**/*.{h,cpp}"
# Linting phase
check-format:
stage: pre-lint
rules:
- !reference [.changes-rules, cpp]
script:
- bash Scripts/CheckFormat.sh
###
build-app:
stage: build
rules:
- !reference [.changes-rules, cpp]
script:
- mkdir out && cd out
- cmake ..
- cmake --build . -j 8 --target I3T
artifacts:
paths:
- Binaries
expire_in: 1 week
variables:
GIT_SUBMODULE_STRATEGY: recursive
dependencies:
- check-format
build-tests:
stage: build
rules:
- !reference [.changes-rules, cpp]
script:
- mkdir out && cd out
- cmake -DCMAKE_BUILD_TYPE=Debug ..
- cmake --build . -j 8 --target I3TTest
artifacts:
paths:
- Binaries
expire_in: 1 week
variables:
GIT_SUBMODULE_STRATEGY: recursive
dependencies:
- check-format
###
# run tests using the binary built before
test:
stage: test
rules:
- !reference [.changes-rules, cpp]
script:
- xvfb-run Binaries/Debug/I3TTest
dependencies:
- build-tests
###
pass:
script:
- echo "Pipeline passed"