Upload generated packages on `tmp/ci` when building on branches.
We need to be able to test our generated artefacts before we merge the branches.
This commit is contained in:
parent
ab421848c5
commit
a44531bb8a
|
@ -6,9 +6,11 @@ from common import (
|
||||||
make_archive,
|
make_archive,
|
||||||
create_desktop_image,
|
create_desktop_image,
|
||||||
fix_macos_rpath,
|
fix_macos_rpath,
|
||||||
|
upload_archive,
|
||||||
OS_NAME,
|
OS_NAME,
|
||||||
PLATFORM_TARGET,
|
PLATFORM_TARGET,
|
||||||
DESKTOP,
|
DESKTOP,
|
||||||
|
DEV_BRANCH,
|
||||||
)
|
)
|
||||||
|
|
||||||
if (PLATFORM_TARGET.startswith("android_")
|
if (PLATFORM_TARGET.startswith("android_")
|
||||||
|
@ -40,8 +42,10 @@ else:
|
||||||
for target in TARGETS:
|
for target in TARGETS:
|
||||||
run_kiwix_build(target, platform=PLATFORM_TARGET)
|
run_kiwix_build(target, platform=PLATFORM_TARGET)
|
||||||
if target == "kiwix-desktop":
|
if target == "kiwix-desktop":
|
||||||
create_desktop_image(make_release=False)
|
archive = create_desktop_image(make_release=False)
|
||||||
else:
|
else:
|
||||||
if PLATFORM_TARGET == "native_mixed" and OS_NAME == "osx":
|
if PLATFORM_TARGET == "native_mixed" and OS_NAME == "osx":
|
||||||
fix_macos_rpath(target)
|
fix_macos_rpath(target)
|
||||||
make_archive(target, make_release=False)
|
archive = make_archive(target, make_release=False)
|
||||||
|
if archive:
|
||||||
|
upload_archive(archive, target, make_release=False, dev_branch=DEV_BRANCH)
|
||||||
|
|
|
@ -39,6 +39,11 @@ _ref = _environ.get("GITHUB_REF", "").split("/")[-1]
|
||||||
MAKE_RELEASE = re.fullmatch(r"r_[0-9]+", _ref) is not None
|
MAKE_RELEASE = re.fullmatch(r"r_[0-9]+", _ref) is not None
|
||||||
MAKE_RELEASE = MAKE_RELEASE and (_environ.get('GITHUB_EVENT_NAME') != 'schedule')
|
MAKE_RELEASE = MAKE_RELEASE and (_environ.get('GITHUB_EVENT_NAME') != 'schedule')
|
||||||
|
|
||||||
|
if not MAKE_RELEASE and _ref != "master":
|
||||||
|
DEV_BRANCH = _ref
|
||||||
|
else:
|
||||||
|
DEV_BRANCH = None
|
||||||
|
|
||||||
RELEASE_OS_NAME = "macos" if OS_NAME == "osx" else "linux"
|
RELEASE_OS_NAME = "macos" if OS_NAME == "osx" else "linux"
|
||||||
|
|
||||||
PLATFORM_TO_RELEASE = {
|
PLATFORM_TO_RELEASE = {
|
||||||
|
@ -227,7 +232,7 @@ def upload(file_to_upload, host, dest_path):
|
||||||
subprocess.check_call(command)
|
subprocess.check_call(command)
|
||||||
|
|
||||||
|
|
||||||
def upload_archive(archive, project, make_release):
|
def upload_archive(archive, project, make_release, dev_branch=None):
|
||||||
if not archive.exists():
|
if not archive.exists():
|
||||||
print_message("No archive {} to upload!", archive)
|
print_message("No archive {} to upload!", archive)
|
||||||
return
|
return
|
||||||
|
@ -244,9 +249,12 @@ def upload_archive(archive, project, make_release):
|
||||||
else:
|
else:
|
||||||
dest_path = dest_path + "nightly/" + DATE
|
dest_path = dest_path + "nightly/" + DATE
|
||||||
|
|
||||||
# Make the archive read only. This way, scp will preserve rights.
|
if dev_branch:
|
||||||
# If somehow we try to upload twice the same archive, scp will fails.
|
dest_path = "/data/tmp/ci/" + dev_branch
|
||||||
archive.chmod(0o444)
|
else:
|
||||||
|
# Make the archive read only. This way, scp will preserve rights.
|
||||||
|
# If somehow we try to upload twice the same archive, scp will fails.
|
||||||
|
archive.chmod(0o444)
|
||||||
|
|
||||||
upload(archive, host, dest_path)
|
upload(archive, host, dest_path)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue