-
Notifications
You must be signed in to change notification settings - Fork 39
/
.drone.jsonnet
144 lines (132 loc) · 5.7 KB
/
.drone.jsonnet
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
local docker_base = 'registry.oxen.rocks/';
local default_deps_nocxx = ['libsodium-dev', 'libzmq3-dev', 'liboxenc-dev'];
local submodule_commands = ['git fetch --tags', 'git submodule update --init --recursive --depth=1'];
local submodules = {
name: 'submodules',
image: 'drone/git',
commands: submodule_commands,
};
local apt_get_quiet = 'apt-get -o=Dpkg::Use-Pty=0 -q ';
local generic_build(build_type, cmake_extra, werror=false, tests=true)
= [
'mkdir build',
'cd build',
'cmake .. -G Ninja -DCMAKE_COLOR_DIAGNOSTICS=ON -DCMAKE_BUILD_TYPE=' + build_type +
' -DWARNINGS_AS_ERRORS=' + (if werror then 'ON' else 'OFF') +
' -DOXENMQ_BUILD_TESTS=' + (if tests then 'ON' else 'OFF') +
' ' + cmake_extra,
'ninja -v',
'cd ..',
]
+ (if tests then [
'cd build',
'./tests/tests --use-colour yes',
'cd ..',
] else []);
local debian_pipeline(name,
image,
arch='amd64',
deps=['g++'] + default_deps_nocxx,
cmake_extra='',
build_type='Release',
extra_cmds=[],
werror=false,
distro='$$(lsb_release -sc)',
allow_fail=false) = {
kind: 'pipeline',
type: 'docker',
name: name,
platform: { arch: arch },
environment: { CLICOLOR_FORCE: '1' }, // Lets color through ninja (1.9+)
steps: [
submodules,
{
name: 'build',
image: image,
pull: 'always',
[if allow_fail then 'failure']: 'ignore',
commands: [
'echo "Building on ${DRONE_STAGE_MACHINE}"',
'echo "man-db man-db/auto-update boolean false" | debconf-set-selections',
apt_get_quiet + 'update',
apt_get_quiet + 'install -y eatmydata',
'eatmydata ' + apt_get_quiet + ' install --no-install-recommends -y lsb-release',
'cp contrib/deb.oxen.io.gpg /etc/apt/trusted.gpg.d',
'echo deb http://deb.oxen.io ' + distro + ' main >/etc/apt/sources.list.d/oxen.list',
'eatmydata ' + apt_get_quiet + ' update',
'eatmydata ' + apt_get_quiet + 'dist-upgrade -y',
'eatmydata ' + apt_get_quiet + 'install -y cmake git ninja-build pkg-config ccache ' + std.join(' ', deps),
]
+ generic_build(build_type, cmake_extra, werror=werror)
+ extra_cmds,
},
],
};
local clang(version) = debian_pipeline(
'Debian sid/clang-' + version + ' (amd64)',
docker_base + 'debian-sid-clang',
distro='sid',
deps=['clang-' + version] + default_deps_nocxx,
cmake_extra='-DCMAKE_C_COMPILER=clang-' + version + ' -DCMAKE_CXX_COMPILER=clang++-' + version + ' '
);
local full_llvm(version) = debian_pipeline(
'Debian sid/llvm-' + version + ' (amd64)',
docker_base + 'debian-sid-clang',
distro='sid',
deps=['clang-' + version, 'lld-' + version, 'libc++-' + version + '-dev', 'libc++abi-' + version + '-dev']
+ default_deps_nocxx,
cmake_extra='-DCMAKE_C_COMPILER=clang-' + version +
' -DCMAKE_CXX_COMPILER=clang++-' + version +
' -DCMAKE_CXX_FLAGS=-stdlib=libc++ ' +
std.join(' ', [
'-DCMAKE_' + type + '_LINKER_FLAGS=-fuse-ld=lld-' + version
for type in ['EXE', 'MODULE', 'SHARED', 'STATIC']
])
);
local mac_builder(name,
build_type='Release',
arch='amd64',
cmake_extra='-DCMAKE_CXX_COMPILER_LAUNCHER=ccache ',
extra_cmds=[],
tests=true) = {
kind: 'pipeline',
type: 'exec',
name: name,
platform: { os: 'darwin', arch: arch },
steps: [
{ name: 'submodules', commands: submodule_commands },
{
name: 'build',
environment: { SSH_KEY: { from_secret: 'SSH_KEY' } },
commands: [
'echo "Building on ${DRONE_STAGE_MACHINE}"',
// If you don't do this then the C compiler doesn't have an include path containing
// basic system headers. WTF apple:
'export SDKROOT="$(xcrun --sdk macosx --show-sdk-path)"',
'ulimit -n 1024', // Because macOS has a stupid tiny default ulimit
]
+ generic_build(build_type, cmake_extra)
+ extra_cmds,
},
],
};
[
debian_pipeline('Debian sid (amd64)', docker_base + 'debian-sid', distro='sid'),
debian_pipeline('Debian sid/Debug (amd64)', docker_base + 'debian-sid', build_type='Debug', distro='sid'),
clang(16),
full_llvm(17),
debian_pipeline('Debian sid (ARM64)', docker_base + 'debian-sid', arch='arm64', distro='sid'),
debian_pipeline('Debian stable (i386)', docker_base + 'debian-stable/i386'),
debian_pipeline('Debian stable (armhf)', docker_base + 'debian-stable/arm32v7', arch='arm64'),
debian_pipeline('Debian bullseye (amd64)', docker_base + 'debian-bullseye'),
debian_pipeline('Debian bullseye (armhf)', docker_base + 'debian-bullseye/arm32v7', arch='arm64'),
debian_pipeline('Ubuntu focal (amd64)',
docker_base + 'ubuntu-focal',
deps=default_deps_nocxx + ['g++-10'],
cmake_extra='-DCMAKE_C_COMPILER=gcc-10 -DCMAKE_CXX_COMPILER=g++-10'),
debian_pipeline('Ubuntu noble (amd64)', docker_base + 'ubuntu-noble'),
mac_builder('MacOS (amd64) Release', build_type='Release', arch='amd64'),
mac_builder('MacOS (amd64) Debug', build_type='Debug', arch='amd64'),
mac_builder('MacOS (arm64) Release', build_type='Release', arch='arm64'),
mac_builder('MacOS (arm64) Debug', build_type='Debug', arch='arm64'),
]