blob: e3334a0b38572d2d5104d05d3233b768380a3bfe [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",
Ilya Shipitsin75c95aa2021-05-18 09:46:43 +000076 "USE_OT=1",
77 "OT_INC=${HOME}/opt/include",
78 "OT_LIB=${HOME}/opt/lib",
79 "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 Shipitsinc3f28a32021-06-05 03:06:59 +0000113 "OPENSSL_VERSION=3.0.0-alpha17",
Tim Duesterhus288c0772020-07-28 23:00:35 +0200114 "LIBRESSL_VERSION=2.9.2",
Ilya Shipitsin04b57a72021-05-05 09:01:03 +0500115 "LIBRESSL_VERSION=3.3.3",
Willy Tarreau30ee2962021-09-02 17:32:43 +0200116# "BORINGSSL=yes",
Tim Duesterhus288c0772020-07-28 23:00:35 +0200117 ]:
118 flags = ["USE_OPENSSL=1"]
Ilya Shipitsin714f28c2021-05-09 21:27:28 +0500119 if ssl == "BORINGSSL=yes":
120 flags.append("USE_QUIC=1")
Ilya Shipitsinaf2720f2021-08-15 12:55:08 +0500121 if "OPENSSL_VERSION=3.0.0" in ssl:
William Lallemand64d6c092021-06-07 15:27:57 +0200122 flags.append('DEBUG_CFLAGS="-g -Wno-deprecated-declarations"')
Tim Duesterhus288c0772020-07-28 23:00:35 +0200123 if ssl != "stock":
124 flags.append("SSL_LIB=${HOME}/opt/lib")
125 flags.append("SSL_INC=${HOME}/opt/include")
126 matrix.append(
127 {
128 "name": "{}, {}, ssl={}".format(clean_os(os), CC, clean_ssl(ssl)),
129 "os": os,
130 "TARGET": TARGET,
131 "CC": CC,
132 "ssl": ssl,
133 "FLAGS": flags,
134 }
135 )
136
137# ASAN
138
139os = "ubuntu-latest"
140CC = "clang"
141TARGET = "linux-glibc"
142matrix.append(
143 {
144 "name": "{}, {}, ASAN, all features".format(clean_os(os), CC),
145 "os": os,
146 "TARGET": TARGET,
147 "CC": CC,
148 "FLAGS": get_asan_flags(CC)
149 + [
150 "USE_ZLIB=1",
Ilya Shipitsin75c95aa2021-05-18 09:46:43 +0000151 "USE_OT=1",
152 "OT_INC=${HOME}/opt/include",
153 "OT_LIB=${HOME}/opt/lib",
154 "OT_RUNPATH=1",
Tim Duesterhus288c0772020-07-28 23:00:35 +0200155 "USE_PCRE=1",
156 "USE_PCRE_JIT=1",
157 "USE_LUA=1",
158 "USE_OPENSSL=1",
159 "USE_SYSTEMD=1",
160 "USE_WURFL=1",
Willy Tarreau57610c62021-04-02 16:39:44 +0200161 "WURFL_INC=addons/wurfl/dummy",
162 "WURFL_LIB=addons/wurfl/dummy",
Tim Duesterhus288c0772020-07-28 23:00:35 +0200163 "USE_DEVICEATLAS=1",
Willy Tarreauf8d9ec52021-04-02 16:19:39 +0200164 "DEVICEATLAS_SRC=addons/deviceatlas/dummy",
Willy Tarreau3dfadc72021-04-02 15:35:19 +0200165 "USE_PROMEX=1",
Ilya Shipitsinb34aee82020-11-26 20:59:42 +0500166 "USE_51DEGREES=1",
Willy Tarreau977209d2021-04-02 16:12:32 +0200167 "51DEGREES_SRC=addons/51degrees/dummy/pattern",
Tim Duesterhus288c0772020-07-28 23:00:35 +0200168 ],
169 }
170)
171
172# macOS
173
174os = "macos-latest"
175TARGET = "osx"
176for CC in ["clang"]:
177 matrix.append(
178 {
179 "name": "{}, {}, no features".format(clean_os(os), CC),
180 "os": os,
181 "TARGET": TARGET,
182 "CC": CC,
183 "FLAGS": [],
184 }
185 )
186
187# Print matrix
188
189print(json.dumps(matrix, indent=4, sort_keys=True))
190
191print("::set-output name=matrix::{}".format(json.dumps({"include": matrix})))