Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 1 | # 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 | |
| 9 | import json |
Tim Duesterhus | 8d173e1 | 2020-11-20 00:16:00 +0100 | [diff] [blame] | 10 | import sys |
| 11 | |
| 12 | if len(sys.argv) == 2: |
| 13 | build_type = sys.argv[1] |
| 14 | else: |
| 15 | print("Usage: {} <build_type>".format(sys.argv[0]), file=sys.stderr) |
| 16 | sys.exit(1) |
| 17 | |
| 18 | print("Generating matrix for type '{}'.".format(build_type)) |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 19 | |
| 20 | |
| 21 | def 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 | |
| 29 | def clean_ssl(ssl): |
| 30 | return ssl.replace("_VERSION", "").lower() |
| 31 | |
| 32 | |
| 33 | def clean_compression(compression): |
| 34 | return compression.replace("USE_", "").lower() |
| 35 | |
| 36 | |
| 37 | def 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 | |
| 49 | matrix = [] |
| 50 | |
| 51 | # Ubuntu |
| 52 | |
| 53 | os = "ubuntu-latest" |
| 54 | TARGET = "linux-glibc" |
| 55 | for 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 Shipitsin | 73c3ed9 | 2021-05-18 09:46:43 +0000 | [diff] [blame] | 74 | "USE_OT=1", |
Ilya Shipitsin | ef86b47 | 2022-01-13 11:36:28 +0500 | [diff] [blame] | 75 | "OT_INC=${HOME}/opt-ot/include", |
| 76 | "OT_LIB=${HOME}/opt-ot/lib", |
Ilya Shipitsin | 73c3ed9 | 2021-05-18 09:46:43 +0000 | [diff] [blame] | 77 | "OT_RUNPATH=1", |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 78 | "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 Tarreau | 57610c6 | 2021-04-02 16:39:44 +0200 | [diff] [blame] | 84 | "WURFL_INC=addons/wurfl/dummy", |
| 85 | "WURFL_LIB=addons/wurfl/dummy", |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 86 | "USE_DEVICEATLAS=1", |
Willy Tarreau | f8d9ec5 | 2021-04-02 16:19:39 +0200 | [diff] [blame] | 87 | "DEVICEATLAS_SRC=addons/deviceatlas/dummy", |
Willy Tarreau | 3dfadc7 | 2021-04-02 15:35:19 +0200 | [diff] [blame] | 88 | "USE_PROMEX=1", |
Ilya Shipitsin | b34aee8 | 2020-11-26 20:59:42 +0500 | [diff] [blame] | 89 | "USE_51DEGREES=1", |
Willy Tarreau | 977209d | 2021-04-02 16:12:32 +0200 | [diff] [blame] | 90 | "51DEGREES_SRC=addons/51degrees/dummy/pattern", |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 91 | ], |
| 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 Shipitsin | 9c87255 | 2021-12-25 14:01:52 +0500 | [diff] [blame] | 111 | "OPENSSL_VERSION=3.0.1", |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 112 | "LIBRESSL_VERSION=2.9.2", |
Ilya Shipitsin | 0b49cfb | 2022-03-16 12:10:47 +0500 | [diff] [blame^] | 113 | "LIBRESSL_VERSION=3.5.1", |
Willy Tarreau | 61cda6d | 2021-09-02 17:32:43 +0200 | [diff] [blame] | 114 | # "BORINGSSL=yes", |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 115 | ]: |
| 116 | flags = ["USE_OPENSSL=1"] |
Ilya Shipitsin | 714f28c | 2021-05-09 21:27:28 +0500 | [diff] [blame] | 117 | if ssl == "BORINGSSL=yes": |
| 118 | flags.append("USE_QUIC=1") |
Ilya Shipitsin | 9c87255 | 2021-12-25 14:01:52 +0500 | [diff] [blame] | 119 | if "OPENSSL_VERSION=3.0." in ssl: |
William Lallemand | d8580d9 | 2021-06-07 15:27:57 +0200 | [diff] [blame] | 120 | flags.append('DEBUG_CFLAGS="-g -Wno-deprecated-declarations"') |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 121 | 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 | |
| 137 | os = "ubuntu-latest" |
| 138 | CC = "clang" |
| 139 | TARGET = "linux-glibc" |
| 140 | matrix.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 Shipitsin | 73c3ed9 | 2021-05-18 09:46:43 +0000 | [diff] [blame] | 149 | "USE_OT=1", |
Ilya Shipitsin | ef86b47 | 2022-01-13 11:36:28 +0500 | [diff] [blame] | 150 | "OT_INC=${HOME}/opt-ot/include", |
| 151 | "OT_LIB=${HOME}/opt-ot/lib", |
Ilya Shipitsin | 73c3ed9 | 2021-05-18 09:46:43 +0000 | [diff] [blame] | 152 | "OT_RUNPATH=1", |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 153 | "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 Tarreau | 57610c6 | 2021-04-02 16:39:44 +0200 | [diff] [blame] | 159 | "WURFL_INC=addons/wurfl/dummy", |
| 160 | "WURFL_LIB=addons/wurfl/dummy", |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 161 | "USE_DEVICEATLAS=1", |
Willy Tarreau | f8d9ec5 | 2021-04-02 16:19:39 +0200 | [diff] [blame] | 162 | "DEVICEATLAS_SRC=addons/deviceatlas/dummy", |
Willy Tarreau | 3dfadc7 | 2021-04-02 15:35:19 +0200 | [diff] [blame] | 163 | "USE_PROMEX=1", |
Ilya Shipitsin | b34aee8 | 2020-11-26 20:59:42 +0500 | [diff] [blame] | 164 | "USE_51DEGREES=1", |
Willy Tarreau | 977209d | 2021-04-02 16:12:32 +0200 | [diff] [blame] | 165 | "51DEGREES_SRC=addons/51degrees/dummy/pattern", |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 166 | ], |
| 167 | } |
| 168 | ) |
| 169 | |
| 170 | # macOS |
| 171 | |
| 172 | os = "macos-latest" |
| 173 | TARGET = "osx" |
| 174 | for 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 | |
| 187 | print(json.dumps(matrix, indent=4, sort_keys=True)) |
| 188 | |
| 189 | print("::set-output name=matrix::{}".format(json.dumps({"include": matrix}))) |