blob: 4427b255fcfdfbb29c54fda8a5ec97980a562164 [file] [log] [blame]
Tim Duesterhus871ef2f2021-06-08 15:14:35 +02001#!/usr/bin/python3
2
Tim Duesterhus288c0772020-07-28 23:00:35 +02003# Copyright 2019 Ilya Shipitsin <chipitsine@gmail.com>
4# Copyright 2020 Tim Duesterhus <tim@bastelstu.be>
5#
6# This program is free software; you can redistribute it and/or
7# modify it under the terms of the GNU General Public License
8# as published by the Free Software Foundation; either version
9# 2 of the License, or (at your option) any later version.
10
11import json
Tim Duesterhus8d173e12020-11-20 00:16:00 +010012import sys
13
14if len(sys.argv) == 2:
15 build_type = sys.argv[1]
16else:
17 print("Usage: {} <build_type>".format(sys.argv[0]), file=sys.stderr)
18 sys.exit(1)
19
20print("Generating matrix for type '{}'.".format(build_type))
Tim Duesterhus288c0772020-07-28 23:00:35 +020021
22
23def clean_os(os):
24 if os == "ubuntu-latest":
25 return "Ubuntu"
26 elif os == "macos-latest":
27 return "macOS"
28 return os.replace("-latest", "")
29
30
31def clean_ssl(ssl):
32 return ssl.replace("_VERSION", "").lower()
33
34
35def clean_compression(compression):
36 return compression.replace("USE_", "").lower()
37
38
39def get_asan_flags(cc):
40 if cc == "clang":
41 return [
42 "USE_OBSOLETE_LINKER=1",
43 'DEBUG_CFLAGS="-g -fsanitize=address"',
44 'LDFLAGS="-fsanitize=address"',
45 'CPU_CFLAGS.generic="-O1"',
46 ]
47
48 raise ValueError("ASAN is only supported for clang")
49
50
51matrix = []
52
53# Ubuntu
54
55os = "ubuntu-latest"
56TARGET = "linux-glibc"
57for CC in ["gcc", "clang"]:
58 matrix.append(
59 {
60 "name": "{}, {}, no features".format(clean_os(os), CC),
61 "os": os,
62 "TARGET": TARGET,
63 "CC": CC,
64 "FLAGS": [],
65 }
66 )
67
68 matrix.append(
69 {
70 "name": "{}, {}, all features".format(clean_os(os), CC),
71 "os": os,
72 "TARGET": TARGET,
73 "CC": CC,
74 "FLAGS": [
75 "USE_ZLIB=1",
Willy Tarreaued17ca72021-09-12 07:01:36 +020076 "USE_OT=1",
Ilya Shipitsinb9e3fb72022-01-13 11:36:28 +050077 "OT_INC=${HOME}/opt-ot/include",
78 "OT_LIB=${HOME}/opt-ot/lib",
Ilya Shipitsin75c95aa2021-05-18 09:46:43 +000079 "OT_RUNPATH=1",
Tim Duesterhus288c0772020-07-28 23:00:35 +020080 "USE_PCRE=1",
81 "USE_PCRE_JIT=1",
82 "USE_LUA=1",
83 "USE_OPENSSL=1",
84 "USE_SYSTEMD=1",
85 "USE_WURFL=1",
Willy Tarreau57610c62021-04-02 16:39:44 +020086 "WURFL_INC=addons/wurfl/dummy",
87 "WURFL_LIB=addons/wurfl/dummy",
Tim Duesterhus288c0772020-07-28 23:00:35 +020088 "USE_DEVICEATLAS=1",
Willy Tarreauf8d9ec52021-04-02 16:19:39 +020089 "DEVICEATLAS_SRC=addons/deviceatlas/dummy",
Willy Tarreau3dfadc72021-04-02 15:35:19 +020090 "USE_PROMEX=1",
Ilya Shipitsinb34aee82020-11-26 20:59:42 +050091 "USE_51DEGREES=1",
Willy Tarreau977209d2021-04-02 16:12:32 +020092 "51DEGREES_SRC=addons/51degrees/dummy/pattern",
Tim Duesterhus288c0772020-07-28 23:00:35 +020093 ],
94 }
95 )
96
Tim Duesterhus762b1fd2021-08-14 14:36:55 +020097 for compression in ["USE_ZLIB=1"]:
Tim Duesterhus288c0772020-07-28 23:00:35 +020098 matrix.append(
99 {
100 "name": "{}, {}, gz={}".format(
101 clean_os(os), CC, clean_compression(compression)
102 ),
103 "os": os,
104 "TARGET": TARGET,
105 "CC": CC,
106 "FLAGS": [compression],
107 }
108 )
109
110 for ssl in [
111 "stock",
112 "OPENSSL_VERSION=1.0.2u",
Ilya Shipitsin874c9072021-12-25 14:01:52 +0500113 "OPENSSL_VERSION=3.0.1",
Tim Duesterhus288c0772020-07-28 23:00:35 +0200114 "LIBRESSL_VERSION=2.9.2",
Ilya Shipitsin2ec39ea2022-03-16 12:10:47 +0500115 "LIBRESSL_VERSION=3.5.1",
Ilya Shipitsind69d65a2021-11-18 18:27:57 +0500116 "QUICTLS=yes",
Willy Tarreau30ee2962021-09-02 17:32:43 +0200117# "BORINGSSL=yes",
Tim Duesterhus288c0772020-07-28 23:00:35 +0200118 ]:
119 flags = ["USE_OPENSSL=1"]
Ilya Shipitsind69d65a2021-11-18 18:27:57 +0500120 if ssl == "BORINGSSL=yes" or ssl == "QUICTLS=yes":
Ilya Shipitsin714f28c2021-05-09 21:27:28 +0500121 flags.append("USE_QUIC=1")
Ilya Shipitsin874c9072021-12-25 14:01:52 +0500122 if "OPENSSL_VERSION=3.0." in ssl or ssl == "QUICTLS=yes":
William Lallemand64d6c092021-06-07 15:27:57 +0200123 flags.append('DEBUG_CFLAGS="-g -Wno-deprecated-declarations"')
Tim Duesterhus288c0772020-07-28 23:00:35 +0200124 if ssl != "stock":
125 flags.append("SSL_LIB=${HOME}/opt/lib")
126 flags.append("SSL_INC=${HOME}/opt/include")
127 matrix.append(
128 {
129 "name": "{}, {}, ssl={}".format(clean_os(os), CC, clean_ssl(ssl)),
130 "os": os,
131 "TARGET": TARGET,
132 "CC": CC,
133 "ssl": ssl,
134 "FLAGS": flags,
135 }
136 )
137
138# ASAN
139
140os = "ubuntu-latest"
141CC = "clang"
142TARGET = "linux-glibc"
143matrix.append(
144 {
145 "name": "{}, {}, ASAN, all features".format(clean_os(os), CC),
146 "os": os,
147 "TARGET": TARGET,
148 "CC": CC,
149 "FLAGS": get_asan_flags(CC)
150 + [
151 "USE_ZLIB=1",
Willy Tarreaued17ca72021-09-12 07:01:36 +0200152 "USE_OT=1",
Ilya Shipitsinb9e3fb72022-01-13 11:36:28 +0500153 "OT_INC=${HOME}/opt-ot/include",
154 "OT_LIB=${HOME}/opt-ot/lib",
Ilya Shipitsin75c95aa2021-05-18 09:46:43 +0000155 "OT_RUNPATH=1",
Tim Duesterhus288c0772020-07-28 23:00:35 +0200156 "USE_PCRE=1",
157 "USE_PCRE_JIT=1",
158 "USE_LUA=1",
159 "USE_OPENSSL=1",
160 "USE_SYSTEMD=1",
161 "USE_WURFL=1",
Willy Tarreau57610c62021-04-02 16:39:44 +0200162 "WURFL_INC=addons/wurfl/dummy",
163 "WURFL_LIB=addons/wurfl/dummy",
Tim Duesterhus288c0772020-07-28 23:00:35 +0200164 "USE_DEVICEATLAS=1",
Willy Tarreauf8d9ec52021-04-02 16:19:39 +0200165 "DEVICEATLAS_SRC=addons/deviceatlas/dummy",
Willy Tarreau3dfadc72021-04-02 15:35:19 +0200166 "USE_PROMEX=1",
Ilya Shipitsinb34aee82020-11-26 20:59:42 +0500167 "USE_51DEGREES=1",
Willy Tarreau977209d2021-04-02 16:12:32 +0200168 "51DEGREES_SRC=addons/51degrees/dummy/pattern",
Tim Duesterhus288c0772020-07-28 23:00:35 +0200169 ],
170 }
171)
172
173# macOS
174
175os = "macos-latest"
176TARGET = "osx"
177for CC in ["clang"]:
178 matrix.append(
179 {
180 "name": "{}, {}, no features".format(clean_os(os), CC),
181 "os": os,
182 "TARGET": TARGET,
183 "CC": CC,
184 "FLAGS": [],
185 }
186 )
187
188# Print matrix
189
190print(json.dumps(matrix, indent=4, sort_keys=True))
191
192print("::set-output name=matrix::{}".format(json.dumps({"include": matrix})))