Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/scripts/archiveResults.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/usr/bin/python3

import os
import shutil
import sys

def copyFiles(libraryName, libVersion, branchOM, targetDir):
"""
Zip HTML files and save in target directory.

Arguments
libraryName -- Name of Modelica library.
libVersion -- Branch or version of Modelica library.
branchOM -- Branch or version of OpenModelica.
targetDir -- Target directory.
"""

libNameBranch = f"{libraryName}_{libVersion}"

shutil.copytree("files",
os.path.join(targetDir, branchOM, libNameBranch, "files"),
dirs_exist_ok = True)

shutil.copy2("overview.html",
os.path.join(targetDir, "index.html"))

# Copy library overview
shutil.copy2(f"{libNameBranch}.html",
os.path.join(targetDir, branchOM, libNameBranch, f"{libNameBranch}.html"))

# Copy dygraph script
shutil.copy2(os.path.join(".github", "scripts", "dygraph-combined.js"),
os.path.join(targetDir, branchOM, libNameBranch, "files", "dygraph-combined.js"))

if len(sys.argv) != 5:
raise Exception("Wrong number of input arguments.\nUsage:\narchieveResults.py libraryName libVersion branchOM omLibTestingDir zipFile")

libraryName = sys.argv[1]
libVersion = sys.argv[2]
branchOM = sys.argv[3]
targetDir = sys.argv[4]

# If running inside a pull request
if libVersion.endswith('/merge'):
libVersion = 'dev-pr-' + libVersion.replace('/merge', '')

copyFiles(libraryName, libVersion, branchOM, targetDir)
Loading