CI changes

This commit is contained in:
checktheroads 2019-06-16 21:00:59 -07:00
parent ad061c886b
commit 33e7c5db74
3 changed files with 35 additions and 14 deletions

View file

@ -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

32
ci/ci_prepare.py Normal file
View file

@ -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()

View file

@ -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()