Skip to content

Commit

Permalink
artipie#18 - improveemtns
Browse files Browse the repository at this point in the history
  • Loading branch information
Sammers21 committed Aug 12, 2020
1 parent de76be4 commit 3685f6b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
FROM hashicorp/terraform
RUN apk add --no-cache python3 bash
COPY . ./benchmarks
WORKDIR /benchmarks
ENTRYPOINT ["/benchmarks/entry-point.py"]
9 changes: 7 additions & 2 deletions entry-point.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/python3

import os
import sys
import subprocess
import collections.abc
import json
Expand All @@ -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"]

Expand All @@ -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()))
Expand All @@ -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}"])

0 comments on commit 3685f6b

Please sign in to comment.