Tim Duesterhus | 871ef2f | 2021-06-08 15:14:35 +0200 | [diff] [blame] | 1 | #!/usr/bin/python3 |
| 2 | |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 3 | # 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 | |
| 11 | import json |
Tim Duesterhus | 8d173e1 | 2020-11-20 00:16:00 +0100 | [diff] [blame] | 12 | import sys |
| 13 | |
| 14 | if len(sys.argv) == 2: |
| 15 | build_type = sys.argv[1] |
| 16 | else: |
| 17 | print("Usage: {} <build_type>".format(sys.argv[0]), file=sys.stderr) |
| 18 | sys.exit(1) |
| 19 | |
| 20 | print("Generating matrix for type '{}'.".format(build_type)) |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 21 | |
| 22 | |
| 23 | def 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 | |
| 31 | def clean_ssl(ssl): |
| 32 | return ssl.replace("_VERSION", "").lower() |
| 33 | |
| 34 | |
| 35 | def clean_compression(compression): |
| 36 | return compression.replace("USE_", "").lower() |
| 37 | |
| 38 | |
| 39 | def 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 | |
| 51 | matrix = [] |
| 52 | |
| 53 | # Ubuntu |
| 54 | |
| 55 | os = "ubuntu-latest" |
| 56 | TARGET = "linux-glibc" |
| 57 | for 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 Shipitsin | 75c95aa | 2021-05-18 09:46:43 +0000 | [diff] [blame] | 76 | "USE_OT=1", |
| 77 | "OT_INC=${HOME}/opt/include", |
| 78 | "OT_LIB=${HOME}/opt/lib", |
| 79 | "OT_RUNPATH=1", |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 80 | "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 Tarreau | 57610c6 | 2021-04-02 16:39:44 +0200 | [diff] [blame] | 86 | "WURFL_INC=addons/wurfl/dummy", |
| 87 | "WURFL_LIB=addons/wurfl/dummy", |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 88 | "USE_DEVICEATLAS=1", |
Willy Tarreau | f8d9ec5 | 2021-04-02 16:19:39 +0200 | [diff] [blame] | 89 | "DEVICEATLAS_SRC=addons/deviceatlas/dummy", |
Willy Tarreau | 3dfadc7 | 2021-04-02 15:35:19 +0200 | [diff] [blame] | 90 | "USE_PROMEX=1", |
Ilya Shipitsin | b34aee8 | 2020-11-26 20:59:42 +0500 | [diff] [blame] | 91 | "USE_51DEGREES=1", |
Willy Tarreau | 977209d | 2021-04-02 16:12:32 +0200 | [diff] [blame] | 92 | "51DEGREES_SRC=addons/51degrees/dummy/pattern", |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 93 | ], |
| 94 | } |
| 95 | ) |
| 96 | |
Tim Duesterhus | 762b1fd | 2021-08-14 14:36:55 +0200 | [diff] [blame] | 97 | for compression in ["USE_ZLIB=1"]: |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 98 | 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 Shipitsin | c3f28a3 | 2021-06-05 03:06:59 +0000 | [diff] [blame] | 113 | "OPENSSL_VERSION=3.0.0-alpha17", |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 114 | "LIBRESSL_VERSION=2.9.2", |
Ilya Shipitsin | 04b57a7 | 2021-05-05 09:01:03 +0500 | [diff] [blame] | 115 | "LIBRESSL_VERSION=3.3.3", |
Willy Tarreau | 30ee296 | 2021-09-02 17:32:43 +0200 | [diff] [blame^] | 116 | # "BORINGSSL=yes", |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 117 | ]: |
| 118 | flags = ["USE_OPENSSL=1"] |
Ilya Shipitsin | 714f28c | 2021-05-09 21:27:28 +0500 | [diff] [blame] | 119 | if ssl == "BORINGSSL=yes": |
| 120 | flags.append("USE_QUIC=1") |
Ilya Shipitsin | af2720f | 2021-08-15 12:55:08 +0500 | [diff] [blame] | 121 | if "OPENSSL_VERSION=3.0.0" in ssl: |
William Lallemand | 64d6c09 | 2021-06-07 15:27:57 +0200 | [diff] [blame] | 122 | flags.append('DEBUG_CFLAGS="-g -Wno-deprecated-declarations"') |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 123 | 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 | |
| 139 | os = "ubuntu-latest" |
| 140 | CC = "clang" |
| 141 | TARGET = "linux-glibc" |
| 142 | matrix.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 Shipitsin | 75c95aa | 2021-05-18 09:46:43 +0000 | [diff] [blame] | 151 | "USE_OT=1", |
| 152 | "OT_INC=${HOME}/opt/include", |
| 153 | "OT_LIB=${HOME}/opt/lib", |
| 154 | "OT_RUNPATH=1", |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 155 | "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 Tarreau | 57610c6 | 2021-04-02 16:39:44 +0200 | [diff] [blame] | 161 | "WURFL_INC=addons/wurfl/dummy", |
| 162 | "WURFL_LIB=addons/wurfl/dummy", |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 163 | "USE_DEVICEATLAS=1", |
Willy Tarreau | f8d9ec5 | 2021-04-02 16:19:39 +0200 | [diff] [blame] | 164 | "DEVICEATLAS_SRC=addons/deviceatlas/dummy", |
Willy Tarreau | 3dfadc7 | 2021-04-02 15:35:19 +0200 | [diff] [blame] | 165 | "USE_PROMEX=1", |
Ilya Shipitsin | b34aee8 | 2020-11-26 20:59:42 +0500 | [diff] [blame] | 166 | "USE_51DEGREES=1", |
Willy Tarreau | 977209d | 2021-04-02 16:12:32 +0200 | [diff] [blame] | 167 | "51DEGREES_SRC=addons/51degrees/dummy/pattern", |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 168 | ], |
| 169 | } |
| 170 | ) |
| 171 | |
| 172 | # macOS |
| 173 | |
| 174 | os = "macos-latest" |
| 175 | TARGET = "osx" |
| 176 | for 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 | |
| 189 | print(json.dumps(matrix, indent=4, sort_keys=True)) |
| 190 | |
| 191 | print("::set-output name=matrix::{}".format(json.dumps({"include": matrix}))) |