-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy path.gitlab-ci.yml
253 lines (235 loc) · 8.13 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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
# Notes:
# Ubuntu is disabled due to fuse3 being not available there
# Fstest requires fuse2 because fusermount binary is used for unmounting
variables:
GET_SOURCES_ATTEMPTS: "3"
GIT_SUBMODULE_STRATEGY: "recursive"
GIT_SSL_NO_VERIFY: "true"
stages:
- build
- fstest
.binary_artifact: &binary_artifact
paths:
- build/marcfs
.build_script: &common_script
- mkdir -pv build
- meson setup --buildtype=release --prefix=/usr build .
- meson compile --jobs=$(nproc) -C build
- ./build/apitest
.fstest_after: &common_fstest_after
- userdel fstest
.fstest_script: &common_fstest_script
- su --whitelist-environment=MARCFS_TEST_USERNAME,MARCFS_TEST_PASSWORD -c 'python3 fstest.py -v' - fstest
build on ubuntu:
image: ubuntu:22.04
stage: build
needs: []
variables:
DEBIAN_FRONTEND: noninteractive
MARCFS_TEST_USERNAME: $MARCFS_UBUNTU_TEST_USERNAME
MARCFS_TEST_PASSWORD: $MARCFS_UBUNTU_TEST_PASSWORD
before_script:
- apt-get update -qq
- apt-get install -y -qq git g++ meson cmake pkg-config libfuse3-dev libcurl4-openssl-dev libjsoncpp-dev
script: *common_script
artifacts: *binary_artifact
deb package for ubuntu:
image: ubuntu:22.04
stage: build
needs: []
variables:
DEBIAN_FRONTEND: noninteractive
DEB_BUILD_OPTIONS: nocheck
DEBFULLNAME: Oleg (Kanedias) Chernovskiy
DEBEMAIL: kanedias@gmx.net
before_script:
- apt-get update -qq
- apt-get install -y -qq git g++ meson cmake pkg-config
libfuse3-dev libcurl4-openssl-dev libjsoncpp-dev
dh-make
script:
# create Debian build tree
- dh_make -p marcfs_0.8.1 --createorig --single --yes --copyright gpl3
# customize package details
- "sed -E -i 's|^Section: .*|Section: otherosfs|g' debian/control"
- "sed -E -i 's|^Homepage: .*|Homepage: https://gitlab.com/Kanedias/MARC-FS|g' debian/control"
- "sed -E -i 's|^Description: .*|Description: Mail.ru Cloud filesystem written for FUSE|g' debian/control"
- cp README.md debian/README.Debian
# build package
- dpkg-buildpackage -rfakeroot --unsigned-source --unsigned-changes --build=binary
- cp ../*.deb .
artifacts:
paths:
- "*.deb"
fstest on ubuntu:
image: ubuntu:22.04
stage: fstest
needs:
- build on ubuntu
variables:
DEBIAN_FRONTEND: noninteractive
MARCFS_TEST_USERNAME: $MARCFS_UBUNTU_TEST_USERNAME
MARCFS_TEST_PASSWORD: $MARCFS_UBUNTU_TEST_PASSWORD
before_script:
- apt-get update -qq
- apt-get install -y -qq fuse3 libcurl4 libjsoncpp25 python3
- useradd --create-home fstest
- cp build/marcfs tests/fstest.py ~fstest
- "chown -R fstest: ~fstest"
script: *common_fstest_script
after_script: *common_fstest_after
static binary universal build:
image: alpine
stage: build
needs: []
variables:
MARCFS_TEST_USERNAME: $MARCFS_UNIVERSAL_TEST_USERNAME
MARCFS_TEST_PASSWORD: $MARCFS_UNIVERSAL_TEST_PASSWORD
before_script:
- apk add git meson cmake pkgconf g++ make curl perl linux-headers
# jsoncpp
- git clone https://github.com/open-source-parsers/jsoncpp contrib/jsoncpp
- cd $CI_PROJECT_DIR
- cd contrib/jsoncpp
- meson --buildtype release --default-library static --prefix /usr . build
- ninja -C build install
# libfuse
- cd $CI_PROJECT_DIR
- git clone --branch fuse-3.5.0 --depth 1 https://github.com/libfuse/libfuse contrib/libfuse
- cd contrib/libfuse
- meson --buildtype release --default-library static --prefix /usr -Dudevrulesdir=/nonexistent . build
- ninja -C build install
# openssl
- cd $CI_PROJECT_DIR
- curl -L https://www.openssl.org/source/openssl-1.1.1b.tar.gz | tar -xz -C contrib
- cd contrib/openssl-1.1.1b
- ./config --prefix=/usr no-shared
- make -j$(nproc)
- make -j$(nproc) install_sw
# zlib
- cd $CI_PROJECT_DIR
- curl -L https://zlib.net/zlib-1.2.13.tar.gz | tar -xz -C contrib
- cd contrib/zlib-1.2.13
- ./configure --static --prefix=/usr
- make -j$(nproc)
- make -j$(nproc) install
# curl
- cd $CI_PROJECT_DIR
- curl -L https://curl.haxx.se/download/curl-7.64.1.tar.gz | tar -xz -C contrib
- cd contrib/curl-7.64.1
- ./configure --disable-shared --prefix=/usr --with-ssl=$CI_PROJECT_DIR/contrib/openssl-1.1.1b/ --with-zlib=$CI_PROJECT_DIR/contrib/zlib-1.2.13
- make -j$(nproc) install
- cd $CI_PROJECT_DIR
script:
- mkdir -pv build
- meson setup --buildtype=release --default-library=static --prefix=/usr build .
- meson compile --jobs=$(nproc) -C build
- ./build/apitest
artifacts: *binary_artifact
static binary test:
image: ubuntu # we should test static binary on another distro
stage: fstest
needs:
- static binary universal build
variables:
MARCFS_TEST_USERNAME: $MARCFS_UNIVERSAL_TEST_USERNAME
MARCFS_TEST_PASSWORD: $MARCFS_UNIVERSAL_TEST_PASSWORD
before_script:
- apt-get update --quiet && apt-get install python3 ca-certificates libcap2-bin fuse --yes
- useradd --create-home fstest
- cp build/marcfs tests/fstest.py ~fstest
- "chown -R fstest: ~fstest"
- setcap cap_sys_admin+ep ~fstest/marcfs
script: *common_fstest_script
after_script: *common_fstest_after
build on fedora:
image: fedora
stage: build
needs: []
variables:
MARCFS_TEST_USERNAME: $MARCFS_FEDORA_TEST_USERNAME
MARCFS_TEST_PASSWORD: $MARCFS_FEDORA_TEST_PASSWORD
before_script:
- yum -y install git-all meson cmake pkg-config gcc-c++ fuse3-devel libcurl-devel jsoncpp-devel
script: *common_script
artifacts: *binary_artifact
rpm package for fedora:
image: fedora
stage: build
needs: []
before_script:
- dnf -y install git meson cmake pkgconf-pkg-config gcc-c++
fuse3-devel libcurl-devel jsoncpp-devel jemalloc-devel
rpm-build
script:
# create RPM build tree
- version=$(grep Version distribution/fedora/fuse-marcfs.spec | grep -oP "\d.*")
- tar --transform "s|^|fuse-marcfs-$version/|g" -cvaf fuse-marcfs-$version.tar.zst *
- mkdir -pv ~/rpmbuild/{RPMS,SRPMS,BUILD,SOURCES,SPECS,tmp}
- mv -v fuse-marcfs-$version.tar.zst ~/rpmbuild/SOURCES
# build RPM package
- rpmbuild -ba distribution/fedora/fuse-marcfs.spec
- cp -v /root/rpmbuild/RPMS/*/*.rpm .
artifacts:
paths:
- "*.rpm"
fstest on fedora:
image: fedora
stage: fstest
needs:
- build on fedora
variables:
MARCFS_TEST_USERNAME: $MARCFS_FEDORA_TEST_USERNAME
MARCFS_TEST_PASSWORD: $MARCFS_FEDORA_TEST_PASSWORD
before_script:
- yum -y install fuse fuse-libs fuse3 fuse3-libs libcurl jsoncpp python util-linux
- useradd --create-home fstest
- cp build/marcfs tests/fstest.py ~fstest
- "chown -R fstest: ~fstest"
after_script: *common_fstest_after
script:
- export NSS_STRICT_NOFORK=DISABLED
- su --whitelist-environment=MARCFS_TEST_USERNAME,MARCFS_TEST_PASSWORD,NSS_STRICT_NOFORK -c 'python3 fstest.py -v' - fstest
build on arch:
image: archlinux:base
stage: build
needs: []
variables:
MARCFS_TEST_USERNAME: $MARCFS_ARCH_TEST_USERNAME
MARCFS_TEST_PASSWORD: $MARCFS_ARCH_TEST_PASSWORD
before_script:
- pacman -Syu --noconfirm
- pacman -S --noconfirm git meson cmake pkgconf gcc fuse3 libcurl-gnutls jsoncpp
script: *common_script
artifacts: *binary_artifact
aur package for arch:
image: archlinux:base
stage: build
needs: []
before_script:
- pacman -Syu --noconfirm
- pacman -S --noconfirm awk git meson cmake pkgconf gcc fuse3 libcurl-gnutls jsoncpp fakeroot
- useradd --create-home build
- cp distribution/archlinux/PKGBUILD ~build
script:
- su -c 'makepkg -s' - build
- cp -v ~build/*.tar.zst .
artifacts:
paths:
- "*.tar.zst"
fstest on arch:
image: archlinux:base
stage: fstest
needs:
- build on arch
variables:
MARCFS_TEST_USERNAME: $MARCFS_ARCH_TEST_USERNAME
MARCFS_TEST_PASSWORD: $MARCFS_ARCH_TEST_PASSWORD
before_script:
- pacman -Syu --noconfirm
- pacman -S --noconfirm fuse3 fuse2 libcurl-gnutls jsoncpp python
- useradd --create-home fstest
- cp build/marcfs tests/fstest.py ~fstest
- "chown -R fstest: ~fstest"
after_script: *common_fstest_after
script: *common_fstest_script