Repository navigation
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
110 lines (104 loc) · 3.99 KB
/
Copy path.gitlab-ci.yml
File metadata and controls
110 lines (104 loc) · 3.99 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
# 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].
include:
- project: smspp/smspp-project
ref: develop
file: /ci/changelog.yml
default:
image: registry.gitlab.com/smspp/smspp-project
cache:
key: ${CI_PROJECT_PATH_SLUG}-${CI_COMMIT_REF_SLUG}
paths:
- smspp-project
stages:
- build
- test
- 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
- git -C smspp-project submodule update --init --quiet "$CI_PROJECT_TITLE"
- git -C "smspp-project/$CI_PROJECT_TITLE" fetch --quiet origin "$CI_COMMIT_SHA"
- git -C "smspp-project/$CI_PROJECT_TITLE" 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/$CI_PROJECT_TITLE" submodule update --init --recursive --quiet
- cmake -S smspp-project -B smspp-project/build -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DBUILD_BundleSolver=ON -DBUILD_MILPSolver=ON -DBUILD_tests=ON
- cmake --build smspp-project/build --target install
artifacts:
paths:
- smspp-project/build
only:
refs:
- develop
- tags
changes:
- cmake/*
- include/*
- src/*
- test/*
- tools/*
- CMakeLists.txt
- .gitlab-ci.yml
test:
stage: test
# the academic Gurobi WLS license caps concurrent sessions: a test job may
# abort at startup with "GRBstartenv returned with status 10030" when other
# Gurobi-heavy pipelines hold the sessions. Retry to ride out the contention.
retry:
max: 2
when: script_failure
# the batteries of LagBFunction and PolyhedralFunctionBlock alone take more
# than the hour the project gives a job
timeout: 24h
before_script:
# write the Gurobi WLS license from the masked CI/CD variables, if set
- |
if [ -n "$GRB_WLSSECRET" ]; then
printf 'LICENSEID=%s\nWLSACCESSID=%s\nWLSSECRET=%s\n' \
"$GRB_LICENSEID" "$GRB_WLSACCESSID" "$GRB_WLSSECRET" > /tmp/gurobi.lic
export GRB_LICENSE_FILE=/tmp/gurobi.lic
fi
script:
- ctest -V -C Release -L "$CI_PROJECT_TITLE" --test-dir smspp-project/build --no-tests=error
only:
refs:
- develop
- tags
changes:
- cmake/*
- include/*
- src/*
- test/*
- tools/*
- 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