Skip to content

Commit

Permalink
Upload generated packages on tmp/ci when building on branches.
Browse files Browse the repository at this point in the history
We need to be able to test our generated artefacts before we merge the
branches.
  • Loading branch information
mgautierfr committed Nov 16, 2022
1 parent ab42184 commit a44531b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
8 changes: 6 additions & 2 deletions .github/scripts/build_projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@
make_archive,
create_desktop_image,
fix_macos_rpath,
upload_archive,
OS_NAME,
PLATFORM_TARGET,
DESKTOP,
DEV_BRANCH,
)

if (PLATFORM_TARGET.startswith("android_")
Expand Down Expand Up @@ -40,8 +42,10 @@
for target in TARGETS:
run_kiwix_build(target, platform=PLATFORM_TARGET)
if target == "kiwix-desktop":
create_desktop_image(make_release=False)
archive = create_desktop_image(make_release=False)
else:
if PLATFORM_TARGET == "native_mixed" and OS_NAME == "osx":
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)
16 changes: 12 additions & 4 deletions .github/scripts/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@
MAKE_RELEASE = re.fullmatch(r"r_[0-9]+", _ref) is not None
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"

PLATFORM_TO_RELEASE = {
Expand Down Expand Up @@ -227,7 +232,7 @@ def upload(file_to_upload, host, dest_path):
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():
print_message("No archive {} to upload!", archive)
return
Expand All @@ -244,9 +249,12 @@ def upload_archive(archive, project, make_release):
else:
dest_path = dest_path + "nightly/" + DATE

# 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)
if dev_branch:
dest_path = "/data/tmp/ci/" + dev_branch
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)

Expand Down

0 comments on commit a44531b

Please sign in to comment.