blob: 990031492c6332265457f4184ba8660dbc88ed11 [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",
Willy Tarreau57610c62021-04-02 16:39:44 +020080 "WURFL_INC=addons/wurfl/dummy",
81 "WURFL_LIB=addons/wurfl/dummy",
Tim Duesterhus288c0772020-07-28 23:00:35 +020082 "USE_DEVICEATLAS=1",
Willy Tarreauf8d9ec52021-04-02 16:19:39 +020083 "DEVICEATLAS_SRC=addons/deviceatlas/dummy",
Willy Tarreau3dfadc72021-04-02 15:35:19 +020084 "USE_PROMEX=1",
Ilya Shipitsinb34aee82020-11-26 20:59:42 +050085 "USE_51DEGREES=1",
Willy Tarreau977209d2021-04-02 16:12:32 +020086 "51DEGREES_SRC=addons/51degrees/dummy/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 Shipitsin04b57a72021-05-05 09:01:03 +0500108 "LIBRESSL_VERSION=3.3.3",
Willy Tarreau61cda6d2021-09-02 17:32:43 +0200109# "BORINGSSL=yes",
Tim Duesterhus288c0772020-07-28 23:00:35 +0200110 ]:
111 flags = ["USE_OPENSSL=1"]
Ilya Shipitsin714f28c2021-05-09 21:27:28 +0500112 if ssl == "BORINGSSL=yes":
113 flags.append("USE_QUIC=1")
Tim Duesterhus288c0772020-07-28 23:00:35 +0200114 if ssl != "stock":
115 flags.append("SSL_LIB=${HOME}/opt/lib")
116 flags.append("SSL_INC=${HOME}/opt/include")
117 matrix.append(
118 {
119 "name": "{}, {}, ssl={}".format(clean_os(os), CC, clean_ssl(ssl)),
120 "os": os,
121 "TARGET": TARGET,
122 "CC": CC,
123 "ssl": ssl,
124 "FLAGS": flags,
125 }
126 )
127
128# ASAN
129
130os = "ubuntu-latest"
131CC = "clang"
132TARGET = "linux-glibc"
133matrix.append(
134 {
135 "name": "{}, {}, ASAN, all features".format(clean_os(os), CC),
136 "os": os,
137 "TARGET": TARGET,
138 "CC": CC,
139 "FLAGS": get_asan_flags(CC)
140 + [
141 "USE_ZLIB=1",
142 "USE_PCRE=1",
143 "USE_PCRE_JIT=1",
144 "USE_LUA=1",
145 "USE_OPENSSL=1",
146 "USE_SYSTEMD=1",
147 "USE_WURFL=1",
Willy Tarreau57610c62021-04-02 16:39:44 +0200148 "WURFL_INC=addons/wurfl/dummy",
149 "WURFL_LIB=addons/wurfl/dummy",
Tim Duesterhus288c0772020-07-28 23:00:35 +0200150 "USE_DEVICEATLAS=1",
Willy Tarreauf8d9ec52021-04-02 16:19:39 +0200151 "DEVICEATLAS_SRC=addons/deviceatlas/dummy",
Willy Tarreau3dfadc72021-04-02 15:35:19 +0200152 "USE_PROMEX=1",
Ilya Shipitsinb34aee82020-11-26 20:59:42 +0500153 "USE_51DEGREES=1",
Willy Tarreau977209d2021-04-02 16:12:32 +0200154 "51DEGREES_SRC=addons/51degrees/dummy/pattern",
Tim Duesterhus288c0772020-07-28 23:00:35 +0200155 ],
156 }
157)
158
159# macOS
160
161os = "macos-latest"
162TARGET = "osx"
163for CC in ["clang"]:
164 matrix.append(
165 {
166 "name": "{}, {}, no features".format(clean_os(os), CC),
167 "os": os,
168 "TARGET": TARGET,
169 "CC": CC,
170 "FLAGS": [],
171 }
172 )
173
174# Print matrix
175
176print(json.dumps(matrix, indent=4, sort_keys=True))
177
178print("::set-output name=matrix::{}".format(json.dumps({"include": matrix})))