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", |
| 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 Tarreau | 57610c6 | 2021-04-02 16:39:44 +0200 | [diff] [blame] | 80 | "WURFL_INC=addons/wurfl/dummy", |
| 81 | "WURFL_LIB=addons/wurfl/dummy", |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 82 | "USE_DEVICEATLAS=1", |
Willy Tarreau | f8d9ec5 | 2021-04-02 16:19:39 +0200 | [diff] [blame] | 83 | "DEVICEATLAS_SRC=addons/deviceatlas/dummy", |
Willy Tarreau | 3dfadc7 | 2021-04-02 15:35:19 +0200 | [diff] [blame] | 84 | "USE_PROMEX=1", |
Ilya Shipitsin | b34aee8 | 2020-11-26 20:59:42 +0500 | [diff] [blame] | 85 | "USE_51DEGREES=1", |
Willy Tarreau | 977209d | 2021-04-02 16:12:32 +0200 | [diff] [blame] | 86 | "51DEGREES_SRC=addons/51degrees/dummy/pattern", |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 87 | ], |
| 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 Shipitsin | 04b57a7 | 2021-05-05 09:01:03 +0500 | [diff] [blame] | 108 | "LIBRESSL_VERSION=3.3.3", |
Willy Tarreau | 61cda6d | 2021-09-02 17:32:43 +0200 | [diff] [blame] | 109 | # "BORINGSSL=yes", |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 110 | ]: |
| 111 | flags = ["USE_OPENSSL=1"] |
Ilya Shipitsin | 714f28c | 2021-05-09 21:27:28 +0500 | [diff] [blame] | 112 | if ssl == "BORINGSSL=yes": |
| 113 | flags.append("USE_QUIC=1") |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 114 | 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 | |
| 130 | os = "ubuntu-latest" |
| 131 | CC = "clang" |
| 132 | TARGET = "linux-glibc" |
| 133 | matrix.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 Tarreau | 57610c6 | 2021-04-02 16:39:44 +0200 | [diff] [blame] | 148 | "WURFL_INC=addons/wurfl/dummy", |
| 149 | "WURFL_LIB=addons/wurfl/dummy", |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 150 | "USE_DEVICEATLAS=1", |
Willy Tarreau | f8d9ec5 | 2021-04-02 16:19:39 +0200 | [diff] [blame] | 151 | "DEVICEATLAS_SRC=addons/deviceatlas/dummy", |
Willy Tarreau | 3dfadc7 | 2021-04-02 15:35:19 +0200 | [diff] [blame] | 152 | "USE_PROMEX=1", |
Ilya Shipitsin | b34aee8 | 2020-11-26 20:59:42 +0500 | [diff] [blame] | 153 | "USE_51DEGREES=1", |
Willy Tarreau | 977209d | 2021-04-02 16:12:32 +0200 | [diff] [blame] | 154 | "51DEGREES_SRC=addons/51degrees/dummy/pattern", |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 155 | ], |
| 156 | } |
| 157 | ) |
| 158 | |
| 159 | # macOS |
| 160 | |
| 161 | os = "macos-latest" |
| 162 | TARGET = "osx" |
| 163 | for 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 | |
| 176 | print(json.dumps(matrix, indent=4, sort_keys=True)) |
| 177 | |
| 178 | print("::set-output name=matrix::{}".format(json.dumps({"include": matrix}))) |