From 33e7c5db745a84e71e0b333312a2bc36de52c3bd Mon Sep 17 00:00:00 2001 From: checktheroads Date: Sun, 16 Jun 2019 21:00:59 -0700 Subject: [PATCH] CI changes --- .travis.yml | 4 +++- ci/ci_prepare.py | 32 ++++++++++++++++++++++++++++++++ ci/ci_prepare.sh | 13 ------------- 3 files changed, 35 insertions(+), 14 deletions(-) create mode 100644 ci/ci_prepare.py delete mode 100644 ci/ci_prepare.sh diff --git a/.travis.yml b/.travis.yml index 03d9d5d..effa610 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,8 +12,10 @@ install: after_install: - bash ./ci/check_code.sh before_script: - - bash ./ci/ci_prepare.sh + - python3 ./ci/ci_prepare.py script: + - nohup python3 ./ci/ci_dev_server.py & + - sleep 20 - python3 ./ci/ci_test.py after_script: - bash ./ci/ci_commit.sh diff --git a/ci/ci_prepare.py b/ci/ci_prepare.py new file mode 100644 index 0000000..c39e642 --- /dev/null +++ b/ci/ci_prepare.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python3 + + +def ci_copy_config(): + """Copies test configuration files to usable config files""" + logger.info("Migrating test config files...") + config_dir = os.path.join(parent_directory, "hyperglass/configuration/") + test_files = glob.iglob(os.path.join(working_directory, "*.toml")) + config_files = glob.iglob(os.path.join(config_dir, "*.toml")) + logger.debug(config_dir) + logger.debug(working_directory) + logger.debug(parent_directory) + status = False + for f in config_files: + if os.path.exists(f): + logger.debug(f"{f} already exists") + os.remove(f) + logger.debug(f"Deleted {f}") + for f in test_files: + try: + shutil.copy(f, config_dir) + logger.debug(f"Copied {f}") + logger.info("Successfully migrated test config files") + status = True + except: + logger.error(f"Failed to migrate {f}") + raise + return status + + +if __name__ == "__main__": + ci_copy_config() diff --git a/ci/ci_prepare.sh b/ci/ci_prepare.sh deleted file mode 100644 index e3754a9..0000000 --- a/ci/ci_prepare.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -copy_config() { - rm ../hyperglass/configuration/*.toml - cp *.toml ../hyperglass/configuration/ -} - -start_flask() { - nohup python3 ./ci_dev_server.py & -} - -copy_config() -start_flask()