blob: 28b697f4f2cc58b2a16f792d45b586d64630a004 [file] [log] [blame]
Tim Duesterhus288c0772020-07-28 23:00:35 +02001# Copyright 2019 Ilya Shipitsin <chipitsine@gmail.com>
2# Copyright 2020 Tim Duesterhus <tim@bastelstu.be>
3#
4# This program is free software; you can redistribute it and/or
5# modify it under the terms of the GNU General Public License
6# as published by the Free Software Foundation; either version
7# 2 of the License, or (at your option) any later version.
8
9import json
Tim Duesterhus8d173e12020-11-20 00:16:00 +010010import sys
11
12if len(sys.argv) == 2:
13 build_type = sys.argv[1]
14else:
15 print("Usage: {} <build_type>".format(sys.argv[0]), file=sys.stderr)
16 sys.exit(1)
17
18print("Generating matrix for type '{}'.".format(build_type))
Tim Duesterhus288c0772020-07-28 23:00:35 +020019
20
21def clean_os(os):
22 if os == "ubuntu-latest":
23 return "Ubuntu"
24 elif os == "macos-latest":
25 return "macOS"
26 return os.replace("-latest", "")
27
28
29def clean_ssl(ssl):
30 return ssl.replace("_VERSION", "").lower()
31
32
33def clean_compression(compression):
34 return compression.replace("USE_", "").lower()
35
36
37def get_asan_flags(cc):
38 if cc == "clang":
39 return [
40 "USE_OBSOLETE_LINKER=1",
41 'DEBUG_CFLAGS="-g -fsanitize=address"',
42 'LDFLAGS="-fsanitize=address"',
43 'CPU_CFLAGS.generic="-O1"',
44 ]
45
46 raise ValueError("ASAN is only supported for clang")
47
48
49matrix = []
50
51# Ubuntu
52
53os = "ubuntu-latest"
54TARGET = "linux-glibc"
55for CC in ["gcc", "clang"]:
56 matrix.append(
57 {
58 "name": "{}, {}, no features".format(clean_os(os), CC),
59 "os": os,
60 "TARGET": TARGET,
61 "CC": CC,
62 "FLAGS": [],
63 }
64 )
65
66 matrix.append(
67 {
68 "name": "{}, {}, all features".format(clean_os(os), CC),
69 "os": os,
70 "TARGET": TARGET,
71 "CC": CC,
72 "FLAGS": [
73 "USE_ZLIB=1",
74 "USE_PCRE=1",
75 "USE_PCRE_JIT=1",
76 "USE_LUA=1",
77 "USE_OPENSSL=1",
78 "USE_SYSTEMD=1",
79 "USE_WURFL=1",
80 "WURFL_INC=contrib/wurfl",
81 "WURFL_LIB=contrib/wurfl",
82 "USE_DEVICEATLAS=1",
83 "DEVICEATLAS_SRC=contrib/deviceatlas",
Ilya Shipitsin69c10f12020-11-20 14:41:40 +050084 "EXTRA_OBJS=contrib/prometheus-exporter/service-prometheus.o",
Ilya Shipitsinb34aee82020-11-26 20:59:42 +050085 "USE_51DEGREES=1",
86 "51DEGREES_SRC=contrib/51d/src/pattern",
Tim Duesterhus288c0772020-07-28 23:00:35 +020087 ],
88 }
89 )
90
91 for compression in ["USE_SLZ=1", "USE_ZLIB=1"]:
92 matrix.append(
93 {
94 "name": "{}, {}, gz={}".format(
95 clean_os(os), CC, clean_compression(compression)
96 ),
97 "os": os,
98 "TARGET": TARGET,
99 "CC": CC,
100 "FLAGS": [compression],
101 }
102 )
103
104 for ssl in [
105 "stock",
106 "OPENSSL_VERSION=1.0.2u",
107 "LIBRESSL_VERSION=2.9.2",
Ilya Shipitsind21f4e12021-03-19 22:29:16 +0500108 "LIBRESSL_VERSION=3.2.5",
Ilya Shipitsinf644c5a2020-11-20 14:43:23 +0500109 "BORINGSSL=yes",
Tim Duesterhus288c0772020-07-28 23:00:35 +0200110 ]:
111 flags = ["USE_OPENSSL=1"]
112 if ssl != "stock":
113 flags.append("SSL_LIB=${HOME}/opt/lib")
114 flags.append("SSL_INC=${HOME}/opt/include")
115 matrix.append(
116 {
117 "name": "{}, {}, ssl={}".format(clean_os(os), CC, clean_ssl(ssl)),
118 "os": os,
119 "TARGET": TARGET,
120 "CC": CC,
121 "ssl": ssl,
122 "FLAGS": flags,
123 }
124 )
125
126# ASAN
127
128os = "ubuntu-latest"
129CC = "clang"
130TARGET = "linux-glibc"
131matrix.append(
132 {
133 "name": "{}, {}, ASAN, all features".format(clean_os(os), CC),
134 "os": os,
135 "TARGET": TARGET,
136 "CC": CC,
137 "FLAGS": get_asan_flags(CC)
138 + [
139 "USE_ZLIB=1",
140 "USE_PCRE=1",
141 "USE_PCRE_JIT=1",
142 "USE_LUA=1",
143 "USE_OPENSSL=1",
144 "USE_SYSTEMD=1",
145 "USE_WURFL=1",
146 "WURFL_INC=contrib/wurfl",
147 "WURFL_LIB=contrib/wurfl",
148 "USE_DEVICEATLAS=1",
149 "DEVICEATLAS_SRC=contrib/deviceatlas",
Ilya Shipitsin69c10f12020-11-20 14:41:40 +0500150 "EXTRA_OBJS=contrib/prometheus-exporter/service-prometheus.o",
Ilya Shipitsinb34aee82020-11-26 20:59:42 +0500151 "USE_51DEGREES=1",
152 "51DEGREES_SRC=contrib/51d/src/pattern",
Tim Duesterhus288c0772020-07-28 23:00:35 +0200153 ],
154 }
155)
156
157# macOS
158
159os = "macos-latest"
160TARGET = "osx"
161for CC in ["clang"]:
162 matrix.append(
163 {
164 "name": "{}, {}, no features".format(clean_os(os), CC),
165 "os": os,
166 "TARGET": TARGET,
167 "CC": CC,
168 "FLAGS": [],
169 }
170 )
171
172# Print matrix
173
174print(json.dumps(matrix, indent=4, sort_keys=True))
175
176print("::set-output name=matrix::{}".format(json.dumps({"include": matrix})))