From 8a9c2db6e32e813a780eeb759d310bb883ed1152 Mon Sep 17 00:00:00 2001 From: Martin Nowack Date: Wed, 2 Dec 2020 10:26:05 +0000 Subject: Rename `build-travis-container.py` into `build-ci-container.py` Update container build script to utilize Github Actions job description instead of Travis CI's. --- scripts/build/build-ci-container.py | 57 +++++++++++++++++++++++++++++ scripts/build/build-travis-container.py | 64 --------------------------------- 2 files changed, 57 insertions(+), 64 deletions(-) create mode 100755 scripts/build/build-ci-container.py delete mode 100755 scripts/build/build-travis-container.py (limited to 'scripts/build') diff --git a/scripts/build/build-ci-container.py b/scripts/build/build-ci-container.py new file mode 100755 index 00000000..c9264674 --- /dev/null +++ b/scripts/build/build-ci-container.py @@ -0,0 +1,57 @@ +#!/usr/bin/env python3 + +import yaml +import subprocess +import os + +(abs_path, _) = os.path.split(os.path.abspath(__file__)) + +with open(os.path.join(abs_path,"../../.github/workflows/build.yaml"), 'r') as stream: + try: + ci_config = yaml.safe_load(stream) + global_env = ci_config['env'] + print(ci_config['jobs']['Linux']['strategy']['matrix']['include']) + for job in ci_config['jobs']['Linux']['strategy']['matrix']['include']: + if job['name'] in ["Docker", "macOS"]: + print("Skip: {}".format(job['name'])) + continue + + print("Building: {}".format(job['name'])) + + build_env = os.environ.copy() + + # Copy current global build configurations + build_vars = dict(global_env) + + # Override with job specific values + for k,v in job['env'].items(): + build_vars[k] = v + + cmd = [os.path.join(abs_path, 'build.sh'), + 'klee', # build KLEE and all its dependencies + '--docker', # using docker containers + '--push-docker-deps', # push containers if possible + '--debug', # print debug output + '--create-final-image', # assume KLEE is the final image + ] + + env_str = ["{}={}".format(k,v) for k,v in build_vars.items()] + print("{} {}".format(" ".join(env_str)," ".join(cmd)) ) + + process = subprocess.Popen(cmd, # Assume KLEE is the final image + stdout=subprocess.PIPE, + universal_newlines=True, + env = build_env) + + while True: + output = process.stdout.readline() + print(output.strip()) + return_code = process.poll() + if return_code is not None: + print('Building image failed: {}'.format(return_code)) + for output in process.stdout.readlines(): + print(output.strip()) + break + + except yaml.YAMLError as exc: + print(exc) \ No newline at end of file diff --git a/scripts/build/build-travis-container.py b/scripts/build/build-travis-container.py deleted file mode 100755 index d2baf4a9..00000000 --- a/scripts/build/build-travis-container.py +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/env python3 - -import yaml -import subprocess -import os - -(abs_path, _) = os.path.split(os.path.abspath(__file__)) - -with open(os.path.join(abs_path,"../../.travis.yml"), 'r') as stream: - try: - travis_config = yaml.safe_load(stream) - global_env = travis_config['env']['global'] - for job in travis_config['jobs']['include']: - if job['name'] in ["Docker", "macOS"]: - print("Skip: {}".format(job['name'])) - continue - print("Building: {}".format(job['name'])) - - - # Copy current environment - build_env = os.environ.copy() - - build_vars = {} - # Setup global build variables - for e in global_env: - (k,v) = e.split("=") - build_vars[k] = v - - # Override with job specific values - for e in job['env'].strip("").split(" "): - (k,v) = e.split("=") - build_vars[k] = v - - for k,v in build_vars.items(): - build_env[k] = v - - cmd = [os.path.join(abs_path, 'build.sh'), - 'klee', # build KLEE and all its dependencies - '--docker', # using docker containers - '--push-docker-deps', # push containers if possible - '--debug', # print debug output - '--create-final-image', # assume KLEE is the final image - ] - - env_str = [k+"="+v for (k,v) in build_vars.items()] - print("{} {}".format(" ".join(env_str)," ".join(cmd)) ) - - process = subprocess.Popen(cmd, # Assume KLEE is the final image - stdout=subprocess.PIPE, - universal_newlines=True, - env = build_env) - - while True: - output = process.stdout.readline() - print(output.strip()) - return_code = process.poll() - if return_code is not None: - print('Building image failed: {}'.format(return_code)) - for output in process.stdout.readlines(): - print(output.strip()) - break - - except yaml.YAMLError as exc: - print(exc) \ No newline at end of file -- cgit 1.4.1