more files

This commit is contained in:
Maxim Prokhorov
2021-02-22 22:53:10 +03:00
parent 298ef76fd8
commit fb26e23030
+10 -10
View File
@@ -2,12 +2,15 @@ import os
import enum
import subprocess
class CannotArchive(Exception):
pass
class UnhandledEvent(Exception):
pass
def cmd(*, env, pio_can_fail):
built = False
try:
@@ -16,12 +19,9 @@ def cmd(*, env, pio_can_fail):
except subprocess.CalledProcessError:
if not pio_can_fail:
raise
output = "build_output"
dirs = [
os.path.join(output, "bin"),
os.path.join(output, "debug")
]
dirs = [os.path.join(output, "bin"), os.path.join(output, "debug")]
# Notice that we also have build_output/reject containing .elf that cannot
# be made into a flashable .bin
@@ -29,21 +29,21 @@ def cmd(*, env, pio_can_fail):
archive = "ESPEasy_{}.zip".format(env)
if built:
if not all([os.path.isdir(d) for d in dirs]):
raise CannotArchive("Built, but build_output does not have expected directories")
raise CannotArchive(
"Built, but build_output does not have expected directories"
)
cmd = ["zip", "-q", "-rr", archive]
cmd.extend(dirs)
subprocess.check_call(cmd)
if __name__ == "__main__":
ref = os.environ["GITHUB_REF"]
event = os.environ["GITHUB_EVENT_NAME"]
# allow release build to fail and not produce an artifact
opts = {
"env": os.environ["ENV"],
"pio_can_fail": False
}
opts = {"env": os.environ["ENV"], "pio_can_fail": False}
if event == "push" and "/tags/" in ref:
opts["pio_can_fail"] = True