blob: e835e461e2888da1cfc60731edb7ccc513012e59 [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",
Ilya Shipitsin73c3ed92021-05-18 09:46:43 +000074 "USE_OT=1",
Ilya Shipitsinef86b472022-01-13 11:36:28 +050075 "OT_INC=${HOME}/opt-ot/include",
76 "OT_LIB=${HOME}/opt-ot/lib",
Ilya Shipitsin73c3ed92021-05-18 09:46:43 +000077 "OT_RUNPATH=1",
Tim Duesterhus288c0772020-07-28 23:00:35 +020078 "USE_PCRE=1",
79 "USE_PCRE_JIT=1",
80 "USE_LUA=1",
81 "USE_OPENSSL=1",
82 "USE_SYSTEMD=1",
83 "USE_WURFL=1",
Willy Tarreau57610c62021-04-02 16:39:44 +020084 "WURFL_INC=addons/wurfl/dummy",
85 "WURFL_LIB=addons/wurfl/dummy",
Tim Duesterhus288c0772020-07-28 23:00:35 +020086 "USE_DEVICEATLAS=1",
Willy Tarreauf8d9ec52021-04-02 16:19:39 +020087 "DEVICEATLAS_SRC=addons/deviceatlas/dummy",
Willy Tarreau3dfadc72021-04-02 15:35:19 +020088 "USE_PROMEX=1",
Ilya Shipitsinb34aee82020-11-26 20:59:42 +050089 "USE_51DEGREES=1",
Willy Tarreau977209d2021-04-02 16:12:32 +020090 "51DEGREES_SRC=addons/51degrees/dummy/pattern",
Tim Duesterhus288c0772020-07-28 23:00:35 +020091 ],
92 }
93 )
94
95 for compression in ["USE_SLZ=1", "USE_ZLIB=1"]:
96 matrix.append(
97 {
98 "name": "{}, {}, gz={}".format(
99 clean_os(os), CC, clean_compression(compression)
100 ),
101 "os": os,
102 "TARGET": TARGET,
103 "CC": CC,
104 "FLAGS": [compression],
105 }
106 )
107
108 for ssl in [
109 "stock",
110 "OPENSSL_VERSION=1.0.2u",
Ilya Shipitsinb5025612022-03-27 10:51:51 +0500111 "OPENSSL_VERSION=3.0.2",
Tim Duesterhus288c0772020-07-28 23:00:35 +0200112 "LIBRESSL_VERSION=2.9.2",
Ilya Shipitsin0b49cfb2022-03-16 12:10:47 +0500113 "LIBRESSL_VERSION=3.5.1",
Willy Tarreau61cda6d2021-09-02 17:32:43 +0200114# "BORINGSSL=yes",
Tim Duesterhus288c0772020-07-28 23:00:35 +0200115 ]:
116 flags = ["USE_OPENSSL=1"]
Ilya Shipitsin714f28c2021-05-09 21:27:28 +0500117 if ssl == "BORINGSSL=yes":
118 flags.append("USE_QUIC=1")
Ilya Shipitsin9c872552021-12-25 14:01:52 +0500119 if "OPENSSL_VERSION=3.0." in ssl:
William Lallemandd8580d92021-06-07 15:27:57 +0200120 flags.append('DEBUG_CFLAGS="-g -Wno-deprecated-declarations"')
Tim Duesterhus288c0772020-07-28 23:00:35 +0200121 if ssl != "stock":
122 flags.append("SSL_LIB=${HOME}/opt/lib")
123 flags.append("SSL_INC=${HOME}/opt/include")
124 matrix.append(
125 {
126 "name": "{}, {}, ssl={}".format(clean_os(os), CC, clean_ssl(ssl)),
127 "os": os,
128 "TARGET": TARGET,
129 "CC": CC,
130 "ssl": ssl,
131 "FLAGS": flags,
132 }
133 )
134
135# ASAN
136
137os = "ubuntu-latest"
138CC = "clang"
139TARGET = "linux-glibc"
140matrix.append(
141 {
142 "name": "{}, {}, ASAN, all features".format(clean_os(os), CC),
143 "os": os,
144 "TARGET": TARGET,
145 "CC": CC,
146 "FLAGS": get_asan_flags(CC)
147 + [
148 "USE_ZLIB=1",
Ilya Shipitsin73c3ed92021-05-18 09:46:43 +0000149 "USE_OT=1",
Ilya Shipitsinef86b472022-01-13 11:36:28 +0500150 "OT_INC=${HOME}/opt-ot/include",
151 "OT_LIB=${HOME}/opt-ot/lib",
Ilya Shipitsin73c3ed92021-05-18 09:46:43 +0000152 "OT_RUNPATH=1",
Tim Duesterhus288c0772020-07-28 23:00:35 +0200153 "USE_PCRE=1",
154 "USE_PCRE_JIT=1",
155 "USE_LUA=1",
156 "USE_OPENSSL=1",
157 "USE_SYSTEMD=1",
158 "USE_WURFL=1",
Willy Tarreau57610c62021-04-02 16:39:44 +0200159 "WURFL_INC=addons/wurfl/dummy",
160 "WURFL_LIB=addons/wurfl/dummy",
Tim Duesterhus288c0772020-07-28 23:00:35 +0200161 "USE_DEVICEATLAS=1",
Willy Tarreauf8d9ec52021-04-02 16:19:39 +0200162 "DEVICEATLAS_SRC=addons/deviceatlas/dummy",
Willy Tarreau3dfadc72021-04-02 15:35:19 +0200163 "USE_PROMEX=1",
Ilya Shipitsinb34aee82020-11-26 20:59:42 +0500164 "USE_51DEGREES=1",
Willy Tarreau977209d2021-04-02 16:12:32 +0200165 "51DEGREES_SRC=addons/51degrees/dummy/pattern",
Tim Duesterhus288c0772020-07-28 23:00:35 +0200166 ],
167 }
168)
169
170# macOS
171
172os = "macos-latest"
173TARGET = "osx"
174for CC in ["clang"]:
175 matrix.append(
176 {
177 "name": "{}, {}, no features".format(clean_os(os), CC),
178 "os": os,
179 "TARGET": TARGET,
180 "CC": CC,
181 "FLAGS": [],
182 }
183 )
184
185# Print matrix
186
187print(json.dumps(matrix, indent=4, sort_keys=True))
188
189print("::set-output name=matrix::{}".format(json.dumps({"include": matrix})))