blob: a4d1265f0ea4790ff03721230852087ffae1733f [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 Shipitsin6e7440b2022-03-27 10:51:51 +0500113 "OPENSSL_VERSION=3.0.2",
Tim Duesterhus288c0772020-07-28 23:00:35 +0200114 "LIBRESSL_VERSION=2.9.2",
Ilya Shipitsinc89dec32022-04-28 11:46:53 +0500115 "LIBRESSL_VERSION=3.5.2",
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")
Tim Duesterhus288c0772020-07-28 23:00:35 +0200122 if ssl != "stock":
123 flags.append("SSL_LIB=${HOME}/opt/lib")
124 flags.append("SSL_INC=${HOME}/opt/include")
125 matrix.append(
126 {
127 "name": "{}, {}, ssl={}".format(clean_os(os), CC, clean_ssl(ssl)),
128 "os": os,
129 "TARGET": TARGET,
130 "CC": CC,
131 "ssl": ssl,
132 "FLAGS": flags,
133 }
134 )
135
136# ASAN
137
138os = "ubuntu-latest"
139CC = "clang"
140TARGET = "linux-glibc"
141matrix.append(
142 {
143 "name": "{}, {}, ASAN, all features".format(clean_os(os), CC),
144 "os": os,
145 "TARGET": TARGET,
146 "CC": CC,
147 "FLAGS": get_asan_flags(CC)
148 + [
149 "USE_ZLIB=1",
Willy Tarreaued17ca72021-09-12 07:01:36 +0200150 "USE_OT=1",
Ilya Shipitsinb9e3fb72022-01-13 11:36:28 +0500151 "OT_INC=${HOME}/opt-ot/include",
152 "OT_LIB=${HOME}/opt-ot/lib",
Ilya Shipitsin75c95aa2021-05-18 09:46:43 +0000153 "OT_RUNPATH=1",
Tim Duesterhus288c0772020-07-28 23:00:35 +0200154 "USE_PCRE=1",
155 "USE_PCRE_JIT=1",
156 "USE_LUA=1",
157 "USE_OPENSSL=1",
158 "USE_SYSTEMD=1",
159 "USE_WURFL=1",
Willy Tarreau57610c62021-04-02 16:39:44 +0200160 "WURFL_INC=addons/wurfl/dummy",
161 "WURFL_LIB=addons/wurfl/dummy",
Tim Duesterhus288c0772020-07-28 23:00:35 +0200162 "USE_DEVICEATLAS=1",
Willy Tarreauf8d9ec52021-04-02 16:19:39 +0200163 "DEVICEATLAS_SRC=addons/deviceatlas/dummy",
Willy Tarreau3dfadc72021-04-02 15:35:19 +0200164 "USE_PROMEX=1",
Ilya Shipitsinb34aee82020-11-26 20:59:42 +0500165 "USE_51DEGREES=1",
Willy Tarreau977209d2021-04-02 16:12:32 +0200166 "51DEGREES_SRC=addons/51degrees/dummy/pattern",
Tim Duesterhus288c0772020-07-28 23:00:35 +0200167 ],
168 }
169)
170
171# macOS
172
173os = "macos-latest"
174TARGET = "osx"
175for CC in ["clang"]:
176 matrix.append(
177 {
178 "name": "{}, {}, no features".format(clean_os(os), CC),
179 "os": os,
180 "TARGET": TARGET,
181 "CC": CC,
182 "FLAGS": [],
183 }
184 )
185
186# Print matrix
187
188print(json.dumps(matrix, indent=4, sort_keys=True))
189
190print("::set-output name=matrix::{}".format(json.dumps({"include": matrix})))