Repository navigation
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
80 lines (75 loc) · 3.12 KB
/
Copy path.gitlab-ci.yml
File metadata and controls
80 lines (75 loc) · 3.12 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
# The CHANGELOG of the module, held to the format and, on a merge request, to
# the commits of the branch [see ci/changelog.yml of the umbrella], and the
# code and the configurations that a merge request changes, held to the
# style of SMS++ [see ci/style.yml of the umbrella].
include:
- project: smspp/smspp-project
ref: develop
file: /ci/changelog.yml
- project: smspp/smspp-project
ref: develop
file: /ci/style.yml
default:
image: registry.gitlab.com/smspp/smspp-project
cache:
key: ${CI_PROJECT_PATH_SLUG}-${CI_COMMIT_REF_SLUG}
paths:
- smspp-project
stages:
- build
- deploy
build:
stage: build
script:
- eval $(ssh-agent -s)
- ssh-add <(echo "$SMSPP_DEPLOY_KEY")
- mkdir -p ~/.ssh && ssh-keyscan -H gitlab.com >> ~/.ssh/known_hosts
# the pull does not recurse into the submodules: CMake initializes
# the ones the enabled modules need, and a revision the pull walks
# through may pin a submodule commit no longer on its remote
- if [ -d smspp-project ]; then (cd smspp-project && git pull --no-recurse-submodules && git submodule update --recursive); else git clone --branch develop git@gitlab.com:smspp/smspp-project.git; fi
# the cache keeps the submodules an earlier pipeline initialized, and the
# umbrella turns on by default every module whose submodule is there, and
# it keeps the build directory, whose CMakeCache.txt remembers the modules
# turned on then: dropping both leaves exactly the modules this line asks
# for, which CMake initializes again, the objects being kept all the same
- git -C smspp-project submodule foreach --quiet 'echo $sm_path' | xargs -r git -C smspp-project submodule deinit --quiet --force --
- rm -f smspp-project/build/CMakeCache.txt
# the module is built at the commit of this pipeline, not at the one the
# umbrella pins, which lags behind until the pin is moved: its submodule is
# initialized and moved to that commit before CMake, which then leaves it
# (the path is written out, the title of this project being "Tools")
- git -C smspp-project submodule update --init --quiet tools
- git -C smspp-project/tools fetch --quiet origin "$CI_COMMIT_SHA"
- git -C smspp-project/tools checkout --quiet "$CI_COMMIT_SHA"
# CMake initializes the nested submodules only of a submodule it
# initializes itself, so those of this one are brought here to the
# commit of this pipeline
- git -C smspp-project/tools submodule update --init --recursive --quiet
- cmake -S smspp-project -B smspp-project/build -DCMAKE_BUILD_TYPE=Release -DBUILD_tools=ON
- cmake --build smspp-project/build --target install
artifacts:
paths:
- smspp-project/build
only:
refs:
- develop
- tags
changes:
# every tool lives in a directory of its own
- "*/*"
- common_utils.*
- ml_utils.*
- CMakeLists.txt
- .gitlab-ci.yml
deploy:
stage: deploy
script:
- cd smspp-project/build && cpack -G "TGZ;ZIP;TBZ2"
artifacts:
paths:
- smspp-project/build/*.tar.gz
- smspp-project/build/*.tar.bz2
- smspp-project/build/*.zip
only:
- tags