diff --git a/.github/scripts/build_definition.py b/.github/scripts/build_definition.py index 7a9675f..75caeb8 100644 --- a/.github/scripts/build_definition.py +++ b/.github/scripts/build_definition.py @@ -9,50 +9,53 @@ import csv, io, re # Lines composed of `-` , or `=`, or starting by `#` are ignored. # 'B' letter means that the project is build in the CI # 'd' letter means that the project's dependencies are build and published to be used by the project's CI. -# If a cell contains both, both are done. +# 'P' letter means that (build) project must be publish when we do a release. +# (This is used to avoid two publication of the same archive) +# 'S' letter means that source code must be publish (almost by definition, S should be put only with a P) +# If a cell contains several letters, all are done. BUILD_DEF = """ | OS_NAME | PLATFORM_TARGET | libzim | libkiwix | zim-tools | kiwix-tools | kiwix-desktop | ============================================================================================== # Bionic is a special case as we need to compile libzim on old arch for python - | bionic | | B | | | | | + | bionic | | BP | | | | | ---------------------------------------------------------------------------------------------- # Osx builds, build binaries on native_dyn and native_static. On anyother things, build only the libraries | macos | native_dyn | d | d | dB | B | | - | macos | native_static | | | B | B | | - | macos | native_mixed | B | B | | | | + | macos | native_static | | | BP | BP | | + | macos | native_mixed | BP | BP | | | | | macos | iOS_arm64 | dB | B | | | | | macos | iOS_x86_64 | dB | B | | | | | macos | iOS_Mac_ABI | B | B | | | | | macos | macOS_arm64_static | | | | | | - | macos | macOS_arm64_mixed | B | B | | | | + | macos | macOS_arm64_mixed | BP | BP | | | | | macos | macOS_x86_64 | B | B | | | | ---------------------------------------------------------------------------------------------- - | | flatpak | | | | | B | - | | native_static | d | d | dB | dB | | - | | native_dyn | d | d | dB | dB | B | - | | native_mixed | B | B | | | | + | | flatpak | | | | | BP | + | | native_static | d | d | dBPS | dBPS | | + | | native_dyn | d | d | dB | dB | BPS | + | | native_mixed | BPS | BPS | | | | # libzim CI is building alpine_dyn but not us - | | android_arm | dB | dB | | | | - | | android_arm64 | dB | dB | | | | - | | android_x86 | B | B | | | | - | | android_x86_64 | B | B | | | | - | | armv6_static | | | B | B | | + | | android_arm | dBP | dBP | | | | + | | android_arm64 | dBP | dBP | | | | + | | android_x86 | BP | BP | | | | + | | android_x86_64 | BP | BP | | | | + | | armv6_static | | | BP | BP | | | | armv6_dyn | | | B | B | | - | | armv6_mixed | B | | | | | - | | armv8_static | | | B | B | | + | | armv6_mixed | BP | | | | | + | | armv8_static | | | BP | BP | | | | armv8_dyn | | | B | B | | - | | armv8_mixed | B | | | | | - | | aarch64_static | | | B | B | | + | | armv8_mixed | BP | | | | | + | | aarch64_static | | | BP | BP | | | | aarch64_dyn | d | | B | B | | - | | aarch64_mixed | B | | | | | - | | aarch64_musl_static| | | B | B | | + | | aarch64_mixed | BP | | | | | + | | aarch64_musl_static| | | BP | BP | | | | aarch64_musl_dyn | d | | B | B | | - | | aarch64_musl_mixed | B | | | | | - | | win32_static | d | dB | dB | dB | | + | | aarch64_musl_mixed | BP | | | | | + | | win32_static | d | dB | dBP | dBP | | | | win32_dyn | d | dB | dB | dB | | - | | i586_static | | | B | B | | + | | i586_static | | | BP | BP | | | | i586_dyn | | | B | B | | - | | wasm | dB | | | | | + | | wasm | dBP | | | | | """ @@ -96,6 +99,8 @@ class Context(NamedTuple): BUILD = "B" +PUBLISH = "P" +SOURCE_PUBLISH = "S" DEPS = "d" def select_build_targets(criteria): diff --git a/.github/scripts/build_release_nightly.py b/.github/scripts/build_release_nightly.py index c8503d9..88eada3 100755 --- a/.github/scripts/build_release_nightly.py +++ b/.github/scripts/build_release_nightly.py @@ -19,15 +19,19 @@ from common import ( notarize_macos_build, ) -from build_definition import select_build_targets, BUILD +from build_definition import select_build_targets, BUILD, PUBLISH, SOURCE_PUBLISH + + -TARGETS = select_build_targets(BUILD) # Filter what to build if we are doing a release. if MAKE_RELEASE: + TARGETS = select_build_targets(PUBLISH) def release_filter(project): return release_versions.get(project) is not None TARGETS = tuple(filter(release_filter, TARGETS)) +else: + TARGETS = select_build_targets(BUILD) for target in TARGETS: run_kiwix_build(target, platform=PLATFORM_TARGET, make_release=MAKE_RELEASE) @@ -46,26 +50,31 @@ for target in TARGETS: # We have few more things to do for release: if MAKE_RELEASE: # Publish source archives - if PLATFORM_TARGET in ("native_dyn", "native_mixed") and OS_NAME != "macos": - for target in TARGETS: - if release_versions.get(target) != 0: - continue - run_kiwix_build( - target, platform=PLATFORM_TARGET, make_release=MAKE_RELEASE, make_dist=True + source_published_targets = select_build_targets(SOURCE_PUBLISH) + for target in TARGETS: + # Looping on TARGETS instead of source_published_targets ensures we are + # publishing sources only for target we are building. + # (source_published_targets must be a subset of TARGETS) + if release_versions.get(target) != 0: + continue + if target not in source_published_targets: + continue + run_kiwix_build( + target, platform=PLATFORM_TARGET, make_release=MAKE_RELEASE, make_dist=True + ) + full_target_name = "{}-{}".format(target, main_project_versions[target]) + if target == "kiwix-desktop": + archive = ( + BASE_DIR / full_target_name / "{}.tar.gz".format(full_target_name) ) - full_target_name = "{}-{}".format(target, main_project_versions[target]) - if target == "kiwix-desktop": - archive = ( - BASE_DIR / full_target_name / "{}.tar.gz".format(full_target_name) - ) - else: - archive = ( - BASE_DIR - / full_target_name - / "meson-dist" - / "{}.tar.xz".format(full_target_name) - ) - upload_archive(archive, target, make_release=MAKE_RELEASE) + else: + archive = ( + BASE_DIR + / full_target_name + / "meson-dist" + / "{}.tar.xz".format(full_target_name) + ) + upload_archive(archive, target, make_release=MAKE_RELEASE) # Publish flathub if PLATFORM_TARGET == "flatpak" and "kiwix-desktop" in TARGETS: