Skip to content

Instantly share code, notes, and snippets.

@kevinAlbs
Last active February 8, 2023 19:43
Show Gist options
  • Save kevinAlbs/c0d85e621595a57af42b7423d9bee92c to your computer and use it in GitHub Desktop.
Save kevinAlbs/c0d85e621595a57af42b7423d9bee92c to your computer and use it in GitHub Desktop.
Suggested alternative for OpenSSL static testing. See https://github.com/mongodb/mongo-c-driver/pull/1201
from shrub.v3.evg_build_variant import BuildVariant
from shrub.v3.evg_task import EvgTaskRef
from config_generator.etc.distros import find_large_distro
from config_generator.etc.distros import make_distro_str
from config_generator.etc.distros import to_cc
from config_generator.etc.utils import EvgTaskWithRunOn
from config_generator.etc.sasl.compile import CompileCommon
from config_generator.components.funcs.upload_build import UploadBuild
SSL = 'openssl-static'
TAG = f'{SSL}'
# pylint: disable=line-too-long
# fmt: off
COMPILE_MATRIX = [
('debian92', 'gcc'),
('debian10', 'gcc'),
('debian11', 'gcc'),
('ubuntu2004', 'gcc'),
]
# fmt: on
# pylint: enable=line-too-long
class StaticOpenSSLCompileCommon(CompileCommon):
ssl = 'OPENSSL_STATIC'
class SaslOffStaticOpenSSLCompile(StaticOpenSSLCompileCommon):
name = 'openssl-static-compile'
commands = StaticOpenSSLCompileCommon.compile_commands(sasl='OFF')
def generate_compile_tasks(SSL, TAG, MATRIX):
res = []
for distro_name, compiler in MATRIX:
tags = [TAG, 'compile', distro_name, compiler, SSL]
distro = find_large_distro(distro_name)
compile_vars = None
compile_vars = {'CC': to_cc(compiler)}
distro_str = make_distro_str(distro_name, compiler, None)
task_name = f'{SSL}-{distro_str}-compile'
commands = []
commands.append(SaslOffStaticOpenSSLCompile.call(vars=compile_vars))
commands.append(UploadBuild.call())
res.append(
EvgTaskWithRunOn(
name=task_name,
run_on=distro.name,
tags=tags,
commands=commands,
)
)
return res
def functions():
return SaslOffStaticOpenSSLCompile.defn()
def tasks():
return generate_compile_tasks(SSL, TAG, COMPILE_MATRIX)
def variants():
expansions = {
'DEBUG': 'ON',
}
return [
BuildVariant(
name=TAG,
display_name=TAG,
tasks=[EvgTaskRef(name=f'.{TAG}')],
expansions=expansions,
),
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment