-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
140 lines (128 loc) · 3.85 KB
/
Copy path.gitlab-ci.yml
File metadata and controls
140 lines (128 loc) · 3.85 KB
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
# GitLab CI/CD Configuration for OpenABF
stages:
- lint
- build
- test
- deploy
variables:
GIT_SUBMODULE_STRATEGY: recursive
CMAKE_GENERATOR: "Ninja"
BUILD_DIR: "build"
# Base template for build and test jobs
.base_template:
before_script:
- apt-get update -y && apt-get install -y libeigen3-dev cmake ninja-build build-essential git
cache:
key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
paths:
- ${BUILD_DIR}/
### 1. Linting Stage ###
format-check:
stage: lint
image: ubuntu:24.04
allow_failure: true
before_script:
- apt-get update -y && apt-get install -y clang-format git
script:
- |
find include/ examples/ tests/ -name "*.hpp" -o -name "*.cpp" | xargs clang-format -i
git diff --exit-code || {
echo "Formatting check failed! See differences above."
exit 1
}
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
- if: $CI_COMMIT_BRANCH == "develop"
- if: $CI_COMMIT_TAG =~ /^v/
amalgamation-check:
stage: lint
image: python:3.11-slim
allow_failure: true
before_script:
- apt-get update -y && apt-get install -y git
script:
- python3 thirdparty/amalgamate/amalgamate.py -c single_include.json -s .
- changed=$(git diff --name-only single_include/OpenABF/OpenABF.hpp)
- |
if [[ "${changed}" != "" ]]; then
echo "The single-header version is out of date!";
echo "Run: python3 thirdparty/amalgamate/amalgamate.py -c single_include.json -s .";
exit 1;
fi
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
- if: $CI_COMMIT_BRANCH == "develop"
- if: $CI_COMMIT_TAG =~ /^v/
### 2. Build Stage ###
build:
stage: build
extends: .base_template
needs: []
parallel:
matrix:
- IMAGE: ["debian:bookworm", "ubuntu:24.04"]
OPENABF_MULTIHEADER: ["ON", "OFF"]
- IMAGE: ["debian:bookworm"]
CXX: ["clang++"]
CC: ["clang"]
OPENABF_MULTIHEADER: ["ON"]
image: $IMAGE
before_script:
- !reference [.base_template, before_script]
- if [ "$CC" = "clang" ]; then apt-get install -y clang; fi
script:
- export SAFE_IMAGE_NAME=$(echo $IMAGE | tr ':.' '_')
- cmake -S . -B ${BUILD_DIR}_${SAFE_IMAGE_NAME}_${OPENABF_MULTIHEADER}
-DOPENABF_MULTIHEADER=${OPENABF_MULTIHEADER}
-DOPENABF_BUILD_TESTS=ON
-DOPENABF_BUILD_EXAMPLES=ON
- cmake --build ${BUILD_DIR}_${SAFE_IMAGE_NAME}_${OPENABF_MULTIHEADER}
artifacts:
paths:
- build_*
expire_in: 1 hour
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
- if: $CI_COMMIT_BRANCH == "develop"
- if: $CI_COMMIT_TAG =~ /^v/
### 3. Test Stage ###
test:
stage: test
extends: .base_template
parallel:
matrix:
- IMAGE: ["debian:bookworm", "ubuntu:24.04"]
OPENABF_MULTIHEADER: ["ON", "OFF"]
- IMAGE: ["debian:bookworm"]
CXX: ["clang++"]
CC: ["clang"]
OPENABF_MULTIHEADER: ["ON"]
image: $IMAGE
needs:
- job: build
artifacts: true
script:
- export SAFE_IMAGE_NAME=$(echo $IMAGE | tr ':.' '_')
- cd ${BUILD_DIR}_${SAFE_IMAGE_NAME}_${OPENABF_MULTIHEADER}
- ctest --output-on-failure
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
- if: $CI_COMMIT_BRANCH == "develop"
- if: $CI_COMMIT_TAG =~ /^v/
### 4. Deploy Stage ###
pages:
stage: deploy
image: debian:bookworm
before_script:
- apt-get update -y && apt-get install -y doxygen graphviz texlive-latex-base texlive-fonts-recommended ghostscript cmake libeigen3-dev build-essential ninja-build git
script:
- cmake -G Ninja -S . -B ${BUILD_DIR}_docs -DOPENABF_BUILD_DOCS=ON
- cmake --build ${BUILD_DIR}_docs --target docs
- mkdir -p public
- mv ${BUILD_DIR}_docs/docs/html/ public/docs/
artifacts:
paths:
- public
rules:
- if: $CI_COMMIT_BRANCH == "develop"
- if: $CI_COMMIT_TAG =~ /^v/