forked from infinit/memo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
194 lines (185 loc) · 11.8 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
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
stages:
- build
variables:
DRAKE_DEBUG_BACKTRACE: "1"
DRAKE_EXPLAIN: "1" # still testing the whole cache thing.
DRAKE_MTIME: "0" # rsync and mtime comparisons don't play along very well.
# DRAKE_RAW: "1" # debug cmake issues.
DRAKE_TIMEOUT: "1800" # More than what's needed for the longest test on Valgrind.
LC_ALL: "C.UTF-8"
PROJECT: "memo"
PYTHONUNBUFFERED: "1"
# To update the repository, we go through several steps.
#
# git submodule sync --recursive || git submodule sync
# Some old gits, e.g. on CentOS, does not support --recursive here.
#
# git submodule update --force --init --recursive
# Pass --force in order to avoid problems when a former submodule
# is replaced with actual contents. Otherwise we get:
#
# error: The following untracked working tree files would be
# overwritten by checkout:
# cryptography/LICENSE
# cryptography/README.md
#
# But --force is not supported on old versions of git.
before_script:
- git submodule sync --recursive || git submodule sync
- git submodule update --force --init --recursive || git submodule update --init --recursive || ( (git submodule sync --recursive || git submodule sync) && (git submodule update --force --init --recursive || git submodule update --init --recursive))
- git fetch origin --tags
- git fetch origin --force "refs/notes/*:refs/notes/*"
# smv FROM TO-HOST TO-DIR -- scp $FROM $TO-HOST:$TO-DIR && rm -f $FROM.
# Use a tmp to avoid partial upload when interrupted.
# A single call to ssh, rather than scp and then ssh.
- function smv { dst=$3/$(basename "$1") && time ssh $2 "cat > '$dst.tmp' && mv '$dst.tmp' '$dst'" < "$1" && rm -f "$1"; }
- SOURCE_DIR=${CI_PROJECT_DIR}
- BUILD_DIR=$(dirname ${CI_PROJECT_DIR})/${CI_PROJECT_NAME}-build
- INSTALL_DIR=$SOURCE_DIR/_install
- DESC=$(git describe)
- IS_RELEASE=$(if git -C "$SOURCE_DIR" describe --exact-match HEAD >/dev/null; then echo true; else echo false; fi)
# nproc on GNU/Linux, sysctl on macOS
- NPROC=$((nproc || sysctl -n hw.physicalcpu) 2>/dev/null)
# rmkdir DIR -- remove and recreate a directory, which is possibly a symlink.
# realpath about everywhere, readlink -f on CentOS
- function rmkdir { dir=$(realpath "$1" || readlink -f "$1") 2>/dev/null && rm -rf "$dir" && mkdir -p "$dir"; }
x86_64-centos6-gcc4:
stage: build
script:
- export LC_ALL=en_US.utf8
- time scl enable devtoolset-4 rh-python34 "pip3 install -q -r requirements.txt"
- time scl enable devtoolset-4 rh-python34 "./buildenv --pick-build-tree --branch $CI_BUILD_REF_NAME --link-build-tree $BUILD_DIR --build-trees-root /cache/$CI_PROJECT_NAME"
- if test -n "$FROM_SCRATCH"; then rmkdir "$BUILD_DIR"; else time scl enable devtoolset-4 rh-python34 "./buildenv --cache-download-build-tree --exclude='*.deb,*.rpm' --branch $CI_BUILD_REF_NAME --build-trees-root /cache/$CI_PROJECT_NAME --cache-namespace $CI_RUNNER_DESCRIPTION/$CI_PROJECT_NAME --cache-id $CI_RUNNER_ID --verbose"; fi
- scl enable devtoolset-4 rh-python34 "farm/configure --arch x86_64 --os centos6 --compiler gcc4 --project $PROJECT --source-dir $SOURCE_DIR --build-dir $BUILD_DIR --install-dir $INSTALL_DIR"
- cd "$BUILD_DIR"
- scl enable devtoolset-4 rh-python34 "python3 ./drake --beyond=false -j $NPROC //build"
- if $IS_RELEASE; then scl enable devtoolset-4 rh-python34 "python3 ./drake --beyond=false -j $NPROC //symbols-commit"; fi
- scl enable devtoolset-4 rh-python34 "python3 ./drake --beyond=false -j $NPROC //check"
- scl enable devtoolset-4 rh-python34 "python3 ./drake --beyond=false -j $NPROC //install"
- scl enable devtoolset-4 rh-python34 "python3 ./drake --beyond=false -j $NPROC //redhat"
- smv $PROJECT-$(echo $DESC | sed -e 's:-:_:g' )-1.el6.x86_64.rpm [email protected] yum
- ssh [email protected] 'make yum'
- (cd "$SOURCE_DIR" && time scl enable devtoolset-4 rh-python34 "./buildenv --cache-upload-build-tree --exclude='*.deb,*.rpm,*.tbz' --branch $CI_BUILD_REF_NAME --build-trees-root /cache/$CI_PROJECT_NAME --cache-namespace $CI_RUNNER_DESCRIPTION/$CI_PROJECT_NAME --cache-id $CI_RUNNER_ID --verbose")
tags:
- x86_64
- centos6
- gcc4
x86_64-ubuntu-gcc4:
stage: build
script:
- time pip3 install --user -r requirements.txt
- time ./buildenv --pick-build-tree --branch "$CI_BUILD_REF_NAME" --link-build-tree "$BUILD_DIR" --build-trees-root "/cache/$CI_PROJECT_NAME"
- if test -n "$FROM_SCRATCH"; then rmkdir "$BUILD_DIR"; else time ./buildenv --cache-download-build-tree --exclude='*.deb,*.rpm' --branch "$CI_BUILD_REF_NAME" --build-trees-root "/cache/$CI_PROJECT_NAME" --cache-namespace "$CI_RUNNER_DESCRIPTION/$CI_PROJECT_NAME" --cache-id "$CI_RUNNER_ID" --verbose; fi
- farm/configure --arch x86_64 --os trusty --compiler gcc4 --project $PROJECT --source-dir "$SOURCE_DIR" --build-dir "$BUILD_DIR" --install-dir "$INSTALL_DIR"
- cd "$BUILD_DIR"
- time python3 ./drake -j $NPROC //build //beyond/build
- time python3 ./drake -j $(($NPROC / 4)) //check //beyond/check
- time python3 ./drake -j $NPROC //install //beyond/install
- time python3 ./drake -j $NPROC //beyond/debian
- (cd "$SOURCE_DIR" && time ./buildenv --cache-upload-build-tree --exclude='*.deb,*.rpm,*.tbz' --branch "$CI_BUILD_REF_NAME" --build-trees-root "/cache/$CI_PROJECT_NAME" --cache-namespace "$CI_RUNNER_DESCRIPTION/$CI_PROJECT_NAME" --cache-id "$CI_RUNNER_ID" --verbose)
- smv "beyond/infinit-beyond_${DESC}_amd64.deb" [email protected] debian
- ssh [email protected] 'make debian'
- time python3 ./drake //docker
- docker run --rm $PROJECT:$DESC memo --help # Check if the image works.
- docker tag $PROJECT:${DESC} infinit/$PROJECT:${DESC}
- time docker push infinit/$PROJECT:${DESC}
- docker rmi {,infinit/}$PROJECT:${DESC}
- time python3 ./drake //beyond/docker
tags:
- x86_64
- ubuntu
- gcc4
x86_64-alpine-gcc:
stage: build
script:
- time pip3 install --user -r requirements.txt
- time ./buildenv --pick-build-tree --branch "$CI_BUILD_REF_NAME" --link-build-tree "$BUILD_DIR" --build-trees-root "/cache/$CI_PROJECT_NAME"
- if test -n "$FROM_SCRATCH"; then rmkdir "$BUILD_DIR"; else time ./buildenv --cache-download-build-tree --exclude='*.deb,*.rpm' --branch "$CI_BUILD_REF_NAME" --build-trees-root "/cache/$CI_PROJECT_NAME" --cache-namespace "$CI_RUNNER_DESCRIPTION/$CI_PROJECT_NAME" --cache-id "$CI_RUNNER_ID" --verbose; fi
- farm/configure --arch x86_64 --os alpine --compiler gcc4 --project $PROJECT --source-dir "$SOURCE_DIR" --build-dir "$BUILD_DIR" --install-dir "$INSTALL_DIR"
- cd "$BUILD_DIR"
- time python3 ./drake --beyond=false -j $NPROC //build
- time python3 ./drake --beyond=false -j $NPROC //check
- (cd "$SOURCE_DIR" && time ./buildenv --cache-upload-build-tree --exclude='*.deb,*.rpm,*.tbz' --branch "$CI_BUILD_REF_NAME" --build-trees-root "/cache/$CI_PROJECT_NAME" --cache-namespace "$CI_RUNNER_DESCRIPTION/$CI_PROJECT_NAME" --cache-id "$CI_RUNNER_ID" --verbose)
- time python3 ./drake --beyond=false -j $NPROC //install
- TARBALL=/tmp/$PROJECT-x86_64-alpine-gcc-$DESC.tbz
- tar -cvjf "$TARBALL" -C $INSTALL_DIR . --show-transformed-names --transform "s,^\\./,$PROJECT-$DESC/,"
- smv "$TARBALL" [email protected] tmp
- python3 ./drake //docker-alpine
- docker run --rm $PROJECT-alpine:$DESC memo --help # Check if the image works.
- docker tag $PROJECT-alpine:$DESC infinit/$PROJECT-alpine:$DESC
- docker push infinit/$PROJECT-alpine:$DESC
- docker rmi {,infinit/}$PROJECT-alpine:$DESC
- python3 ./drake //src/memo/grpc/docker
- python3 ./drake //src/memo/kvs/docker
- docker tag memo-vs-client-python:$DESC infinit/memo-vs-client-python:$DESC
# - docker tag memo-kvs-client-python:$DESC infinit/memo-kvs-client-python:$DESC
- docker push infinit/memo-vs-client-python:$DESC
# - docker push infinit/memo-kvs-client-python:$DESC
- docker rmi {,infinit/}memo-vs-client-python:$DESC
tags:
- x86_64
- alpine
- gcc
x86_64-jessie-gcc4:
stage: build
script:
- time pip3 install --user -r requirements.txt
- time ./buildenv --pick-build-tree --branch "$CI_BUILD_REF_NAME" --link-build-tree "$BUILD_DIR" --build-trees-root "/cache/$CI_PROJECT_NAME"
- if test -n "$FROM_SCRATCH"; then rmkdir "$BUILD_DIR"; else time ./buildenv --cache-download-build-tree --exclude='*.deb,*.rpm' --branch "$CI_BUILD_REF_NAME" --build-trees-root "/cache/$CI_PROJECT_NAME" --cache-namespace "$CI_RUNNER_DESCRIPTION/$CI_PROJECT_NAME" --cache-id "$CI_RUNNER_ID" --verbose; fi
- farm/configure --arch x86_64 --os jessie --compiler gcc4 --project $PROJECT --source-dir "$SOURCE_DIR" --build-dir "$BUILD_DIR" --install-dir "$INSTALL_DIR"
- cd "$BUILD_DIR"
- time python3 ./drake --beyond=false -j $NPROC //build
- time if $IS_RELEASE; then python3 ./drake --beyond=false -j $NPROC //symbols-commit; fi
- time python3 ./drake --beyond=false -j $NPROC //check
- time python3 ./drake --beyond=false -j $NPROC //install
- time python3 ./drake --beyond=false -j $NPROC //debian
- (cd "$SOURCE_DIR" && time ./buildenv --cache-upload-build-tree --exclude='*.deb,*.rpm' --branch "$CI_BUILD_REF_NAME" --build-trees-root "/cache/$CI_PROJECT_NAME" --cache-namespace "$CI_RUNNER_DESCRIPTION/$CI_PROJECT_NAME" --cache-id "$CI_RUNNER_ID" --verbose)
- smv "${PROJECT}_${DESC}_amd64.deb" [email protected] debian
- time ssh [email protected] 'make debian'
tags:
- x86_64
- jessie
- gcc4
x86_64-windows-mingw4:
stage: build
script:
- time pip3 install --user -r requirements.txt
- time ./buildenv --pick-build-tree --branch "$CI_BUILD_REF_NAME" --link-build-tree "$BUILD_DIR" --build-trees-root "/cache/$CI_PROJECT_NAME"
- if test -n "$FROM_SCRATCH"; then rmkdir "$BUILD_DIR"; else time ./buildenv --cache-download-build-tree --exclude='*.deb,*.rpm' --branch "$CI_BUILD_REF_NAME" --build-trees-root "/cache/$CI_PROJECT_NAME" --cache-namespace "$CI_RUNNER_DESCRIPTION/$CI_PROJECT_NAME" --cache-id "$CI_RUNNER_ID" --verbose; fi
- farm/configure --arch x86_64 --os windows --compiler mingw4 --project $PROJECT --source-dir "$SOURCE_DIR" --build-dir "$BUILD_DIR" --install-dir "$INSTALL_DIR"
- cd "$BUILD_DIR"
- python3 ./drake -j $NPROC //build
- WINEDEBUG=-all python3 ./drake -j $(($NPROC / 4)) //check
- (cd "$SOURCE_DIR" && time ./buildenv --cache-upload-build-tree --exclude='*.deb,*.rpm,*.zip' --branch "$CI_BUILD_REF_NAME" --build-trees-root "/cache/$CI_PROJECT_NAME" --cache-namespace "$CI_RUNNER_DESCRIPTION/$CI_PROJECT_NAME" --cache-id "$CI_RUNNER_ID" --verbose)
- rm -rf "$INSTALL_DIR" && mkdir -p "$INSTALL_DIR"
- python3 ./drake -j $NPROC //install
- cd "$SOURCE_DIR"
- mv "$INSTALL_DIR" "$PROJECT-${DESC}"
- zip -r "$PROJECT-${DESC}.zip" "$PROJECT-${DESC}"
- mv "$PROJECT-${DESC}" "$INSTALL_DIR"
- smv "$PROJECT-${DESC}.zip" [email protected] tmp
tags:
- x86_64
- windows
- mingw4
x86_64-osx-clang:
stage: build
script:
- export LC_ALL=en_US.UTF-8
- pip3 install --user -r requirements.txt
- farm/configure --arch x86_64 --os osx --compiler clang --project $PROJECT --source-dir "$SOURCE_DIR" --build-dir "$BUILD_DIR" --install-dir "$INSTALL_DIR"
- cd "$BUILD_DIR"
- python3 ./drake -j $NPROC //build
- time if $IS_RELEASE; then python3 ./drake -j $NPROC //symbols-commit; fi
- python3 ./drake -j $NPROC //check
- python3 ./drake -j $NPROC //beyond/check
- rm -rf "$INSTALL_DIR" && mkdir -p "$INSTALL_DIR"
- python3 ./drake -j $NPROC //install
- TARBALL=/tmp/$PROJECT-x86_64-osx-clang3-$DESC.tbz
- gtar -cvjf "$TARBALL" -C "$INSTALL_DIR" . --show-transformed-names --transform "s,^\\./,$PROJECT-$DESC/,"
- smv "$TARBALL" [email protected] tmp
- ssh [email protected] 'make brew'
tags:
- x86_64
- osx
- clang