From 3685f6bfcf16a0232f437dd662d21b689fb7e240 Mon Sep 17 00:00:00 2001 From: Sammers21 Date: Wed, 12 Aug 2020 16:15:12 +0300 Subject: [PATCH] #18 - improveemtns --- Dockerfile | 1 - entry-point.py | 9 +++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7c18ba3..bcb03ea 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,4 @@ FROM hashicorp/terraform RUN apk add --no-cache python3 bash COPY . ./benchmarks -WORKDIR /benchmarks ENTRYPOINT ["/benchmarks/entry-point.py"] diff --git a/entry-point.py b/entry-point.py index 1cf4b2c..8b15846 100755 --- a/entry-point.py +++ b/entry-point.py @@ -1,6 +1,7 @@ #!/usr/bin/python3 import os +import sys import subprocess import collections.abc import json @@ -22,6 +23,9 @@ def dict_merge(dct, merge_dct): if __name__ == '__main__': + # If running as a Github Actions + os.chdir(sys.path[0]) + # Directories included into benchmarking suit directories = ["docker", "sample"] @@ -31,7 +35,7 @@ def dict_merge(dct, merge_dct): # Run benchmarks for each directory and collect everything into a single JSON for directory in directories: os.chdir(directory) - subprocess.run(["bash", "-x", "run.sh"]) + # subprocess.run(["bash", "-x", "run.sh"]) for bench_result in glob.glob("*benchmark-results.json"): with open(bench_result, "r") as file: dict_merge(result, json.loads(file.read())) @@ -41,4 +45,5 @@ def dict_merge(dct, merge_dct): with open("benchmark-results.json", "w+") as file: file.write(json.dumps(result, indent=4, sort_keys=True)) # Fill Github Action output variable - subprocess.run(["echo", f"::set-output name=report::benchmark-results.json"]) + abs = os.path.abspath("benchmark-results.json") + subprocess.run(["echo", f"::set-output name=report::{abs}"])