diff --git a/.github/scripts/ext-arch.sh b/.github/scripts/ext-arch.sh index 90318451..84a2a98f 100755 --- a/.github/scripts/ext-arch.sh +++ b/.github/scripts/ext-arch.sh @@ -57,9 +57,12 @@ publish() { echo "CHLOG:Published arch package of $PACKAGE_NAME in $STAGE $DISTRO $CODENAME $ARCH (dry-run)" } -# Create repo dist file - for new repository -generate_reprepro_dist() { - echo "function called: ${FUNCNAME[0]}" +archive_setup_scripts() { + echo "function called: ${FUNCNAME[0]}" +} + +archive_cleanup_scripts() { + echo "function called: ${FUNCNAME[0]}" } # Setup repo layout @@ -67,4 +70,5 @@ setup() { echo "function called: ${FUNCNAME[0]}" source_setup_scripts + archive_setup_scripts } diff --git a/.github/scripts/ext-debian.sh b/.github/scripts/ext-debian.sh index 1f94d3a9..e1fac31c 100755 --- a/.github/scripts/ext-debian.sh +++ b/.github/scripts/ext-debian.sh @@ -9,7 +9,7 @@ set -o errexit # Update the changelog to specify the target distribution codename update_changelog() { set -x - cd "${PKG_BUILD_DIR:?}/$PACKAGE_NAME" + cd "${PKG_BUILD_PATH:?}/$PACKAGE_NAME" version=$(dpkg-parsechangelog --show-field Version) dch --force-distribution --distribution "$CODENAME" --newversion "${version}-1regolith-$CODENAME" "Automated Voulage release" @@ -18,12 +18,13 @@ update_changelog() { # Determine if the changelog has the correct distribution codename dist_valid() { - cd "${PKG_BUILD_DIR:?}/$PACKAGE_NAME" + cd "${PKG_BUILD_PATH:?}/$PACKAGE_NAME" TOP_CHANGELOG_LINE=$(head -n 1 debian/changelog) CHANGELOG_DIST=$(echo "$TOP_CHANGELOG_LINE" | cut -d' ' -f3) cd - >/dev/null 2>&1 + # echo "Checking $CODENAME and $CHANGELOG_DIST" if [[ "$CHANGELOG_DIST" == *"$CODENAME"* ]]; then return 0 @@ -36,14 +37,42 @@ stage_source() { pushd . echo "Preparing source for $PACKAGE_NAME" - cd "$PKG_BUILD_DIR/$PACKAGE_NAME" || exit + cd "$PKG_BUILD_PATH/$PACKAGE_NAME" || exit debian_package_name=$(dpkg-parsechangelog --show-field Source) full_version=$(dpkg-parsechangelog --show-field Version) debian_version="${full_version%-*}" - cd "$PKG_BUILD_DIR" || exit + cd "$PKG_BUILD_PATH" || exit echo "Generating source tarball from git repo." - tar --force-local -c -z -v -f "${debian_package_name}_${debian_version}.orig.tar.gz" --exclude .git\* --exclude /debian "$PACKAGE_NAME" + tar --force-local -c -z -v -f "${debian_package_name}_${debian_version}.orig.tar.gz" --exclude .git\* --exclude debian "$PACKAGE_NAME" + + if [ "$LOCAL_BUILD" == "false" ]; then + debian_package_name_indicator="${debian_package_name:0:1}" + if [ "${debian_package_name:0:3}" == "lib" ]; then + debian_package_name_indicator="${debian_package_name:0:4}" + fi + + # try to download the .orig.tar.gz from existing archive, and check if they are identical or not + wget -O "${debian_package_name}_${debian_version}-existing.orig.tar.gz" "http://archive.regolith-desktop.com/$DISTRO/$SUITE/pool/main/${debian_package_name_indicator}/${debian_package_name}/${debian_package_name}_${debian_version}.orig.tar.gz" || true + + if [ -s "${debian_package_name}_${debian_version}-existing.orig.tar.gz" ]; then + if ! diff <(tar -tvzf "${debian_package_name}_${debian_version}.orig.tar.gz" | awk '{printf "%10s %s\n",$3,$6}' | sort -k 2 | sed 's|\./||') <(tar -tvzf "${debian_package_name}_${debian_version}-existing.orig.tar.gz" | awk '{printf "%10s %s\n",$3,$6}' | sort -k 2 | sed 's|\./||') ; then + # existing .orig.tar.gz file is different that the one we just built + # keep the one we just built and override push it to the repository. + rm -f "${debian_package_name}_${debian_version}-existing.orig.tar.gz" || true + + echo "SRCLOG:$DISTRO=$CODENAME=$SUITE=${debian_package_name:0:1}=${debian_package_name}=${debian_package_name}_${debian_version}=${debian_package_name}_${debian_version}.orig.tar.gz" + else + # both .orig.tar.gz files are identical! + # remove the one we just built and reuse the existign one. + rm -f "${debian_package_name}_${debian_version}.orig.tar.gz" || true + mv "${debian_package_name}_${debian_version}-existing.orig.tar.gz" "${debian_package_name}_${debian_version}.orig.tar.gz" + fi + else + # there's no existing .orig.tar.gz file! Clean up the empty downloaded file. + rm -f "${debian_package_name}_${debian_version}-existing.orig.tar.gz" || true + fi + fi popd } @@ -53,10 +82,11 @@ build_src_package() { pushd . echo "Building source package $PACKAGE_NAME" - cd "$PKG_BUILD_DIR/$PACKAGE_NAME" || exit + cd "$PKG_BUILD_PATH/$PACKAGE_NAME" || exit sanitize_git - sudo apt update + + sudo apt update sudo apt build-dep -y . debuild -S -sa @@ -68,108 +98,123 @@ build_bin_package() { pushd . echo "Building binary package $PACKAGE_NAME" - cd "$PKG_BUILD_DIR/$PACKAGE_NAME" || exit + cd "$PKG_BUILD_PATH/$PACKAGE_NAME" || exit debuild -sa -b popd } -# Internal (private) function -source_pkg_exists() { - SRC_PKG_VERSION=$(reprepro --basedir "$PKG_REPO_PATH" list "$CODENAME" "$1" | cut -d' ' -f3) - - SRC_PKG_BUILD_VERSION=$(echo $2 | cut -d'-' -f1) - SRC_PKG_REPO_VERSION=$(echo $SRC_PKG_VERSION | cut -d'-' -f1) - - if [ "$SRC_PKG_REPO_VERSION" == "$SRC_PKG_BUILD_VERSION" ]; then - return 0 - else - return 1 - fi -} - publish() { - cd "${PKG_BUILD_DIR:?}/$PACKAGE_NAME" + cd "${PKG_BUILD_PATH:?}/$PACKAGE_NAME" version=$(dpkg-parsechangelog --show-field Version) debian_package_name=$(dpkg-parsechangelog --show-field Source) - cd "$PKG_BUILD_DIR" + cd "$PKG_BUILD_PATH" - DEB_SRC_PKG_PATH="$PKG_BUILD_DIR/${debian_package_name}_${version}_source.changes" + DEB_SRC_PKG_PATH="$(pwd)/${debian_package_name}_${version}_source.changes" if [ ! -f "$DEB_SRC_PKG_PATH" ]; then echo "Failed to find changes file." - fi - - if source_pkg_exists "$debian_package_name" "$version"; then - echo "Ignoring source package, already exists in target repository" - allow_failing_bin_package="true" else - echo "Ingesting source package $debian_package_name into $PKG_REPO_PATH" - reprepro --basedir "$PKG_REPO_PATH" include "$CODENAME" "$DEB_SRC_PKG_PATH" - allow_failing_bin_package="false" + short_version="${version%-*}" + + mkdir -p $PKG_PUBLISH_PATH/$DISTRO/$CODENAME/$SUITE + + cp "$(pwd)/${debian_package_name}_${version}.dsc" "$PKG_PUBLISH_PATH/$DISTRO/$CODENAME/$SUITE" + cp "$(pwd)/${debian_package_name}_${short_version}.orig.tar.gz" "$PKG_PUBLISH_PATH/$DISTRO/$CODENAME/$SUITE" + + if [ -f "$(pwd)/${debian_package_name}_${version}.debian.tar.xz" ]; then + cp "$(pwd)/${debian_package_name}_${version}.debian.tar.xz" "$PKG_PUBLISH_PATH/$DISTRO/$CODENAME/$SUITE" + fi + if [ -f "$(pwd)/${debian_package_name}_${version}.diff.gz" ]; then + cp "$(pwd)/${debian_package_name}_${version}.diff.gz" "$PKG_PUBLISH_PATH/$DISTRO/$CODENAME/$SUITE" + fi + + if [ "$LOCAL_BUILD" == "false" ] && [ "$SUITE" == "stable" ]; then + mkdir -p "$PKG_PUBLISH_PATH/$DISTRO/$CODENAME/$COMPONENT" + cd "$PKG_PUBLISH_PATH/$DISTRO/$CODENAME/$COMPONENT" >/dev/null 2>&1 + + ln "../$SUITE/${debian_package_name}_${version}.dsc" . + ln "../$SUITE/${debian_package_name}_${short_version}.orig.tar.gz" . + + if [ -f "../$SUITE/${debian_package_name}_${version}.debian.tar.xz" ]; then + ln "../$SUITE/${debian_package_name}_${version}.debian.tar.xz" . + fi + if [ -f "../$SUITE/${debian_package_name}_${version}.diff.gz" ]; then + ln "../$SUITE/${debian_package_name}_${version}.diff.gz" . + fi + + cd - >/dev/null 2>&1 + fi + + echo "Publishing source package $debian_package_name into $PKG_PUBLISH_PATH" fi - DEB_CONTROL_FILE="$PKG_BUILD_DIR/$PACKAGE_NAME/debian/control" + DEB_CONTROL_FILE="$PKG_BUILD_PATH/$PACKAGE_NAME/debian/control" ALL_ARCH="$ARCH,all" for target_arch in $(echo $ALL_ARCH | sed "s/,/ /g"); do - cat "$DEB_CONTROL_FILE" | grep ^Package: | cut -d' ' -f2 | while read -r bin_pkg; do - DEB_BIN_PKG_PATH="$(pwd)/${bin_pkg}_${version}_${target_arch}.deb" - if [ -f "$DEB_BIN_PKG_PATH" ]; then - if [ "$allow_failing_bin_package" == "true" ]; then - # If the source package/version already exists, allow the bin package build to fail (already exists) - reprepro --basedir "$PKG_REPO_PATH" includedeb "$CODENAME" "$DEB_BIN_PKG_PATH" || true - echo "Ingested binary package $DEB_BIN_PKG_PATH into $PKG_REPO_PATH" - else - reprepro --basedir "$PKG_REPO_PATH" includedeb "$CODENAME" "$DEB_BIN_PKG_PATH" - echo "Ingested binary package $DEB_BIN_PKG_PATH into $PKG_REPO_PATH" - fi - echo "CHLOG:Published ${bin_pkg}_${version}_${target_arch}.deb in $STAGE $DISTRO $CODENAME $ARCH from $PKG_LINE" - else - echo "Package $bin_pkg does not exist for $target_arch" - fi - done + cat "$DEB_CONTROL_FILE" | grep ^Package: | cut -d' ' -f2 | while read -r bin_pkg; do + DEB_BIN_PKG_PATH="$(pwd)/${bin_pkg}_${version}_${target_arch}.deb" + + if [ -f "$DEB_BIN_PKG_PATH" ]; then + mkdir -p $PKG_PUBLISH_PATH/$DISTRO/$CODENAME/$SUITE + cp "$DEB_BIN_PKG_PATH" "$PKG_PUBLISH_PATH/$DISTRO/$CODENAME/$SUITE" + + if [ "$LOCAL_BUILD" == "false" ] && [ "$SUITE" == "stable" ]; then + mkdir -p "$PKG_PUBLISH_PATH/$DISTRO/$CODENAME/$COMPONENT" + cd "$PKG_PUBLISH_PATH/$DISTRO/$CODENAME/$COMPONENT" >/dev/null 2>&1 + ln "../$SUITE/${bin_pkg}_${version}_${target_arch}.deb" . + cd - >/dev/null 2>&1 + fi + + echo "Publishing deb package(s) $bin_pkg into $PKG_PUBLISH_PATH" + echo "CHLOG:Published ${bin_pkg}_${version}_${target_arch}.deb in $DISTRO/$CODENAME/$STAGE from $PKG_LINE" + else + echo "Package $bin_pkg does not exist for $target_arch" + fi + done done +} + +archive_setup_scripts() { + # Following allows for internal dependencies + rm /tmp/Release || true + wget -P /tmp "http://archive.regolith-desktop.com/$DISTRO/$SUITE/dists/$CODENAME/Release" || true + + if [ -s /tmp/Release ]; then + rm /tmp/Release - # Preliminary launchpad.net integration. Ideally gated from action rather than distro/stage - # Only packages for Ubuntu distro should go to launchpad - # Arch is set to amd64 because launchpad handles cross arch builds internally - # Remove STAGE check once testing and release PPAs are ready - # if [[ "$DISTRO" == "ubuntu" && "$ARCH" == "amd64" && "$STAGE" == "unstable" ]]; then - # LAUNCHPAD_REPO="ppa:regolith-desktop/$CODENAME-$STAGE" - # - # dput -f $LAUNCHPAD_REPO $DEB_SRC_PKG_PATH || true - # - # echo "CHLOG: Published $PACKAGE_NAME to $LAUNCHPAD_REPO" - # fi + local repo_line="" + if [ "$LOCAL_BUILD" == "false" ] && [ "$SUITE" == "stable" ]; then + # fixed version component + repo_line="http://archive.regolith-desktop.com/$DISTRO/$SUITE $CODENAME v$COMPONENT" + else + # main component + repo_line="http://archive.regolith-desktop.com/$DISTRO/$SUITE $CODENAME $COMPONENT" + fi + + echo "Adding repo to apt: $repo_line" + wget -qO - http://archive.regolith-desktop.com/regolith.key | sudo apt-key add - + echo "deb [arch=$ARCH] $repo_line" | sudo tee /etc/apt/sources.list.d/regolith.list + + sudo apt update + fi + + if [ -f "/etc/apt/sources.list.d/regolith-local.list" ]; then + sudo rm /etc/apt/sources.list.d/regolith-local.list + echo "Cleaned up temp apt repo" + fi } -# Create repo dist file -generate_reprepro_dist() { - echo "Origin: $PACKAGE_REPO_URL" > "$PKG_REPO_PATH/conf/distributions" - echo "Label: $PACKAGE_REPO_URL" >> "$PKG_REPO_PATH/conf/distributions" - echo "Codename: $CODENAME" >> "$PKG_REPO_PATH/conf/distributions" - echo "Architectures: $ARCH source" >> "$PKG_REPO_PATH/conf/distributions" - echo "Components: main" >> "$PKG_REPO_PATH/conf/distributions" - echo "Description: $STAGE $DISTRO $CODENAME $ARCH" >> "$PKG_REPO_PATH/conf/distributions" - echo "SignWith: $APT_KEY" >> "$PKG_REPO_PATH/conf/distributions" +archive_cleanup_scripts() { + # Remove regolith repo from build system apt config + if [ -f /etc/apt/sources.list.d/regolith.list ]; then + sudo rm -f /etc/apt/sources.list.d/regolith.list + fi } # Setup debian repo setup() { - if [ ! -d "$PKG_REPO_PATH/conf" ]; then - echo "Creating conf dir" - mkdir -p "$PKG_REPO_PATH/conf" - fi - - if [ ! -f "$PKG_REPO_PATH/conf/distributions" ]; then - echo "Package metadata not found, creating conf dir" - generate_reprepro_dist - cat "$PKG_REPO_PATH/conf/distributions" - else - echo "Existing metadata:" - cat "$PKG_REPO_PATH/conf/distributions" - fi - source_setup_scripts + archive_setup_scripts } diff --git a/.github/scripts/ext-git.sh b/.github/scripts/ext-git.sh old mode 100644 new mode 100755 index 5865a472..ecda993c --- a/.github/scripts/ext-git.sh +++ b/.github/scripts/ext-git.sh @@ -4,24 +4,25 @@ checkout() { set -e if [ -z "$PACKAGE_URL" ]; then - echo "Package model is invalid. Model field 'source' undefined, aborting." + echo "Error: package model is invalid. Model field 'source' undefined, aborting." exit 1 fi - if [ -d "$PKG_BUILD_DIR/$PACKAGE_NAME" ]; then + if [ -d "$PKG_BUILD_PATH/$PACKAGE_NAME" ]; then echo "Deleting existing repo, $PACKAGE_NAME" - rm -Rfv "${PKG_BUILD_DIR:?}/$PACKAGE_NAME" + rm -Rfv "${PKG_BUILD_PATH:?}/$PACKAGE_NAME" fi - if [ ! -d "$PKG_BUILD_DIR" ]; then - echo "Creating build directory $PKG_BUILD_DIR" - mkdir -p "$PKG_BUILD_DIR" || { - echo "Failed to create build dir $PKG_BUILD_DIR, aborting." + if [ ! -d "$PKG_BUILD_PATH" ]; then + echo "Creating build directory $PKG_BUILD_PATH" + + mkdir -p "$PKG_BUILD_PATH" || { + echo "Error: failed to create build dir $PKG_BUILD_PATH, aborting." exit 1 } fi - cd "$PKG_BUILD_DIR" || exit + cd "$PKG_BUILD_PATH" || exit git clone --recursive "$PACKAGE_URL" -b "$PACKAGE_REF" "$PACKAGE_NAME" cd - >/dev/null 2>&1 || exit @@ -36,4 +37,4 @@ sanitize_git() { rm -Rf .git echo "Removed $(pwd).git directory before building to appease debuild." fi -} \ No newline at end of file +} diff --git a/.github/scripts/ext-rpm.sh b/.github/scripts/ext-rpm.sh index e03a5ff5..fafe0360 100755 --- a/.github/scripts/ext-rpm.sh +++ b/.github/scripts/ext-rpm.sh @@ -41,6 +41,16 @@ publish() { : } +archive_setup_scripts() { + # Setting up local archive repo for internal dependencies + : +} + +archive_cleanup_scripts() { + # Cleaning up local archive repo definition + : +} + # Setup debian repo setup() { : diff --git a/.github/scripts/ext-template.sh b/.github/scripts/ext-template.sh index 890d1ee5..d77939d4 100755 --- a/.github/scripts/ext-template.sh +++ b/.github/scripts/ext-template.sh @@ -37,9 +37,12 @@ publish() { echo todo } -# Create repo dist file - for new repository -generate_reprepro_dist() { - echo todo +archive_setup_scripts() { + echo todo +} + +archive_cleanup_scripts() { + echo todo } # Setup repo layout @@ -47,4 +50,5 @@ setup() { echo todo source_setup_scripts + archive_setup_scripts } diff --git a/.github/scripts/ext-tester.sh b/.github/scripts/ext-tester.sh index 4b3484ba..9015e3ca 100755 --- a/.github/scripts/ext-tester.sh +++ b/.github/scripts/ext-tester.sh @@ -37,16 +37,18 @@ publish() { echo "Publishing $PACKAGE_NAME to repo" } -# Create repo dist file - for new repository -generate_reprepro_dist() { - echo "Generating config files for new repository" +archive_setup_scripts() { + echo "Setting up local archive repo for internal dependencies" +} + +archive_cleanup_scripts() { + echo "Cleaning up local archive repo definition" } # Setup repo layout setup() { echo "Setting up $PKG_REPO_PATH" - generate_reprepro_dist - source_setup_scripts + archive_setup_scripts } diff --git a/.github/scripts/local-build.sh b/.github/scripts/local-build.sh index ab20ab5e..da2628ed 100755 --- a/.github/scripts/local-build.sh +++ b/.github/scripts/local-build.sh @@ -7,36 +7,155 @@ set -e -REPO_ROOT=$(realpath "$1") -EXTENSION=$2 -PACKAGE_NAME=$3 -PACKAGE_URL=$4 -PACKAGE_REF=$5 -CODENAME=$6 -PKG_BUILD_DIR="$REPO_ROOT/pkgbuild" -PKG_REPO_PATH="$REPO_ROOT/pkgrepo" -APT_KEY="Default" +# Unused for local build +source_setup_scripts() { + echo nop +} + +#### Init input params + +usage() { +cat << EOF +Build single deb and source package + +Usage: $0 [options...] + +Options: + --extension Path to extenstion file + --git-repo-path Path to repo folder + + --package-name Package name to build + --package-url Git URL to use to clone + --package-ref Git ref to use to clone + + --distro The distro to check or build + --codename The codename to check or build + --arch The arch to check or build + --stage The stage to check or build + + --help Show this message + +Note: all the options are required when using $0 +EOF +} + +parse_flag() { + declare -n argument=$3 + + if [ -n "$2" ] && [ ${2:0:1} != "-" ]; then + argument=$2 + return + fi + + echo "Error: argument for $1 is missing" >&2 + exit 1 +} + +EXTENSION="" # e.g. /path/to/ext-debian.sh +GIT_REPO_PATH="" # e.g. /path/to/git/repo/voulage + +PKG_BUILD_PATH="" # it will be: /pkgbuild +PKG_PUBLISH_PATH="" # it will be: /pkgpublish + +PACKAGE_NAME="" +PACKAGE_URL="" +PACKAGE_REF="" + +DISTRO="" # ubuntu, debian +CODENAME="" # e.g. jammy, noble, bookworm, etc +STAGE="" # experimental, unstable, testing, stable +SUITE="$STAGE" # experimental, unstable, testing, stable +COMPONENT="main" # e.g. main, 3_2, 3_1, etc. ARCH="amd64" -GIT_EXT="$REPO_ROOT/.github/scripts/ext-git.sh" +LOCAL_BUILD="true" + +while [[ $# -gt 0 ]]; do + case $1 in + --extension) parse_flag "$1" "$2" EXTENSION; shift 2 ;; + --git-repo-path) parse_flag "$1" "$2" GIT_REPO_PATH; shift 2 ;; + + --package-name) parse_flag "$1" "$2" PACKAGE_NAME; shift 2 ;; + --package-url) parse_flag "$1" "$2" PACKAGE_URL; shift 2 ;; + --package-ref) parse_flag "$1" "$2" PACKAGE_REF; shift 2 ;; + + --distro) parse_flag "$1" "$2" DISTRO; shift 2 ;; + --codename) parse_flag "$1" "$2" CODENAME; shift 2 ;; + --stage) parse_flag "$1" "$2" STAGE; shift 2 ;; + + -h|--help) usage; exit 0; ;; + -*|--*) echo "Unknown option $1"; exit 1; ;; + *) echo "Unknown command $1"; exit 1; ;; + esac +done + +if [ -z "$EXTENSION" ]; then + echo "Error: required value for --extension is missing" + exit 1 +fi +if [ -z "$GIT_REPO_PATH" ]; then + echo "Error: required value for --git-repo-path is missing" + exit 1 +else + GIT_REPO_PATH=$(realpath "$GIT_REPO_PATH") +fi + +if [ -z "$PACKAGE_NAME" ]; then + echo "Error: required value for --package-name is missing" + exit 1 +fi +if [ -z "$PACKAGE_URL" ]; then + echo "Error: required value for --package-url is missing" + exit 1 +fi +if [ -z "$PACKAGE_REF" ]; then + echo "Error: required value for --package-ref is missing" + exit 1 +fi + +if [ -z "$DISTRO" ]; then + echo "Error: required value for --distro is missing" + exit 1 +fi +if [ -z "$CODENAME" ]; then + echo "Error: required value for --codename is missing" + exit 1 +fi +if [ -z "$STAGE" ]; then + echo "Error: required value for --suite is missing" + exit 1 +fi + +#### Get extensions + +GIT_EXT="$GIT_REPO_PATH/.github/scripts/ext-git.sh" if [ ! -f "$GIT_EXT" ]; then - echo "Extension $GIT_EXT doesn't exist, aborting." + echo "Error: extension $GIT_EXT doesn't exist, aborting." exit 1 -else - source $GIT_EXT fi +source $GIT_EXT if [ ! -f "$EXTENSION" ]; then - echo "Extension $EXTENSION doesn't exist, aborting." + echo "Error: extension $EXTENSION doesn't exist, aborting." exit 1 -else - source $EXTENSION fi +source $EXTENSION -# Unused for local build -source_setup_scripts() { - echo nop -} +#### Setup files + +PKG_BUILD_PATH="$GIT_REPO_PATH/pkgbuild" + +if [ ! -d "$PKG_BUILD_PATH" ]; then + mkdir -p "$PKG_BUILD_PATH" +fi + +PKG_PUBLISH_PATH="$GIT_REPO_PATH/pkgpublish" + +if [ ! -d "$PKG_PUBLISH_PATH" ]; then + mkdir -p $PKG_PUBLISH_PATH/$DISTRO/$CODENAME/$STAGE +fi + +#### Build package setup checkout @@ -48,4 +167,4 @@ if dist_valid; then publish else echo "dist codename does not match in package changelog, ignoring $PACKAGE_NAME." -fi \ No newline at end of file +fi diff --git a/.github/scripts/main.sh b/.github/scripts/main.sh index 8a1167f7..00ed6041 100755 --- a/.github/scripts/main.sh +++ b/.github/scripts/main.sh @@ -46,7 +46,7 @@ merge_models() { cp "$ROOT_MODEL_PATH" "$WORKING_ROOT_MODEL" # Optionally merge stage package model - STAGE_PACKAGE_MODEL="$REPO_ROOT/stage/$STAGE/package-model.json" + STAGE_PACKAGE_MODEL="$GIT_REPO_PATH/stage/$STAGE/package-model.json" WORKING_STAGE_MODEL="$MANIFEST_PATH/$STAGE-model.json" if [ -f "$STAGE_PACKAGE_MODEL" ]; then jq -s '.[0] * .[1]' "$WORKING_ROOT_MODEL" "$STAGE_PACKAGE_MODEL" > "$WORKING_STAGE_MODEL" @@ -55,7 +55,7 @@ merge_models() { fi # Optionally merge distro package model - DISTRO_PACKAGE_MODEL="$REPO_ROOT/stage/$STAGE/$DISTRO/package-model.json" + DISTRO_PACKAGE_MODEL="$GIT_REPO_PATH/stage/$STAGE/$DISTRO/package-model.json" WORKING_DISTRO_MODEL="$MANIFEST_PATH/$STAGE-$DISTRO-model.json" if [ -f "$DISTRO_PACKAGE_MODEL" ]; then jq -s '.[0] * .[1]' "$WORKING_STAGE_MODEL" "$DISTRO_PACKAGE_MODEL" > "$WORKING_DISTRO_MODEL" @@ -64,7 +64,7 @@ merge_models() { fi # Optionally merge codename package model - CODENAME_PACKAGE_MODEL="$REPO_ROOT/stage/$STAGE/$DISTRO/$CODENAME/package-model.json" + CODENAME_PACKAGE_MODEL="$GIT_REPO_PATH/stage/$STAGE/$DISTRO/$CODENAME/package-model.json" WORKING_CODENAME_MODEL="$MANIFEST_PATH/$STAGE-$DISTRO-$CODENAME-model.json" if [ -f "$CODENAME_PACKAGE_MODEL" ]; then jq -s '.[0] * .[1]' "$WORKING_DISTRO_MODEL" "$CODENAME_PACKAGE_MODEL" > "$WORKING_CODENAME_MODEL" @@ -73,7 +73,7 @@ merge_models() { fi # Optionally merge arch package model - ARCH_PACKAGE_MODEL="$REPO_ROOT/stage/$STAGE/$DISTRO/$CODENAME/$ARCH/package-model.json" + ARCH_PACKAGE_MODEL="$GIT_REPO_PATH/stage/$STAGE/$DISTRO/$CODENAME/$ARCH/package-model.json" WORKING_ARCH_MODEL="$MANIFEST_PATH/$STAGE-$DISTRO-$CODENAME-$ARCH-model.json" if [ -f "$ARCH_PACKAGE_MODEL" ]; then jq -s '.[0] * .[1]' "$WORKING_CODENAME_MODEL" "$ARCH_PACKAGE_MODEL" > "$WORKING_ARCH_MODEL" @@ -90,11 +90,11 @@ merge_models() { # Traverse the stage tree and execute any found setup.sh scripts source_setup_scripts() { local setup_script_locations=( - "$REPO_ROOT/stage/setup.sh" - "$REPO_ROOT/stage/$STAGE/setup.sh" - "$REPO_ROOT/stage/$STAGE/$DISTRO/setup.sh" - "$REPO_ROOT/stage/$STAGE/$DISTRO/$CODENAME/setup.sh" - "$REPO_ROOT/stage/$STAGE/$DISTRO/$CODENAME/$ARCH/setup.sh" + "$GIT_REPO_PATH/stage/setup.sh" + "$GIT_REPO_PATH/stage/$STAGE/setup.sh" + "$GIT_REPO_PATH/stage/$STAGE/$DISTRO/setup.sh" + "$GIT_REPO_PATH/stage/$STAGE/$DISTRO/$CODENAME/setup.sh" + "$GIT_REPO_PATH/stage/$STAGE/$DISTRO/$CODENAME/$ARCH/setup.sh" ) for setup_file in "${setup_script_locations[@]}" @@ -135,30 +135,154 @@ build_packages() { #### Init input params -REPO_ROOT=$(realpath "$1") -EXTENSION=$2 -STAGE=$3 -DISTRO=$4 -CODENAME=$5 -ARCH=$6 -PACKAGE_REPO_URL=$7 -APT_KEY=$8 -MODE=$9 -MANIFEST_PATH=${10} -PKG_REPO_PATH=${11} -PKG_BUILD_DIR=${12} - - -GIT_EXT="$REPO_ROOT/.github/scripts/ext-git.sh" +usage() { +cat << EOF +Build debian and source packages for given combination of: distro, codename, stage and arch + +Usage: $0 [options...] COMMAND + +Commands: + build Build the requested debian and source packages + check Check the manifests if anything needs to be built + +Options: + --extension Path to extenstion file (e.g. /path/to/ext-debian.sh) + + --git-repo-path Path to repo folder (e.g. /path/to/git/repo/voulage) + --manifests-path Path to manifests folder (e.g. /path/to/manifests) + --pkg-build-path Path to folder to build packages in (e.g. /path/to/packages) + --pkg-publish-path Path to folder to publish packages in (e.g. /path/to/publish) + + --distro The distro to check or build (e.g. ubuntu, debian) + --codename The codename to check or build (e.g. jammy, noble, bookworm, etc.) + --stage The stage to check or build (e.g. experimental, unstable, testing, release-x_Y) # different release stages from github action point-of-view + --suite The suite to check or build (e.g. experimental, unstable, testing, stable) # corresponding value from published arcvhies point-of-view + --component The component to check or build (e.g. main, 3_2, 3_1, etc.) + --arch The arch to check or build (e.g. amd64, arm64) + + --help Show this message + +Note: all the options are required when using $0 +EOF +} + +parse_flag() { + declare -n argument=$3 + + if [ -n "$2" ] && [ ${2:0:1} != "-" ]; then + argument=$2 + return + fi + + echo "Error: argument for $1 is missing" >&2 + exit 1 +} + +MODE="" # build, check +EXTENSION="" # e.g. /path/to/ext-debian.sh + +GIT_REPO_PATH="" # e.g. /path/to/git/repo/voulage +MANIFEST_PATH="" # e.g. /path/to/manifests +PKG_BUILD_PATH="" # e.g. /path/to/packages +PKG_PUBLISH_PATH="" # e.g. /path/to/publish + +DISTRO="" # ubuntu, debian +CODENAME="" # e.g. jammy, noble, bookworm, etc +STAGE="" # experimental, unstable, testing, release-x_y (different release stages from github action point-of-view) +SUITE="" # experimental, unstable, testing, stable (corresponding value from published arcvhies point-of-view) +COMPONENT="" # e.g. main, 3.2, 3.1, etc. +ARCH="" # amd64, arm64 + +LOCAL_BUILD="false" + +while [[ $# -gt 0 ]]; do + case $1 in + build|check) MODE="$1"; shift; ;; + --extension) parse_flag "$1" "$2" EXTENSION; shift 2 ;; + + --git-repo-path) parse_flag "$1" "$2" GIT_REPO_PATH; shift 2 ;; + --manifest-path) parse_flag "$1" "$2" MANIFEST_PATH; shift 2 ;; + --pkg-build-path) parse_flag "$1" "$2" PKG_BUILD_PATH; shift 2 ;; + --pkg-publish-path) parse_flag "$1" "$2" PKG_PUBLISH_PATH; shift 2 ;; + + --distro) parse_flag "$1" "$2" DISTRO; shift 2 ;; + --codename) parse_flag "$1" "$2" CODENAME; shift 2 ;; + --stage) parse_flag "$1" "$2" STAGE; shift 2 ;; + --suite) parse_flag "$1" "$2" SUITE; shift 2 ;; + --component) parse_flag "$1" "$2" COMPONENT; shift 2 ;; + --arch) parse_flag "$1" "$2" ARCH; shift 2 ;; + + -h|--help) usage; exit 0; ;; + -*|--*) echo "Unknown option $1"; exit 1; ;; + *) echo "Unknown command $1"; exit 1; ;; + esac +done + +if [ -z "$MODE" ]; then + echo "Error: command is missing" + exit 1 +fi +if [ -z "$EXTENSION" ]; then + echo "Error: required value for --extension is missing" + exit 1 +fi + +if [ -z "$GIT_REPO_PATH" ]; then + echo "Error: required value for --git-repo-path is missing" + exit 1 +else + GIT_REPO_PATH=$(realpath "$GIT_REPO_PATH") +fi +if [ -z "$MANIFEST_PATH" ]; then + echo "Error: required value for --manifest-path is missing" + exit 1 +fi +if [ -z "$PKG_BUILD_PATH" ]; then + echo "Error: required value for --pkg-build-path is missing" + exit 1 +fi +if [ -z "$PKG_PUBLISH_PATH" ]; then + echo "Error: required value for --pkg-publish-path is missing" + exit 1 +fi + +if [ -z "$DISTRO" ]; then + echo "Error: required value for --distro is missing" + exit 1 +fi +if [ -z "$CODENAME" ]; then + echo "Error: required value for --codename is missing" + exit 1 +fi +if [ -z "$STAGE" ]; then + echo "Error: required value for --stage is missing" + exit 1 +fi +if [ -z "$SUITE" ]; then + echo "Error: required value for --suite is missing" + exit 1 +fi +if [ -z "$COMPONENT" ]; then + echo "Error: required value for --component is missing" + exit 1 +fi +if [ -z "$ARCH" ]; then + echo "Error: required value for --arch is missing" + exit 1 +fi + +#### Get extensions + +GIT_EXT="$GIT_REPO_PATH/.github/scripts/ext-git.sh" if [ ! -f "$GIT_EXT" ]; then - echo "Extension $GIT_EXT doesn't exist, aborting." + echo "Error: extension $GIT_EXT doesn't exist, aborting." exit 1 else source $GIT_EXT fi if [ ! -f "$EXTENSION" ]; then - echo "Extension $EXTENSION doesn't exist, aborting." + echo "Error: extension $EXTENSION doesn't exist, aborting." exit 1 else source $EXTENSION @@ -166,31 +290,31 @@ fi #### Init globals -ROOT_MODEL_PATH="$REPO_ROOT/stage/package-model.json" +ROOT_MODEL_PATH="$GIT_REPO_PATH/stage/package-model.json" #### Setup files -if [ -d "$MANIFEST_PATH" ]; then - echo "Deleting pre-existing manifest dir $MANIFEST_PATH" - rm -Rf "$MANIFEST_PATH" +if [ -d "$PKG_BUILD_PATH" ]; then + echo "Deleting pre-existing package build dir $PKG_BUILD_PATH" + rm -Rf "$PKG_BUILD_PATH" fi -if [ -d "$PKG_BUILD_DIR" ]; then - echo "Deleting pre-existing package build dir $PKG_BUILD_DIR" - rm -Rf "$PKG_BUILD_DIR" +if [ -d "$PKG_PUBLISH_PATH" ]; then + echo "Deleting pre-existing package publish dir $PKG_PUBLISH_PATH" + rm -Rf "$PKG_PUBLISH_PATH" fi if [ ! -d "$MANIFEST_PATH" ]; then mkdir -p $MANIFEST_PATH fi -if [ ! -d "$PKG_REPO_PATH" ]; then - mkdir -p $PKG_REPO_PATH +if [ ! -d "$PKG_PUBLISH_PATH" ]; then + mkdir -p $PKG_PUBLISH_PATH fi #### Generate Manifest from package model tree and git repo state -PREV_MANIFEST_FILE="$PKG_REPO_PATH/manifest.txt" +PREV_MANIFEST_FILE="$MANIFEST_PATH/manifest.txt" NEXT_MANIFEST_FILE="$MANIFEST_PATH/next-manifest.txt" # Create prev manifest if doesn't exist (first run) @@ -206,6 +330,7 @@ fi # Merge models across stage, distro, codename, arch merge_models + # Iterate over each package in the model and call handle_package traverse_package_model @@ -227,6 +352,8 @@ if [ "$MODE" == "build" ]; then #### Cleanup + archive_cleanup_scripts + rm "$PREV_MANIFEST_FILE" mv "$NEXT_MANIFEST_FILE" "$PREV_MANIFEST_FILE" else diff --git a/.github/scripts/rebuild-sources.sh b/.github/scripts/rebuild-sources.sh new file mode 100755 index 00000000..b1b01461 --- /dev/null +++ b/.github/scripts/rebuild-sources.sh @@ -0,0 +1,206 @@ +#!/usr/bin/env bash +# +# Rebuild the source files. +# +# The following files will be rebuilt out of exisiting .orig.tar.gz file which +# is previously repacked without /debian folder in it. +# +# - .dsc +# - .debian.tar.xz +# +# This will ensure one single .orig.tar.gz file can be used for all the +# packages of the same version and same component of different codenames. + +rebuild_packages() { + local distro=$1 + local codename=$2 + local component=$3 + + echo "Distro : $distro" + echo "Codename : $codename" + echo "Component: $component" + echo "==============================" + + pushd "$PKG_BUILD_PATH/$distro/$codename/$component" >/dev/null + + for f in $(find . -maxdepth 1 -type f -name "*.orig.tar.gz" | sort); do + base_name=$(basename $f) + + # not the provided --only-package + if [ -n "$ONLY_PACKAGE" ] && [ "$ONLY_PACKAGE" != "$base_name" ]; then + continue + fi + + tmp=$(mktemp -d) + if [ -z "$tmp" ]; then + continue + fi + if [ ! -d "$tmp" ]; then + continue + fi + + pkg_full_name=$(echo $base_name | sed 's/.orig.tar.gz//g') + pkg_name=$(echo $base_name | cut -d"_" -f1) + + if [ ! -f "$pkg_full_name.orig.tar.gz" ]; then + echo "$pkg_full_name.orig.tar.gz is missing" + continue + fi + if [ ! -f "$pkg_full_name-$codename.debian.tar.xz" ]; then + echo "$pkg_full_name-$codename.debian.tar.xz is missing" + continue + fi + + cp "$pkg_full_name.orig.tar.gz" "$tmp" + cp "$pkg_full_name-$codename.debian.tar.xz" "$tmp" + + # entering /tmp/tmp.XXXXXXXXXX + pushd $tmp >/dev/null + + tar -xzf "$pkg_full_name.orig.tar.gz" + tar -xf "$pkg_full_name-$codename.debian.tar.xz" + mv "debian/" "$pkg_name" + + if [ -d "$pkg_name" ]; then + pushd $pkg_name >/dev/null + + sudo apt update + sudo apt build-dep -y . + debuild -S -sa + + popd >/dev/null + fi + + # existing /tmp/tmp.XXXXXXXXXX + popd >/dev/null + + # copy newly generated .dsc and .debian.tar.xz file back to the repo + cp $tmp/$pkg_full_name-$codename.dsc . + cp $tmp/$pkg_full_name-$codename.debian.tar.xz . + + rm -rf $tmp >/dev/null + echo "==============================" + done + + popd >/dev/null +} + +find_packages() { + local distro="$1" + + pushd "$PKG_BUILD_PATH" >/dev/null + + for dir in $(find "$distro/" -mindepth 2 -maxdepth 2 -type d | sort); do + codename=$(echo "$dir" | cut -d"/" -f2) + component=$(echo "$dir" | cut -d"/" -f3) + + # not the provided --only-codename or --only-component + if [ -n "$ONLY_CODENAME" ] && [ "$ONLY_CODENAME" != "$codename" ]; then + continue + fi + if [ -n "$ONLY_COMPONENT" ] && [ "$ONLY_COMPONENT" != "$component" ]; then + continue + fi + + # skip named version folder (e.g. 3.x), the contents are symlinks + if [[ $component == *"."* ]]; then + continue + fi + + rebuild_packages "$distro" "$codename" "$component" + done + + popd >/dev/null +} + +is_supported() { + local distro="$1" + + if [ "$distro" == "ubuntu" ]; then + return 0 + fi + if [ "$distro" == "debian" ]; then + return 0 + fi + + return 1 +} + +main() { + for dir in $(find "$PKG_BUILD_PATH" -mindepth 1 -maxdepth 1 -type d); do + distro="${dir##*/}" + + if ! is_supported "$distro"; then + echo "Skipping $distro, it's not a supported distro." + continue + fi + if [ -n "$ONLY_DISTRO" ] && [ "$ONLY_DISTRO" != "$distro" ]; then + continue + fi + + find_packages "$distro" + done +} + +usage() { +cat << EOF +Rebuild debian package sources + +Usage: $0 --pkg-build-path [options...] + +Options: + --pkg-build-path Path to build package folder + + --only-distro Only rebuild sources of this distro + --only-codename Only rebuild sources of this codename + --only-component Only rebuild sources of this component + --only-package Only rebuild sources of this package + + --help Show this message +EOF +} + +parse_flag() { + declare -n argument=$3 + + if [ -n "$2" ] && [ ${2:0:1} != "-" ]; then + argument=$2 + return + fi + + echo "Error: argument for $1 is missing" >&2 + exit 1 +} + +PKG_BUILD_PATH="" +ONLY_DISTRO="" +ONLY_CODENAME="" +ONLY_COMPONENT="" +ONLY_PACKAGE="" + +while [[ $# -gt 0 ]]; do + case $1 in + --pkg-build-path) parse_flag "$1" "$2" PKG_BUILD_PATH; shift 2 ;; + + --only-distro) parse_flag "$1" "$2" ONLY_DISTRO; shift 2 ;; + --only-codename) parse_flag "$1" "$2" ONLY_CODENAME; shift 2 ;; + --only-component) parse_flag "$1" "$2" ONLY_COMPONENT; shift 2 ;; + --only-package) parse_flag "$1" "$2" ONLY_PACKAGE; shift 2 ;; + + -h|--help) usage; exit 0; ;; + -*|--*) echo "Unknown option $1"; exit 1; ;; + *) echo "Unknown command $1"; exit 1; ;; +esac +done + +if [ -z "$PKG_BUILD_PATH" ]; then + echo "Error: required value for --pkg-build-path is missing" + exit 1 +fi +if [ ! -d "$PKG_BUILD_PATH" ]; then + echo "Error: $PKG_BUILD_PATH not found" + exit 1 +fi +PKG_BUILD_PATH=$(realpath $PKG_BUILD_PATH) + +main diff --git a/.github/workflows/build-arch.yml b/.github/workflows/build-arch.yml index 03b37e18..59e6f44f 100644 --- a/.github/workflows/build-arch.yml +++ b/.github/workflows/build-arch.yml @@ -1,4 +1,4 @@ -name: Arch Package Builder Prototype +name: Package Builder Arch (Prototype) on: workflow_dispatch: @@ -20,6 +20,13 @@ jobs: arch: amd64 distro: arch codename: testing + + - stage: experimental + suite: experimental + component: main + - stage: unstable + suite: unstable + component: main steps: - uses: actions/checkout@v4 - name: Set Job Parameters @@ -34,6 +41,8 @@ jobs: echo "codename=${{ matrix.codename }}" >> $GITHUB_OUTPUT echo "arch=${{ matrix.arch }}" >> $GITHUB_OUTPUT echo "target=${{ matrix.stage }}-${{ matrix.distro }}-${{ matrix.codename }}-${{ matrix.arch }}" >> $GITHUB_OUTPUT + echo "suite=${{ matrix.suite }}" >> $GITHUB_OUTPUT + echo "component=${{ matrix.component }}" >> $GITHUB_OUTPUT echo "repo_url=https://regolith-desktop.org/${{ matrix.stage }}-${{ matrix.distro }}-${{ matrix.codename }}-${{ matrix.arch }}" >> $GITHUB_OUTPUT - name: Env setup run: | @@ -51,18 +60,18 @@ jobs: run: | set -e CHANGE_OUTPUT=$(${{ steps.init.outputs.GH_REPO_ROOT }}/.github/scripts/main.sh \ - ${{ steps.init.outputs.GH_REPO_ROOT }} \ - ${{ steps.init.outputs.GH_REPO_ROOT }}/.github/scripts/ext-arch.sh \ - "${{ steps.init.outputs.stage }}" \ - "${{ steps.init.outputs.distro }}" \ - "${{ steps.init.outputs.codename }}" \ - "${{ steps.init.outputs.arch }}" \ - "unneeded to check change" \ - "unneeded to check change" \ check \ - ${{ steps.init.outputs.MANIFEST_PATH }} \ - ${{ steps.init.outputs.PKG_REPO_PATH }} \ - ${{ steps.init.outputs.PKG_BUILD_DIR }} | tail -n1) + --extension ${{ steps.init.outputs.GH_REPO_ROOT }}/.github/scripts/ext-arch.sh \ + --git-repo-path ${{ steps.init.outputs.GH_REPO_ROOT }} \ + --manifest-path ${{ steps.init.outputs.MANIFEST_PATH }} \ + --pkg-build-path ${{ steps.init.outputs.PKG_BUILD_DIR }} \ + --pkg-publish-path ${{ steps.init.outputs.PKG_REPO_PATH }} \ + --distro "${{ steps.init.outputs.distro }}" \ + --codename "${{ steps.init.outputs.codename }}" \ + --arch "${{ steps.init.outputs.arch }}" \ + --stage "${{ steps.init.outputs.stage }}" \ + --suite "${{ steps.init.outputs.suite }}" \ + --component "${{ steps.init.outputs.component }}" | tail -n1) if [ "$CHANGE_OUTPUT" == "No package changes found, exiting." ]; then echo "changed=0" >> $GITHUB_OUTPUT echo "No package changes to build" @@ -93,18 +102,18 @@ jobs: printf "${{ secrets.PACKAGE_PRIVATE_KEY2 }}" | base64 --decode > ~/.gnupg/private.key gpg --batch --import ~/.gnupg/private.key ${{ steps.init.outputs.GH_REPO_ROOT }}/.github/scripts/main.sh \ - ${{ steps.init.outputs.GH_REPO_ROOT }} \ - ${{ steps.init.outputs.GH_REPO_ROOT }}/.github/scripts/ext-arch.sh \ - "${{ steps.init.outputs.stage }}" \ - "${{ steps.init.outputs.distro }}" \ - "${{ steps.init.outputs.codename }}" \ - "${{ steps.init.outputs.arch }}" \ - "${{ steps.init.outputs.repo_url }}" \ - Default \ build \ - ${{ steps.init.outputs.MANIFEST_PATH }} \ - ${{ steps.init.outputs.PKG_REPO_PATH }} \ - ${{ steps.init.outputs.PKG_BUILD_DIR }} | tee -a ${{ steps.init.outputs.GH_REPO_ROOT }}/CHANGELOG_${{ steps.init.outputs.target }}.raw.txt + --extension ${{ steps.init.outputs.GH_REPO_ROOT }}/.github/scripts/ext-arch.sh \ + --git-repo-path ${{ steps.init.outputs.GH_REPO_ROOT }} \ + --manifest-path ${{ steps.init.outputs.MANIFEST_PATH }} \ + --pkg-build-path ${{ steps.init.outputs.PKG_BUILD_DIR }} \ + --pkg-publish-path ${{ steps.init.outputs.PKG_REPO_PATH }} \ + --distro "${{ steps.init.outputs.distro }}" \ + --codename "${{ steps.init.outputs.codename }}" \ + --arch "${{ steps.init.outputs.arch }}" \ + --stage "${{ steps.init.outputs.stage }}" \ + --suite "${{ steps.init.outputs.suite }}" \ + --component "${{ steps.init.outputs.component }}" | tee -a ${{ steps.init.outputs.GH_REPO_ROOT }}/CHANGELOG_${{ steps.init.outputs.target }}.raw.txt if [ -f ${{ steps.init.outputs.MANIFEST_PATH }}/next-manifest.txt ]; then echo "Temp manifest not deleted by main.sh, build aborted/failed." echo "changed=0" >> $GITHUB_OUTPUT diff --git a/.github/workflows/build-deb-v4.yml b/.github/workflows/build-deb-v4.yml index 25d7e76c..318ef132 100644 --- a/.github/workflows/build-deb-v4.yml +++ b/.github/workflows/build-deb-v4.yml @@ -1,260 +1,417 @@ -name: Debian Package Builder v4 +name: Package Builder Debian v4 +run-name: Build ${{ inputs.stage }} Packages ${{ inputs.distro }} ${{ inputs.codename }} ${{ inputs.arch }} on: workflow_dispatch: + inputs: + stage: + description: "Stage to build" + type: choice + options: + - all + - experimental + - unstable + - testing + - release-3_0 + - release-3_1 + - release-3_2 + required: true + default: "unstable" + distro: + description: "Distro to build (debian, ubuntu)" + type: choice + options: + - "" + - debian + - ubuntu + required: false + default: "" + codename: + description: "Codename to build (e.g. noble, bookworm)" + type: string + required: false + default: "" + arch: + description: "Architecture to build (amd64, arm64)" + type: choice + options: + - "" + - amd64 + - arm64 + required: false + default: "" + workflow_call: + inputs: + stage: + description: "Stage to build" + type: string + required: true + default: "unstable" + distro: + description: "Distro to build (debian, ubuntu)" + type: string + required: false + codename: + description: "Codename to build (e.g. noble, bookworm)" + type: string + required: false + arch: + description: "Architecture to build (amd64, arm64)" + type: string + required: false concurrency: group: debian_builder_v4 cancel-in-progress: true jobs: + matrix-builder: + runs-on: ubuntu-24.04 + outputs: + stages: ${{ steps.calc-matrix.outputs.stages }} + distros: ${{ steps.calc-matrix.outputs.distros }} + codenames: ${{ steps.calc-matrix.outputs.codenames }} + arches: ${{ steps.calc-matrix.outputs.arches }} + suites: ${{ steps.calc-matrix.outputs.suites }} + runners: ${{ steps.calc-matrix.outputs.runners }} + includes: ${{ steps.calc-matrix.outputs.includes }} + excludes: ${{ steps.calc-matrix.outputs.excludes }} + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Calculate Matrix + id: calc-matrix + run: | + if [ -n "${{ inputs.stage }}" ] && [ "${{ inputs.stage }}" != "all" ]; then + STAGES=(${{ inputs.stage }}) + else + STAGES=(experimental testing unstable) + fi + DISTROS=() + CODENAMES=() + if [ -n "${{ inputs.arch }}" ]; then + ARCHES=(${{ inputs.arch }}) + else + ARCHES=(amd64 arm64) + fi + INCLUDES=() + EXCLUDES=() + + valid_distro_codenames=() + + for stage in "${STAGES[@]}"; do + if [ ! -d "stage/${stage}" ]; then + echo "Package model for stage ${stage} not found!" + continue + fi + + for dir in $(find stage/${stage}/ -mindepth 2 -maxdepth 2 -type d | sort); do + for arch in "${ARCHES[@]}"; do + distro=$(echo $dir | cut -d/ -f3) + if [ -n "${{ inputs.distro }}" ] && [ "${{ inputs.distro }}" != "$distro" ]; then + continue + fi + + codename=$(echo $dir | cut -d/ -f4) + if [ -n "${{ inputs.codename }}" ] && [ "${{ inputs.codename }}" != "$codename" ]; then + continue + fi + + if [[ ! " ${DISTROS[*]} " =~ [[:space:]]${distro}[[:space:]] ]]; then + DISTROS+=("${distro}") + fi + if [[ ! " ${CODENAMES[*]} " =~ [[:space:]]${codename}[[:space:]] ]]; then + CODENAMES+=("${codename}") + fi + if [[ ! " ${valid_distro_codenames[*]} " =~ [[:space:]]${distro}-${codename}[[:space:]] ]]; then + valid_distro_codenames+=("${distro}-${codename}") + fi + done + done + done + + for distro in "${DISTROS[@]}"; do + for codename in "${CODENAMES[@]}"; do + if [[ ! " ${valid_distro_codenames[*]} " =~ [[:space:]]${distro}-${codename}[[:space:]] ]]; then + EXCLUDES+=($(jq -n -c --arg distro "$distro" --arg codename "$codename" '$ARGS.named')) + fi + done + done + + if [[ "${{ inputs.stage }}" == "release-"* ]]; then + EXCLUDES+=($(jq -n -c --arg distro "debian" --arg codename "testing" '$ARGS.named')) + fi + + SUITES=$(jq -n "$(jq -n -c \ + --argjson experimental "$(jq -n -c --arg suite "experimental" --arg component "main" '$ARGS.named')" \ + --argjson unstable "$(jq -n -c --arg suite "unstable" --arg component "main" '$ARGS.named')" \ + --argjson testing "$(jq -n -c --arg suite "testing" --arg component "main" '$ARGS.named')" \ + --argjson stable "$(jq -n -c --arg suite "stable" --arg component "main" '$ARGS.named')" \ + --argjson release-3_0 "$(jq -n -c --arg suite "stable" --arg component "v3.0" '$ARGS.named')" \ + --argjson release-3_1 "$(jq -n -c --arg suite "stable" --arg component "v3.1" '$ARGS.named')" \ + --argjson release-3_2 "$(jq -n -c --arg suite "stable" --arg component "v3.2" '$ARGS.named')" \ + '$ARGS.named'\ + )" '$ARGS.named') + + echo "stages=$(jq -n -c '$ARGS.positional' --args -- "${STAGES[@]}")" >> $GITHUB_OUTPUT + echo "distros=$(jq -n -c '$ARGS.positional' --args -- "${DISTROS[@]}")" >> $GITHUB_OUTPUT + echo "codenames=$(jq -n -c '$ARGS.positional' --args -- "${CODENAMES[@]}")" >> $GITHUB_OUTPUT + echo "arches=$(jq -n -c '$ARGS.positional' --args -- "${ARCHES[@]}")" >> $GITHUB_OUTPUT + echo "suites=$(jq -n -c "${SUITES}" '$ARGS.named')" >> $GITHUB_OUTPUT + echo "runners=$(jq -n -c "$(jq -n -c --arg amd64 "X64" --arg arm64 "arm64" '$ARGS.named')" '$ARGS.named')" >> $GITHUB_OUTPUT + echo "includes=$(jq -n -c "[$(printf '%s\n' "${INCLUDES[@]}" | paste -sd,)]" '$ARGS.named')" >> $GITHUB_OUTPUT + echo "excludes=$(jq -n -c "[$(printf '%s\n' "${EXCLUDES[@]}" | paste -sd,)]" '$ARGS.named')" >> $GITHUB_OUTPUT + + # build packages and sources build: - runs-on: ${{ matrix.host-os }} + runs-on: [self-hosted, Linux, "${{ fromJSON(needs.matrix-builder.outputs.runners)[matrix.arch] }}", "${{ matrix.codename }}"] + needs: matrix-builder strategy: matrix: - stage: [ experimental, unstable, testing, release-3_2 ] #, release-3_1, release-3_0, release-2_2, release-2_1] - distro-codename: [ - ubuntu-jammy-amd64, - ubuntu-jammy-arm64, - ubuntu-noble-amd64, - ubuntu-noble-arm64, - ubuntu-oracular-amd64, - ubuntu-oracular-arm64, - debian-bookworm-amd64, - debian-bookworm-arm64, - debian-testing-amd64, - debian-testing-arm64 - ] - exclude: - - stage: release-3_2 - distro-codename: debian-testing-amd64 # debian testing is never released - - stage: release-3_2 - distro-codename: debian-testing-arm64 # debian testing is never released - - stage: release-3_2 - distro-codename: ubuntu-oracular-amd64 # 3.2 released before oracular - - stage: release-3_2 - distro-codename: ubuntu-oracular-arm64 - include: - - distro-codename: ubuntu-jammy-amd64 - host-os: ubuntu-22.04 - arch: amd64 - distro: ubuntu - codename: jammy - - distro-codename: ubuntu-jammy-arm64 - host-os: [self-hosted, Linux, arm64, jammy] - arch: arm64 - distro: ubuntu - codename: jammy - - distro-codename: ubuntu-noble-amd64 - host-os: [self-hosted, Linux, X64, noble] - arch: amd64 - distro: ubuntu - codename: noble - - distro-codename: ubuntu-noble-arm64 - host-os: [self-hosted, Linux, arm64, noble] - arch: arm64 - distro: ubuntu - codename: noble - - distro-codename: ubuntu-oracular-amd64 - host-os: [self-hosted, Linux, X64, oracular] - arch: amd64 - distro: ubuntu - codename: oracular - - distro-codename: ubuntu-oracular-arm64 - host-os: [self-hosted, Linux, arm64, oracular] - arch: arm64 - distro: ubuntu - codename: oracular - - distro-codename: debian-bookworm-amd64 - host-os: [self-hosted, Linux, X64, bookworm] - arch: amd64 - distro: debian - codename: bookworm - - distro-codename: debian-bookworm-arm64 - host-os: [self-hosted, Linux, arm64, bookworm] - arch: arm64 - distro: debian - codename: bookworm - - distro-codename: debian-testing-amd64 - host-os: [self-hosted, Linux, X64, testing] - arch: amd64 - distro: debian - codename: testing - - distro-codename: debian-testing-arm64 - host-os: [self-hosted, Linux, arm64, testing] - arch: arm64 - distro: debian - codename: testing + stage: ${{ fromJSON(needs.matrix-builder.outputs.stages) }} + distro: ${{ fromJSON(needs.matrix-builder.outputs.distros) }} + codename: ${{ fromJSON(needs.matrix-builder.outputs.codenames) }} + arch: ${{ fromJSON(needs.matrix-builder.outputs.arches) }} + + include: ${{ fromJSON(needs.matrix-builder.outputs.includes) }} + exclude: ${{ fromJSON(needs.matrix-builder.outputs.excludes) }} steps: - - uses: actions/checkout@v4 + - name: Checkout + uses: actions/checkout@v4 + - name: Set Job Parameters id: init run: | - echo "SIGNING_KEY_ID=C91ECAB862037F9474087DBC7107DED133505B88" >> $GITHUB_OUTPUT - echo "MANIFEST_PATH=${{ github.workspace }}/manifests" >> $GITHUB_OUTPUT - echo "PKG_REPO_PATH=${{ github.workspace }}/repo" >> $GITHUB_OUTPUT - echo "PKG_BUILD_DIR=${{ github.workspace }}/packages" >> $GITHUB_OUTPUT - echo "GH_REPO_ROOT=${{ github.workspace }}" >> $GITHUB_OUTPUT + echo "gh-repo-path=${{ github.workspace }}" >> $GITHUB_OUTPUT + echo "changelogs-path=${{ github.workspace }}/changelogs" >> $GITHUB_OUTPUT + echo "manifest-path=${{ github.workspace }}/manifests" >> $GITHUB_OUTPUT + echo "package-build-path=${{ github.workspace }}/packages" >> $GITHUB_OUTPUT + echo "package-publish-path=${{ github.workspace }}/publish" >> $GITHUB_OUTPUT echo "stage=${{ matrix.stage }}" >> $GITHUB_OUTPUT echo "distro=${{ matrix.distro }}" >> $GITHUB_OUTPUT echo "codename=${{ matrix.codename }}" >> $GITHUB_OUTPUT echo "arch=${{ matrix.arch }}" >> $GITHUB_OUTPUT + echo "suite=${{ fromJSON(needs.matrix-builder.outputs.suites)[matrix.stage]['suite'] }}" >> $GITHUB_OUTPUT + echo "component=${{ fromJSON(needs.matrix-builder.outputs.suites)[matrix.stage]['component'] }}" >> $GITHUB_OUTPUT echo "target=${{ matrix.stage }}-${{ matrix.distro }}-${{ matrix.codename }}-${{ matrix.arch }}" >> $GITHUB_OUTPUT - echo "repo_url=https://regolith-desktop.org/${{ matrix.stage }}-${{ matrix.distro }}-${{ matrix.codename }}-${{ matrix.arch }}" >> $GITHUB_OUTPUT - - name: Env setup + + - name: Environment Setup run: | set -e - mkdir ${{ steps.init.outputs.MANIFEST_PATH }} || true - mkdir ${{ steps.init.outputs.PKG_BUILD_DIR }} || true - - # Following allows for internal dependencies - # FIXME(kgilmer): extract following logic to distro specific script - rm /tmp/manifest.txt || true - wget -P /tmp "https://regolith-desktop.org/${{ steps.init.outputs.target }}/manifest.txt" || true - - if [ -f /tmp/manifest.txt ]; then - echo "Adding repo to apt: ${{ steps.init.outputs.target }}" - rm /tmp/manifest.txt - wget -qO - https://regolith-desktop.org/regolith3.key | sudo apt-key add - - echo deb "[arch=${{ steps.init.outputs.arch }}] ${{ steps.init.outputs.repo_url }} ${{ steps.init.outputs.codename }} main" | sudo tee /etc/apt/sources.list.d/regolith.list - fi + mkdir -p ${{ steps.init.outputs.changelogs-path }} || true + mkdir -p ${{ steps.init.outputs.manifest-path }} || true - if [ -f "/etc/apt/sources.list.d/regolith-local.list" ]; then - sudo rm /etc/apt/sources.list.d/regolith-local.list - echo "Cleaned up temp apt repo" - fi - + sudo rm -rf /etc/apt/sources.list.d/regolith.list sudo apt update - DEBIAN_FRONTEND=noninteractive sudo apt install -y --no-install-recommends jq git devscripts reprepro wget dput + DEBIAN_FRONTEND=noninteractive sudo apt install -y --no-install-recommends jq git devscripts wget dput diffutils + - name: Pull Manifest run: | set -e - wget -P "${{ steps.init.outputs.PKG_REPO_PATH }}" "https://regolith-desktop.org/${{ steps.init.outputs.target }}/manifest.txt" || true - echo "Previous manifest:" - cat ${{ steps.init.outputs.PKG_REPO_PATH }}/manifest.txt || true + wget -P "${{ steps.init.outputs.manifest-path }}" "http://archive.regolith-desktop.com/manifests/${{ steps.init.outputs.distro }}/${{ steps.init.outputs.codename }}/${{ steps.init.outputs.suite }}-${{ steps.init.outputs.component }}/${{ steps.init.outputs.arch }}/manifest.txt" || true + echo "Current manifest:" + cat ${{ steps.init.outputs.manifest-path }}/manifest.txt || true + - name: Check for changes id: changes run: | set -e set -x - CHANGE_OUTPUT=$(${{ steps.init.outputs.GH_REPO_ROOT }}/.github/scripts/main.sh \ - ${{ steps.init.outputs.GH_REPO_ROOT }} \ - ${{ steps.init.outputs.GH_REPO_ROOT }}/.github/scripts/ext-debian.sh \ - "${{ steps.init.outputs.stage }}" \ - "${{ steps.init.outputs.distro }}" \ - "${{ steps.init.outputs.codename }}" \ - "${{ steps.init.outputs.arch }}" \ - "unneeded to check change" \ - "unneeded to check change" \ + + CHANGE_OUTPUT=$(${{ steps.init.outputs.gh-repo-path }}/.github/scripts/main.sh \ check \ - ${{ steps.init.outputs.MANIFEST_PATH }} \ - ${{ steps.init.outputs.PKG_REPO_PATH }} \ - ${{ steps.init.outputs.PKG_BUILD_DIR }} | tail -n1) + --extension ${{ steps.init.outputs.gh-repo-path }}/.github/scripts/ext-debian.sh \ + --git-repo-path ${{ steps.init.outputs.gh-repo-path }} \ + --manifest-path ${{ steps.init.outputs.manifest-path }} \ + --pkg-build-path ${{ steps.init.outputs.package-build-path }} \ + --pkg-publish-path ${{ steps.init.outputs.package-publish-path }} \ + --distro "${{ steps.init.outputs.distro }}" \ + --codename "${{ steps.init.outputs.codename }}" \ + --arch "${{ steps.init.outputs.arch }}" \ + --stage "${{ steps.init.outputs.stage }}" \ + --suite "${{ steps.init.outputs.suite }}" \ + --component "${{ steps.init.outputs.component }}" | tail -n1) + if [ "$CHANGE_OUTPUT" == "No package changes found, exiting." ]; then echo "changed=0" >> $GITHUB_OUTPUT echo "No package changes to build" else echo "changed=1" >> $GITHUB_OUTPUT echo "New Manifest: " - cat ${{ steps.init.outputs.MANIFEST_PATH }}/next-manifest.txt + cat ${{ steps.init.outputs.manifest-path }}/next-manifest.txt fi - - uses: webfactory/ssh-agent@v0.9.0 + + - name: Setup SSH agent + uses: webfactory/ssh-agent@v0.9.0 if: steps.changes.outputs.changed == 1 with: ssh-private-key: ${{ secrets.KAMATERA_SSH_KEY }} - - name: Pull repo - if: steps.changes.outputs.changed == 1 - run: | - set -e - set -x - ssh-keyscan -H ${{ secrets.KAMATERA_HOSTNAME }} >> ~/.ssh/known_hosts - scp -r root@${{ secrets.KAMATERA_HOSTNAME }}:/var/www/html/${{ steps.init.outputs.target }}/* "${{ steps.init.outputs.PKG_REPO_PATH }}" || true - if [ ! -d ${{ steps.init.outputs.PKG_REPO_PATH }} ]; then - mkdir -p "${{ steps.init.outputs.PKG_REPO_PATH }}" - fi - - name: Build + + - name: Build Packages if: steps.changes.outputs.changed == 1 run: | set -e + export DEBEMAIL="regolith.linux@gmail.com" export DEBFULLNAME="Regolith Linux" export DEBIAN_FRONTEND=noninteractive + mkdir -p ~/.gnupg/ printf "${{ secrets.PACKAGE_PRIVATE_KEY2 }}" | base64 --decode > ~/.gnupg/private.key gpg --batch --import ~/.gnupg/private.key - ${{ steps.init.outputs.GH_REPO_ROOT }}/.github/scripts/main.sh \ - ${{ steps.init.outputs.GH_REPO_ROOT }} \ - ${{ steps.init.outputs.GH_REPO_ROOT }}/.github/scripts/ext-debian.sh \ - "${{ steps.init.outputs.stage }}" \ - "${{ steps.init.outputs.distro }}" \ - "${{ steps.init.outputs.codename }}" \ - "${{ steps.init.outputs.arch }}" \ - "${{ steps.init.outputs.repo_url }}" \ - "${{ steps.init.outputs.SIGNING_KEY_ID }}" \ + + ${{ steps.init.outputs.gh-repo-path }}/.github/scripts/main.sh \ build \ - ${{ steps.init.outputs.MANIFEST_PATH }} \ - ${{ steps.init.outputs.PKG_REPO_PATH }} \ - ${{ steps.init.outputs.PKG_BUILD_DIR }} | tee -a ${{ steps.init.outputs.GH_REPO_ROOT }}/CHANGELOG_${{ steps.init.outputs.target }}.raw.txt - if [ -f ${{ steps.init.outputs.MANIFEST_PATH }}/next-manifest.txt ]; then + --extension ${{ steps.init.outputs.gh-repo-path }}/.github/scripts/ext-debian.sh \ + --git-repo-path ${{ steps.init.outputs.gh-repo-path }} \ + --manifest-path ${{ steps.init.outputs.manifest-path }} \ + --pkg-build-path ${{ steps.init.outputs.package-build-path }} \ + --pkg-publish-path ${{ steps.init.outputs.package-publish-path }} \ + --distro "${{ steps.init.outputs.distro }}" \ + --codename "${{ steps.init.outputs.codename }}" \ + --arch "${{ steps.init.outputs.arch }}" \ + --stage "${{ steps.init.outputs.stage }}" \ + --suite "${{ steps.init.outputs.suite }}" \ + --component "${{ steps.init.outputs.component }}" | tee -a ${{ steps.init.outputs.changelogs-path }}/CHANGELOG_${{ steps.init.outputs.target }}.raw.txt + + if [ -f ${{ steps.init.outputs.manifest-path }}/next-manifest.txt ]; then echo "Temp manifest not deleted by main.sh, build aborted/failed." - echo "changed=0" >> $GITHUB_OUTPUT exit 1 - else - cat ${{ steps.init.outputs.GH_REPO_ROOT }}/CHANGELOG_${{ steps.init.outputs.target }}.raw.txt | grep ^CHLOG: | cut -c 7- > ${{ steps.init.outputs.GH_REPO_ROOT }}/CHANGELOG_${{ steps.init.outputs.target }}.txt fi + + cat ${{ steps.init.outputs.changelogs-path }}/CHANGELOG_${{ steps.init.outputs.target }}.raw.txt | grep ^CHLOG: | cut -c 7- > ${{ steps.init.outputs.changelogs-path }}/CHANGELOG_${{ steps.init.outputs.target }}.txt + cat ${{ steps.init.outputs.changelogs-path }}/CHANGELOG_${{ steps.init.outputs.target }}.raw.txt | grep ^SRCLOG: | cut -c 8- > ${{ steps.init.outputs.changelogs-path }}/SOURCELOG_${{ steps.init.outputs.target }}.txt + + if [ ! -s ${{ steps.init.outputs.changelogs-path }}/CHANGELOG_${{ steps.init.outputs.target }}.txt ] ; then + rm ${{ steps.init.outputs.changelogs-path }}/CHANGELOG_${{ steps.init.outputs.target }}.txt + fi + + if [ ! -s ${{ steps.init.outputs.changelogs-path }}/SOURCELOG_${{ steps.init.outputs.target }}.txt ] ; then + rm ${{ steps.init.outputs.changelogs-path }}/SOURCELOG_${{ steps.init.outputs.target }}.txt + fi + - name: Deploy via rsync if: steps.changes.outputs.changed == 1 run: | set -e set -x - for i in 1 2 3 4 5; do echo "Attempt $i" && rsync -avzh ${{ steps.init.outputs.PKG_REPO_PATH }}/* root@${{ secrets.KAMATERA_HOSTNAME }}:/var/www/html/${{ steps.init.outputs.target }} && break || sleep 5; done + + ssh-keyscan -H ${{ secrets.KAMATERA_HOSTNAME2 }} >> ~/.ssh/known_hosts + + for i in 1 2 3 4 5; do + echo "Attempt $i" + rsync \ + -avzhH \ + ${{ steps.init.outputs.package-publish-path }}/* \ + root@${{ secrets.KAMATERA_HOSTNAME2 }}:/opt/archives/packages/ && break || sleep 5 + done + + rsync --ignore-missing-args ${{ steps.init.outputs.changelogs-path }}/SOURCELOG_${{ steps.init.outputs.target }}.txt root@${{ secrets.KAMATERA_HOSTNAME2 }}:/opt/archives/workspace/ + rsync --mkpath ${{ steps.init.outputs.manifest-path }}/manifest.txt root@${{ secrets.KAMATERA_HOSTNAME2 }}:/opt/archives/manifests/${{ steps.init.outputs.distro }}/${{ steps.init.outputs.codename }}/${{ steps.init.outputs.suite }}-${{ steps.init.outputs.component }}/${{ steps.init.outputs.arch }}/ + - name: Log Build Output if: steps.changes.outputs.changed == 1 run: | - cat ${{ steps.init.outputs.PKG_REPO_PATH }}/manifest.txt || true - echo "PKG_BUILD_DIR:" - find ${{ steps.init.outputs.PKG_BUILD_DIR }} - - name: Cleanup - run: | - # FIXME(kgilmer) extract following logic to distro-specific script - # Remove regolith repo from build system apt config - if [ -f /etc/apt/sources.list.d/regolith.list ]; then - sudo rm -f /etc/apt/sources.list.d/regolith.list - fi - - uses: actions/upload-artifact@v4 + cat ${{ steps.init.outputs.manifest-path }}/manifest.txt || true + echo "package-publish-path:" + find ${{ steps.init.outputs.package-publish-path }} + + - name: Upload Artifacts + uses: actions/upload-artifact@v4 if: steps.changes.outputs.changed == 1 with: name: CHANGELOG_${{ steps.init.outputs.target }} - path: | - ${{ steps.init.outputs.GH_REPO_ROOT }}/CHANGELOG_${{ steps.init.outputs.target }}.txt + path: ${{ steps.init.outputs.changelogs-path }}/*${{ steps.init.outputs.target }}.txt - test: + # calculate changelogs + changelogs: + runs-on: ubuntu-24.04 needs: build - uses: ./.github/workflows/test-desktop-installable2.yml - - generate-release: - needs: build - runs-on: ubuntu-20.04 + outputs: + package-changed: ${{ steps.check.outputs.package-changed }} + source-changed: ${{ steps.check.outputs.source-changed }} steps: - - uses: actions/download-artifact@v4 - - name: Concat Release Notes - id: release-setup + - name: Download Artifacts + uses: actions/download-artifact@v4 + with: + path: changelogs + pattern: CHANGELOG_* + merge-multiple: true + + - name: Check Changelogs + id: check run: | set -e - echo "TIMESTAMP=$(date +%Y%m%d_%H%M%S)" >> $GITHUB_OUTPUT - FILES=$(find . -name CHANGELOG\*) - if [ -n "$FILES" ]; then - cat CHANGELOG_*/CHANGELOG_*.txt >> CHANGELOG.txt - echo "changed=1" >> $GITHUB_OUTPUT + + if [ ! -d changelogs ]; then + echo "No package file found to publish!" + echo "No source file found to rebuild!" + + echo "package-changed=0" >> $GITHUB_OUTPUT + echo "source-changed=0" >> $GITHUB_OUTPUT else - echo "changed=0" >> $GITHUB_OUTPUT + ls -R changelogs/ + + echo "package-changed=$(find changelogs -name CHANGELOG_\*.txt | wc -l)" >> $GITHUB_OUTPUT + echo "source-changed=$(find changelogs -name SOURCELOG_\*.txt | wc -l)" >> $GITHUB_OUTPUT fi + + # rebuild sources + source: + needs: changelogs + if: ${{ !failure() && !cancelled() && needs.changelogs.outputs.source-changed != 0 }} + uses: ./.github/workflows/rebuild-sources.yml + with: + pull-from: /opt/archives/workspace/ + push-to: /opt/archives/packages/ + secrets: inherit + + # publish archives + publish: + needs: [changelogs, source] + if: ${{ !failure() && !cancelled() && needs.changelogs.outputs.package-changed != 0 }} + uses: ./.github/workflows/publish-packages.yml + with: + packages-path: /opt/archives/packages/ + secrets: inherit + + # create a release with changlogs + release: + runs-on: ubuntu-24.04 + needs: [changelogs, publish] + if: ${{ !failure() && !cancelled() && needs.changelogs.outputs.package-changed != 0 }} + steps: + - name: Download Artifacts + uses: actions/download-artifact@v4 + with: + path: changelogs + pattern: CHANGELOG_* + merge-multiple: true + + - name: Prepare Release + id: prepare + run: | + echo "TIMESTAMP=$(date +%Y%m%d_%H%M%S)" >> $GITHUB_OUTPUT + find changelogs/ -name CHANGELOG_\*.txt -exec sh -c 'cat "$1" >> CHANGELOG.txt' -- {} \; + cat CHANGELOG.txt + - uses: softprops/action-gh-release@v2 - if: steps.release-setup.outputs.changed == 1 with: body: See CHANGELOG.txt for updates and manifests for current state of repos. - name: Package Build ${{ steps.release-setup.outputs.TIMESTAMP }} - tag_name: pkgbuild-${{ steps.release-setup.outputs.TIMESTAMP }} + name: Package Build ${{ steps.prepare.outputs.TIMESTAMP }} + tag_name: pkgbuild-${{ steps.prepare.outputs.TIMESTAMP }} files: | *.txt + + # run the tests + test: + needs: [changelogs, release] + if: ${{ !failure() && !cancelled() }} + uses: ./.github/workflows/test-desktop-installable2.yml + with: + stage: ${{ inputs.stage }} + distro: ${{ inputs.distro }} + codename: ${{ inputs.codename }} + arch: ${{ inputs.arch }} diff --git a/.github/workflows/build-rpm.yml b/.github/workflows/build-rpm.yml index 2fc18862..5029a8b2 100644 --- a/.github/workflows/build-rpm.yml +++ b/.github/workflows/build-rpm.yml @@ -1,4 +1,4 @@ -name: RPM Package Builder +name: Package Builder RPM on: workflow_dispatch: @@ -21,21 +21,27 @@ jobs: distro: fedora codename: 36 container: fedora:36 + + - stage: experimental + suite: experimental + component: main steps: - uses: actions/checkout@v4 - name: Set Job Parameters id: init run: | - echo ::set-output name=MANIFEST_PATH::"${{ github.workspace }}/manifests" - echo ::set-output name=PKG_REPO_PATH::"${{ github.workspace }}/repo" - echo ::set-output name=PKG_BUILD_DIR::"${{ github.workspace }}/packages" - echo ::set-output name=GH_REPO_ROOT::"${{ github.workspace }}" - echo ::set-output name=stage::${{ matrix.stage }} - echo ::set-output name=distro::${{ matrix.distro }} - echo ::set-output name=codename::${{ matrix.codename }} - echo ::set-output name=arch::${{ matrix.arch }} - echo ::set-output name=target::${{ matrix.stage }}-${{ matrix.distro }}-${{ matrix.codename }}-${{ matrix.arch }} - echo ::set-output name=repo_url::https://regolith-desktop.org/${{ matrix.stage }}-${{ matrix.distro }}-${{ matrix.codename }}-${{ matrix.arch }} + echo "MANIFEST_PATH=${{ github.workspace }}/manifests" >> $GITHUB_OUTPUT + echo "PKG_REPO_PATH=${{ github.workspace }}/repo" >> $GITHUB_OUTPUT + echo "PKG_BUILD_DIR=${{ github.workspace }}/packages" >> $GITHUB_OUTPUT + echo "GH_REPO_ROOT=${{ github.workspace }}" >> $GITHUB_OUTPUT + echo "stage=${{ matrix.stage }}" >> $GITHUB_OUTPUT + echo "distro=${{ matrix.distro }}" >> $GITHUB_OUTPUT + echo "codename=${{ matrix.codename }}" >> $GITHUB_OUTPUT + echo "arch=${{ matrix.arch }}" >> $GITHUB_OUTPUT + echo "suite=${{ matrix.suite }}" >> $GITHUB_OUTPUT + echo "component=${{ matrix.component }}" >> $GITHUB_OUTPUT + echo "target=${{ matrix.stage }}-${{ matrix.distro }}-${{ matrix.codename }}-${{ matrix.arch }}" >> $GITHUB_OUTPUT + echo "repo_url=https://regolith-desktop.org/${{ matrix.stage }}-${{ matrix.distro }}-${{ matrix.codename }}-${{ matrix.arch }}" >> $GITHUB_OUTPUT - name: Env setup run: | set -e @@ -54,18 +60,18 @@ jobs: set -e set -x CHANGE_OUTPUT=$(${{ steps.init.outputs.GH_REPO_ROOT }}/.github/scripts/main.sh \ - ${{ steps.init.outputs.GH_REPO_ROOT }} \ - ${{ steps.init.outputs.GH_REPO_ROOT }}/.github/scripts/ext-rpm.sh \ - "${{ steps.init.outputs.stage }}" \ - "${{ steps.init.outputs.distro }}" \ - "${{ steps.init.outputs.codename }}" \ - "${{ steps.init.outputs.arch }}" \ - "unneeded to check change" \ - "unneeded to check change" \ check \ - ${{ steps.init.outputs.MANIFEST_PATH }} \ - ${{ steps.init.outputs.PKG_REPO_PATH }} \ - ${{ steps.init.outputs.PKG_BUILD_DIR }} | tail -n1) + --extension ${{ steps.init.outputs.GH_REPO_ROOT }}/.github/scripts/ext-rpm.sh \ + --git-repo-path ${{ steps.init.outputs.GH_REPO_ROOT }} \ + --manifest-path ${{ steps.init.outputs.MANIFEST_PATH }} \ + --pkg-build-path ${{ steps.init.outputs.PKG_BUILD_DIR }} \ + --pkg-publish-path ${{ steps.init.outputs.PKG_REPO_PATH }} \ + --distro "${{ steps.init.outputs.distro }}" \ + --codename "${{ steps.init.outputs.codename }}" \ + --arch "${{ steps.init.outputs.arch }}" \ + --stage "${{ steps.init.outputs.stage }}" \ + --suite "${{ steps.init.outputs.suite }}" \ + --component "${{ steps.init.outputs.component }}" | tail -n1) if [ "$CHANGE_OUTPUT" == "No package changes found, exiting." ]; then echo ::set-output name=changed::0 echo "No package changes to build" @@ -98,18 +104,18 @@ jobs: printf "${{ secrets.PACKAGE_PRIVATE_KEY2 }}" | base64 --decode > ~/.gnupg/private.key gpg --batch --import ~/.gnupg/private.key ${{ steps.init.outputs.GH_REPO_ROOT }}/.github/scripts/main.sh \ - ${{ steps.init.outputs.GH_REPO_ROOT }} \ - ${{ steps.init.outputs.GH_REPO_ROOT }}/.github/scripts/ext-rpm.sh \ - "${{ steps.init.outputs.stage }}" \ - "${{ steps.init.outputs.distro }}" \ - "${{ steps.init.outputs.codename }}" \ - "${{ steps.init.outputs.arch }}" \ - "${{ steps.init.outputs.repo_url }}" \ - Default \ build \ - ${{ steps.init.outputs.MANIFEST_PATH }} \ - ${{ steps.init.outputs.PKG_REPO_PATH }} \ - ${{ steps.init.outputs.PKG_BUILD_DIR }} | tee -a ${{ steps.init.outputs.GH_REPO_ROOT }}/CHANGELOG_${{ steps.init.outputs.target }}.raw.txt + --extension ${{ steps.init.outputs.GH_REPO_ROOT }}/.github/scripts/ext-rpm.sh \ + --git-repo-path ${{ steps.init.outputs.GH_REPO_ROOT }} \ + --manifest-path ${{ steps.init.outputs.MANIFEST_PATH }} \ + --pkg-build-path ${{ steps.init.outputs.PKG_BUILD_DIR }} \ + --pkg-publish-path ${{ steps.init.outputs.PKG_REPO_PATH }} \ + --distro "${{ steps.init.outputs.distro }}" \ + --codename "${{ steps.init.outputs.codename }}" \ + --arch "${{ steps.init.outputs.arch }}" \ + --stage "${{ steps.init.outputs.stage }}" \ + --suite "${{ steps.init.outputs.suite }}" \ + --component "${{ steps.init.outputs.component }}" | tee -a ${{ steps.init.outputs.GH_REPO_ROOT }}/CHANGELOG_${{ steps.init.outputs.target }}.raw.txt if [ -s "${{ steps.init.outputs.PKG_REPO_PATH }}/manifest.txt" ]; then cat ${{ steps.init.outputs.GH_REPO_ROOT }}/CHANGELOG_${{ steps.init.outputs.target }}.raw.txt | grep ^CHLOG: | cut -c 7- > ${{ steps.init.outputs.GH_REPO_ROOT }}/CHANGELOG_${{ steps.init.outputs.target }}.txt else diff --git a/.github/workflows/publish-packages.yml b/.github/workflows/publish-packages.yml new file mode 100644 index 00000000..dc9a88ac --- /dev/null +++ b/.github/workflows/publish-packages.yml @@ -0,0 +1,62 @@ +name: Publish Packages +run-name: Publish Packages ${{ inputs.only-distro }} ${{ inputs.only-codename }} ${{ inputs.only-component }} + +on: + workflow_dispatch: + inputs: + packages-path: + description: "Packages path on disk" + required: true + default: "/opt/archives/packages/" + only-distro: + description: "Only publish this distro" + required: false + default: "" + only-codename: + description: "Only publish this codename" + required: false + default: "" + only-component: + description: "Only publish this component" + required: false + default: "" + workflow_call: + inputs: + packages-path: + description: "Packages path on disk" + type: string + required: true + default: "/opt/archives/packages/" + only-distro: + description: "Only publish this distro" + type: string + required: false + default: "" + only-codename: + description: "Only publish this codename" + type: string + required: false + default: "" + only-component: + description: "Only publish this component" + type: string + required: false + default: "" + +jobs: + publish: + runs-on: ubuntu-24.04 + steps: + - name: Setup SSH agent + uses: webfactory/ssh-agent@v0.9.0 + with: + ssh-private-key: ${{ secrets.KAMATERA_SSH_KEY }} + + - name: Publish Packages + run: | + set -e + set -x + + ssh-keyscan -H ${{ secrets.KAMATERA_HOSTNAME2 }} >> ~/.ssh/known_hosts + ssh root@${{ secrets.KAMATERA_HOSTNAME2 }} "publish-repos.sh \"${{ inputs.packages-path }}\" \"${{ inputs.only-distro }}\" \"${{ inputs.only-codename }}\" \"${{ inputs.only-component }}\"" + ssh root@${{ secrets.KAMATERA_HOSTNAME2 }} "find \"${{ inputs.packages-path }}\" " diff --git a/.github/workflows/rebuild-sources.yml b/.github/workflows/rebuild-sources.yml new file mode 100644 index 00000000..695bcaea --- /dev/null +++ b/.github/workflows/rebuild-sources.yml @@ -0,0 +1,152 @@ +name: Rebuild Sources + +on: + workflow_dispatch: + inputs: + pull-from: + description: "Path on disk to pull from" + required: true + default: "/opt/archives/workspace/" + push-to: + description: "Path on disk to push to" + required: true + default: "/opt/archives/packages/" + only-distro: + description: "Only rebuild sources of this distro" + required: false + default: "" + only-codename: + description: "Only rebuild sources of this codename" + required: false + default: "" + only-component: + description: "Only rebuild sources of this component" + required: false + default: "" + only-package: + description: "Only rebuild sources of this package" + required: false + default: "" + workflow_call: + inputs: + pull-from: + description: "Path on disk to pull from" + type: string + required: true + default: "/opt/archives/workspace/" + push-to: + description: "Path on disk to push to" + type: string + required: true + default: "/opt/archives/packages/" + only-distro: + description: "Only rebuild sources of this distro" + type: string + required: false + default: "" + only-codename: + description: "Only rebuild sources of this codename" + type: string + required: false + default: "" + only-component: + description: "Only rebuild sources of this component" + type: string + required: false + default: "" + only-package: + description: "Only rebuild sources of this package" + type: string + required: false + default: "" + +jobs: + rebuild: + runs-on: ubuntu-24.04 + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set Job Parameters + id: init + run: | + echo "package-build-path=${{ github.workspace }}/packages" >> $GITHUB_OUTPUT + + - name: Environment Setup + run: | + set -e + + rm -Rf "${{ steps.init.outputs.package-build-path }}" + + sudo apt update + DEBIAN_FRONTEND=noninteractive sudo apt install -y --no-install-recommends git devscripts wget dput + + export DEBEMAIL="regolith.linux@gmail.com" + export DEBFULLNAME="Regolith Linux" + export DEBIAN_FRONTEND=noninteractive + + mkdir -p ~/.gnupg/ + printf "${{ secrets.PACKAGE_PRIVATE_KEY2 }}" | base64 --decode > ~/.gnupg/private.key + gpg --batch --import ~/.gnupg/private.key + + - name: Setup SSH agent + uses: webfactory/ssh-agent@v0.9.0 + with: + ssh-private-key: ${{ secrets.KAMATERA_SSH_KEY }} + + - name: Pull Packages + run: | + set -e + set -x + + ssh-keyscan -H ${{ secrets.KAMATERA_HOSTNAME2 }} >> ~/.ssh/known_hosts + mkdir -p "${{ steps.init.outputs.package-build-path }}" + + ssh root@${{ secrets.KAMATERA_HOSTNAME2 }} "get-published-sources.sh --workspace-path \"${{ inputs.pull-from }}\"" + + rsync \ + -avzh \ + --exclude="*.*/" \ + --include="*/" \ + --include="*.orig.tar.gz" \ + --include="*.debian.tar.xz" \ + --include="*.diff.gz" \ + --exclude="*" \ + root@${{ secrets.KAMATERA_HOSTNAME2 }}:${{ inputs.pull-from }} \ + "${{ steps.init.outputs.package-build-path }}" + + - name: Rebuild Sources + run: | + set -e + + command_arguments=(--pkg-build-path "${{ steps.init.outputs.package-build-path }}") + + if [ -n "${{ inputs.only-distro }}" ]; then + command_arguments+=(--only-distro "${{ inputs.only-distro }}") + fi + if [ -n "${{ inputs.only-codename }}" ]; then + command_arguments+=(--only-codename "${{ inputs.only-codename }}") + fi + if [ -n "${{ inputs.only-component }}" ]; then + command_arguments+=(--only-component "${{ inputs.only-component }}") + fi + if [ -n "${{ inputs.only-package }}" ]; then + command_arguments+=(--only-package "${{ inputs.only-package }}") + fi + + ./.github/scripts/rebuild-sources.sh ${command_arguments[@]} + + - name: Deploy via rsync + run: | + set -e + set -x + + for i in 1 2 3 4 5; do + echo "Attempt $i" + rsync \ + -avzhH \ + ${{ steps.init.outputs.package-build-path }}/* \ + root@${{ secrets.KAMATERA_HOSTNAME2 }}:${{ inputs.push-to }} && break || sleep 5 + done + + ssh root@${{ secrets.KAMATERA_HOSTNAME2 }} "cleanup-workspace.sh --workspace-path \"${{ inputs.pull-from }}\"" diff --git a/.github/workflows/test-builder.yml b/.github/workflows/test-builder.yml index f8f36a62..3d0351ab 100644 --- a/.github/workflows/test-builder.yml +++ b/.github/workflows/test-builder.yml @@ -1,4 +1,4 @@ -name: Test builder script +name: Test Builder Scripts on: workflow_dispatch: @@ -28,42 +28,61 @@ jobs: - distro-codename: debian-bullseye distro: debian codename: bullseye + + - stage: unstable + suite: unstable + component: main + - stage: testing + suite: testing + component: main + - stage: release + suite: stable + component: main + steps: - uses: actions/checkout@v4 + - name: Set Job Parameters id: init run: | - echo "MANIFEST_PATH=${{ github.workspace }}/manifests" >> $GITHUB_OUTPUT - echo "PKG_REPO_PATH=${{ github.workspace }}/repo" >> $GITHUB_OUTPUT - echo "PKG_BUILD_DIR=${{ github.workspace }}/packages" >> $GITHUB_OUTPUT - echo "GH_REPO_ROOT=${{ github.workspace }}" >> $GITHUB_OUTPUT + echo "gh-repo-path=${{ github.workspace }}" >> $GITHUB_OUTPUT + echo "manifest-path=${{ github.workspace }}/manifests" >> $GITHUB_OUTPUT + echo "package-build-path=${{ github.workspace }}/packages" >> $GITHUB_OUTPUT + echo "package-publish-path=${{ github.workspace }}/publish" >> $GITHUB_OUTPUT echo "stage=${{ matrix.stage }}" >> $GITHUB_OUTPUT echo "distro=${{ matrix.distro }}" >> $GITHUB_OUTPUT echo "codename=${{ matrix.codename }}" >> $GITHUB_OUTPUT echo "arch=${{ matrix.arch }}" >> $GITHUB_OUTPUT - echo "target=${{ matrix.stage }}-${{ matrix.distro }}-${{ matrix.codename }}-${{ matrix.arch }}" >> $GITHUB_OUTPUT + echo "suite=${{ matrix.suite }}" >> $GITHUB_OUTPUT + echo "component=${{ matrix.component }}" >> $GITHUB_OUTPUT + - name: Clean tmp run: | set -x - rm -Rf ${{ steps.init.outputs.PKG_REPO_PATH }} || true - mkdir ${{ steps.init.outputs.PKG_REPO_PATH }} - rm -Rf ${{ steps.init.outputs.MANIFEST_PATH }} || true - mkdir ${{ steps.init.outputs.MANIFEST_PATH }} - rm -Rf ${{ steps.init.outputs.PKG_BUILD_DIR }} || true - mkdir ${{ steps.init.outputs.PKG_BUILD_DIR }} + + rm -Rf ${{ steps.init.outputs.manifest-path }} || true + mkdir -p ${{ steps.init.outputs.manifest-path }} + + rm -Rf ${{ steps.init.outputs.package-build-path }} || true + mkdir -p ${{ steps.init.outputs.package-build-path }} + + rm -Rf ${{ steps.init.outputs.package-publish-path }} || true + mkdir -p ${{ steps.init.outputs.package-publish-path }} + - name: Test Build run: | set -x + ${{ github.workspace }}/.github/scripts/main.sh \ - "${{ github.workspace }}" \ - "${{ github.workspace }}/.github/scripts/ext-tester.sh" \ - "${{ steps.init.outputs.stage }}" \ - "${{ steps.init.outputs.distro }}" \ - "${{ steps.init.outputs.codename }}" \ - "${{ steps.init.outputs.arch }}" \ - test_repo_url \ - Default \ check \ - ${{ steps.init.outputs.MANIFEST_PATH }} \ - ${{ steps.init.outputs.PKG_REPO_PATH }} \ - ${{ steps.init.outputs.PKG_BUILD_DIR }} + --extension "${{ github.workspace }}/.github/scripts/ext-tester.sh" \ + --git-repo-path "${{ steps.init.outputs.gh-repo-path }}" \ + --manifest-path ${{ steps.init.outputs.manifest-path }} \ + --pkg-build-path ${{ steps.init.outputs.package-build-path }} \ + --pkg-publish-path ${{ steps.init.outputs.package-publish-path }} \ + --distro "${{ steps.init.outputs.distro }}" \ + --codename "${{ steps.init.outputs.codename }}" \ + --arch "${{ steps.init.outputs.arch }}" \ + --stage "${{ steps.init.outputs.stage }}" \ + --suite "${{ steps.init.outputs.suite }}" \ + --component "${{ steps.init.outputs.component }}" diff --git a/.github/workflows/test-desktop-installable2.yml b/.github/workflows/test-desktop-installable2.yml index ada3a2fa..3fa05a2e 100644 --- a/.github/workflows/test-desktop-installable2.yml +++ b/.github/workflows/test-desktop-installable2.yml @@ -1,129 +1,426 @@ -name: Test Regolith desktop is installable +name: Test Regolith Desktop +run-name: Test ${{ inputs.stage }} Regolith Desktop ${{ inputs.distro }} ${{ inputs.codename }} ${{ inputs.arch }} on: + schedule: + - cron: '0 2 * * 0' workflow_dispatch: + inputs: + legacy: + description: "Test legacy distros" + type: choice + options: + - "yes" + - "no" + required: false + default: "no" + stage: + description: "Stages to test" + type: choice + options: + - all + - experimental + - unstable + - testing + - stable + - release-3_0 + - release-3_1 + - release-3_2 + required: true + default: "unstable" + distro: + description: "Distro to test (debian, ubuntu)" + type: choice + options: + - "" + - debian + - ubuntu + required: false + default: "" + codename: + description: "Codename to test (e.g. noble, bookworm)" + type: string + required: false + default: "" + arch: + description: "Architecture to test (amd64, arm64)" + type: choice + options: + - "" + - amd64 + - arm64 + required: false + default: "" workflow_call: + inputs: + legacy: + description: "Test legacy distros" + type: string + required: false + default: "no" + stage: + description: "Stage to test" + type: string + required: true + default: "unstable" + distro: + description: "Distro to test (debian, ubuntu)" + type: string + required: false + default: "" + codename: + description: "Codename to test (e.g. noble, bookworm)" + type: string + required: false + default: "" + arch: + description: "Architecture to test (amd64, arm64)" + type: string + required: false + default: "" jobs: - test-debian-bookworm-install: - runs-on: ${{ matrix.host-os }} + matrix-builder: + runs-on: ubuntu-24.04 + outputs: + stages: ${{ steps.calc-matrix.outputs.stages }} + arches: ${{ steps.calc-matrix.outputs.arches }} + suites: ${{ steps.calc-matrix.outputs.suites }} + runners: ${{ steps.calc-matrix.outputs.runners }} + steps: + - name: Calculate Matrix + id: calc-matrix + run: | + debian_bullseye=(unstable testing stable release-3_0 release-3_1) + debian_bookworm=(unstable testing stable release-3_2) + debian_testing=(unstable testing) # testing is never released + ubuntu_focal=(unstable testing stable release-3_0 release-3_1) + ubuntu_jammy=(unstable testing stable release-3_0 release-3_1 release-3_2) + ubuntu_lunar=(unstable testing stable release-3_0) + ubuntu_mantic=(unstable testing stable release-3_1) + ubuntu_noble=(unstable testing stable release-3_2) + ubuntu_oracular=(unstable testing) + + debian_bullseye_list=() + debian_bookworm_list=() + debian_testing_list=() + ubuntu_focal_list=() + ubuntu_jammy_list=() + ubuntu_lunar_list=() + ubuntu_mantic_list=() + ubuntu_noble_list=() + ubuntu_oracular_list=() + + if [ -n "${{ inputs.stage }}" ] && [ "${{ inputs.stage }}" != "all" ]; then + if [[ " ${debian_bullseye[*]} " =~ [[:space:]]${{ inputs.stage }}[[:space:]] ]]; then + debian_bullseye_list=(${{ inputs.stage }}) + fi + if [[ " ${debian_bookworm[*]} " =~ [[:space:]]${{ inputs.stage }}[[:space:]] ]]; then + debian_bookworm_list=(${{ inputs.stage }}) + fi + if [[ " ${debian_testing[*]} " =~ [[:space:]]${{ inputs.stage }}[[:space:]] ]]; then + debian_testing_list=(${{ inputs.stage }}) + fi + if [[ " ${ubuntu_focal[*]} " =~ [[:space:]]${{ inputs.stage }}[[:space:]] ]]; then + ubuntu_focal_list=(${{ inputs.stage }}) + fi + if [[ " ${ubuntu_jammy[*]} " =~ [[:space:]]${{ inputs.stage }}[[:space:]] ]]; then + ubuntu_jammy_list=(${{ inputs.stage }}) + fi + if [[ " ${ubuntu_lunar[*]} " =~ [[:space:]]${{ inputs.stage }}[[:space:]] ]]; then + ubuntu_lunar_list=(${{ inputs.stage }}) + fi + if [[ " ${ubuntu_mantic[*]} " =~ [[:space:]]${{ inputs.stage }}[[:space:]] ]]; then + ubuntu_mantic_list=(${{ inputs.stage }}) + fi + if [[ " ${ubuntu_noble[*]} " =~ [[:space:]]${{ inputs.stage }}[[:space:]] ]]; then + ubuntu_noble_list=(${{ inputs.stage }}) + fi + if [[ " ${ubuntu_oracular[*]} " =~ [[:space:]]${{ inputs.stage }}[[:space:]] ]]; then + ubuntu_oracular_list=(${{ inputs.stage }}) + fi + else + debian_bullseye_list=(${debian_bullseye[@]}) + debian_bookworm_list=(${debian_bookworm[@]}) + debian_testing_list=(${debian_testing[@]}) + ubuntu_focal_list=(${ubuntu_focal[@]}) + ubuntu_jammy_list=(${ubuntu_jammy[@]}) + ubuntu_lunar_list=(${ubuntu_lunar[@]}) + ubuntu_mantic_list=(${ubuntu_mantic[@]}) + ubuntu_noble_list=(${ubuntu_noble[@]}) + ubuntu_oracular_list=(${ubuntu_oracular[@]}) + fi + + STAGES=$(jq -n -c \ + --argjson debian-bullseye "$(jq -n -c '$ARGS.positional' --args -- "${debian_bullseye_list[@]}")" \ + --argjson debian-bookworm "$(jq -n -c '$ARGS.positional' --args -- "${debian_bookworm_list[@]}")" \ + --argjson debian-testing "$(jq -n -c '$ARGS.positional' --args -- "${debian_testing_list[@]}")" \ + --argjson ubuntu-focal "$(jq -n -c '$ARGS.positional' --args -- "${ubuntu_focal_list[@]}")" \ + --argjson ubuntu-jammy "$(jq -n -c '$ARGS.positional' --args -- "${ubuntu_jammy_list[@]}")" \ + --argjson ubuntu-lunar "$(jq -n -c '$ARGS.positional' --args -- "${ubuntu_lunar_list[@]}")" \ + --argjson ubuntu-mantic "$(jq -n -c '$ARGS.positional' --args -- "${ubuntu_mantic_list[@]}")" \ + --argjson ubuntu-noble "$(jq -n -c '$ARGS.positional' --args -- "${ubuntu_noble_list[@]}")" \ + --argjson ubuntu-oracular "$(jq -n -c '$ARGS.positional' --args -- "${ubuntu_oracular_list[@]}")" \ + '$ARGS.named' + ) + + if [ -n "${{ inputs.arch }}" ]; then + ARCHES=(${{ inputs.arch }}) + else + ARCHES=(amd64 arm64) + fi + + SUITES=$(jq -n "$(jq -n -c \ + --argjson unstable "$(jq -n -c --arg suite "unstable" --arg component "main" '$ARGS.named')" \ + --argjson testing "$(jq -n -c --arg suite "testing" --arg component "main" '$ARGS.named')" \ + --argjson stable "$(jq -n -c --arg suite "stable" --arg component "main" '$ARGS.named')" \ + --argjson release-3_0 "$(jq -n -c --arg suite "stable" --arg component "v3.0" '$ARGS.named')" \ + --argjson release-3_1 "$(jq -n -c --arg suite "stable" --arg component "v3.1" '$ARGS.named')" \ + --argjson release-3_2 "$(jq -n -c --arg suite "stable" --arg component "v3.2" '$ARGS.named')" \ + '$ARGS.named'\ + )" '$ARGS.named') + + echo "stages=$(jq -n -c "${STAGES}" '$ARGS.named')" >> $GITHUB_OUTPUT + echo "arches=$(jq -n -c '$ARGS.positional' --args -- "${ARCHES[@]}")" >> $GITHUB_OUTPUT + echo "suites=$(jq -n -c "${SUITES}" '$ARGS.named')" >> $GITHUB_OUTPUT + echo "runners=$(jq -n -c "$(jq -n -c --arg amd64 "X64" --arg arm64 "arm64" '$ARGS.named')" '$ARGS.named')" >> $GITHUB_OUTPUT + + debian-bullseye: + runs-on: [self-hosted, Linux, "${{ fromJSON(needs.matrix-builder.outputs.runners)[matrix.arch] }}", bullseye] + needs: matrix-builder + if: | + (inputs.legacy == 'yes') && + ( + (inputs.distro == '' && inputs.codename == '') || + (inputs.distro == 'debian' && inputs.codename == '') || + (inputs.distro == '' && inputs.codename == 'bullseye') || + (inputs.distro == 'debian' && inputs.codename == 'bullseye') + ) + strategy: + fail-fast: false + matrix: + stage: ${{ fromJSON(needs.matrix-builder.outputs.stages)['debian-bullseye'] }} + arch: ${{ fromJson(needs.matrix-builder.outputs.arches) }} + wm: [regolith-session-flashback] + env: + distro: debian + codename: bullseye + steps: + - name: Install ${{ matrix.wm }} ${{ matrix.stage }} on ${{ env.distro }} ${{ env.codename }} + uses: regolith-linux/actions/test-desktop/debian/bullseye@main + with: + apt-key-url: http://archive.regolith-desktop.com/regolith.key + apt-repo-line: "deb [arch=${{ matrix.arch }}] http://archive.regolith-desktop.com/${{ env.distro }}/${{ fromJSON(needs.matrix-builder.outputs.suites)[matrix.stage]['suite'] }} ${{ env.codename }} ${{ fromJSON(needs.matrix-builder.outputs.suites)[matrix.stage]['component'] }}" + target-package: "regolith-desktop ${{ matrix.wm }}" + + debian-bookworm: + runs-on: [self-hosted, Linux, "${{ fromJSON(needs.matrix-builder.outputs.runners)[matrix.arch] }}", bookworm] + needs: matrix-builder + if: | + (inputs.distro == '' && inputs.codename == '') || + (inputs.distro == 'debian' && inputs.codename == '') || + (inputs.distro == '' && inputs.codename == 'bookworm') || + (inputs.distro == 'debian' && inputs.codename == 'bookworm') strategy: + fail-fast: false matrix: - stage: [unstable, testing, release-3_2] # , release - distro-codename: [debian-bookworm] - arch: [amd64, arm64] + stage: ${{ fromJSON(needs.matrix-builder.outputs.stages)['debian-bookworm'] }} + arch: ${{ fromJson(needs.matrix-builder.outputs.arches) }} wm: [regolith-session-flashback] - include: - - arch: amd64 - host-os: ubuntu-20.04 - - arch: arm64 - host-os: [self-hosted, Linux, ARM64, bookworm] - - distro-codename: debian-bookworm - distro: debian - codename: bookworm + env: + distro: debian + codename: bookworm steps: - - name: Test ${{ matrix.stage }} ${{ matrix.distro-codename }} ${{ matrix.arch }} - uses: regolith-linux/test-desktop-installable-action/debian/bookworm@a46d23d5752c3bd45e1c692f908975e4a63c8e26 + - name: Install ${{ matrix.wm }} ${{ matrix.stage }} on ${{ env.distro }} ${{ env.codename }} + uses: regolith-linux/actions/test-desktop/debian/bookworm@main with: - apt-key-url: http://regolith-desktop.org/regolith3.key - apt-repo-line: "deb [arch=${{ matrix.arch }}] https://regolith-desktop.org/${{ matrix.stage }}-${{ matrix.distro }}-${{ matrix.codename }}-${{ matrix.arch }} ${{ matrix.codename }} main" + apt-key-url: http://archive.regolith-desktop.com/regolith.key + apt-repo-line: "deb [arch=${{ matrix.arch }}] http://archive.regolith-desktop.com/${{ env.distro }}/${{ fromJSON(needs.matrix-builder.outputs.suites)[matrix.stage]['suite'] }} ${{ env.codename }} ${{ fromJSON(needs.matrix-builder.outputs.suites)[matrix.stage]['component'] }}" target-package: "regolith-desktop ${{ matrix.wm }}" - test-debian-testing-install: - runs-on: ${{ matrix.host-os }} + debian-testing: + runs-on: [self-hosted, Linux, "${{ fromJSON(needs.matrix-builder.outputs.runners)[matrix.arch] }}", testing] + needs: matrix-builder + if: | + (inputs.distro == '' && inputs.codename == '') || + (inputs.distro == 'debian' && inputs.codename == '') || + (inputs.distro == '' && inputs.codename == 'testing') || + (inputs.distro == 'debian' && inputs.codename == 'testing') strategy: + fail-fast: false matrix: - stage: [unstable, testing] # , testing is never released - distro-codename: [debian-testing] - arch: [amd64, arm64] + stage: ${{ fromJSON(needs.matrix-builder.outputs.stages)['debian-testing'] }} + arch: ${{ fromJson(needs.matrix-builder.outputs.arches) }} wm: [regolith-session-flashback, regolith-session-sway] - include: - - arch: amd64 - host-os: [self-hosted, Linux, X64, testing] - - arch: arm64 - host-os: [self-hosted, Linux, ARM64, testing] - - distro-codename: debian-testing - distro: debian - codename: testing + env: + distro: debian + codename: testing steps: - - name: Test ${{ matrix.stage }} ${{ matrix.distro-codename }} ${{ matrix.arch }} - uses: regolith-linux/test-desktop-installable-action/debian/testing@a46d23d5752c3bd45e1c692f908975e4a63c8e26 + - name: Install ${{ matrix.wm }} ${{ matrix.stage }} on ${{ env.distro }} ${{ env.codename }} + uses: regolith-linux/actions/test-desktop/debian/testing@main with: - apt-key-url: http://regolith-desktop.org/regolith3.key - apt-repo-line: "deb [arch=${{ matrix.arch }}] https://regolith-desktop.org/${{ matrix.stage }}-${{ matrix.distro }}-${{ matrix.codename }}-${{ matrix.arch }} ${{ matrix.codename }} main" + apt-key-url: http://archive.regolith-desktop.com/regolith.key + apt-repo-line: "deb [arch=${{ matrix.arch }}] http://archive.regolith-desktop.com/${{ env.distro }}/${{ fromJSON(needs.matrix-builder.outputs.suites)[matrix.stage]['suite'] }} ${{ env.codename }} ${{ fromJSON(needs.matrix-builder.outputs.suites)[matrix.stage]['component'] }}" target-package: "regolith-desktop ${{ matrix.wm }}" - test-ubuntu-jammy-install: - runs-on: ${{ matrix.host-os }} + ubuntu-focal: + runs-on: [self-hosted, Linux, "${{ fromJSON(needs.matrix-builder.outputs.runners)[matrix.arch] }}", focal] + needs: matrix-builder + if: | + (inputs.legacy == 'yes') && + ( + (inputs.distro == '' && inputs.codename == '') || + (inputs.distro == 'ubuntu' && inputs.codename == '') || + (inputs.distro == '' && inputs.codename == 'focal') || + (inputs.distro == 'ubuntu' && inputs.codename == 'focal') + ) strategy: + fail-fast: false matrix: - stage: [unstable, testing, release-3_0, release-3_1, release-3_2] - distro-codename: [ubuntu-jammy] - arch: [amd64, arm64] + stage: ${{ fromJSON(needs.matrix-builder.outputs.stages)['ubuntu-focal'] }} + arch: ${{ fromJson(needs.matrix-builder.outputs.arches) }} + wm: [regolith-session-flashback, regolith-session-sway] + env: + distro: ubuntu + codename: focal + steps: + - name: Install ${{ matrix.wm }} ${{ matrix.stage }} on ${{ env.distro }} ${{ env.codename }} + uses: regolith-linux/actions/test-desktop/ubuntu/focal@main + with: + apt-key-url: http://archive.regolith-desktop.com/regolith.key + apt-repo-line: "deb [arch=${{ matrix.arch }}] http://archive.regolith-desktop.com/${{ env.distro }}/${{ fromJSON(needs.matrix-builder.outputs.suites)[matrix.stage]['suite'] }} ${{ env.codename }} ${{ fromJSON(needs.matrix-builder.outputs.suites)[matrix.stage]['component'] }}" + target-package: "regolith-desktop ${{ matrix.wm }}" + + ubuntu-jammy: + runs-on: [self-hosted, Linux, "${{ fromJSON(needs.matrix-builder.outputs.runners)[matrix.arch] }}", jammy] + needs: matrix-builder + if: | + (inputs.distro == '' && inputs.codename == '') || + (inputs.distro == 'ubuntu' && inputs.codename == '') || + (inputs.distro == '' && inputs.codename == 'jammy') || + (inputs.distro == 'ubuntu' && inputs.codename == 'jammy') + strategy: + fail-fast: false + matrix: + stage: ${{ fromJSON(needs.matrix-builder.outputs.stages)['ubuntu-jammy'] }} + arch: ${{ fromJson(needs.matrix-builder.outputs.arches) }} wm: [regolith-session-flashback, regolith-session-sway] - include: - - arch: amd64 - host-os: ubuntu-22.04 - - arch: arm64 - host-os: [self-hosted, Linux, ARM64, jammy] - - distro-codename: ubuntu-jammy - distro: ubuntu - codename: jammy exclude: - stage: release-3_0 wm: regolith-session-sway + env: + distro: ubuntu + codename: jammy steps: - - name: Test ${{ matrix.stage }} ${{ matrix.distro-codename }} ${{ matrix.arch }} - uses: regolith-linux/test-desktop-installable-action/ubuntu/jammy@a46d23d5752c3bd45e1c692f908975e4a63c8e26 + - name: Install ${{ matrix.wm }} ${{ matrix.stage }} on ${{ env.distro }} ${{ env.codename }} + uses: regolith-linux/actions/test-desktop/ubuntu/jammy@main with: - apt-key-url: http://regolith-desktop.org/regolith3.key - apt-repo-line: "deb [arch=${{ matrix.arch }}] https://regolith-desktop.org/${{ matrix.stage }}-${{ matrix.distro }}-${{ matrix.codename }}-${{ matrix.arch }} ${{ matrix.codename }} main" + apt-key-url: http://archive.regolith-desktop.com/regolith.key + apt-repo-line: "deb [arch=${{ matrix.arch }}] http://archive.regolith-desktop.com/${{ env.distro }}/${{ fromJSON(needs.matrix-builder.outputs.suites)[matrix.stage]['suite'] }} ${{ env.codename }} ${{ fromJSON(needs.matrix-builder.outputs.suites)[matrix.stage]['component'] }}" target-package: "regolith-desktop ${{ matrix.wm }}" - test-ubuntu-noble-install: - runs-on: ${{ matrix.host-os }} + ubuntu-lunar: + runs-on: [self-hosted, Linux, "${{ fromJSON(needs.matrix-builder.outputs.runners)[matrix.arch] }}", lunar] + needs: matrix-builder + if: | + (inputs.legacy == 'yes') && + ( + (inputs.distro == '' && inputs.codename == '') || + (inputs.distro == 'ubuntu' && inputs.codename == '') || + (inputs.distro == '' && inputs.codename == 'lunar') || + (inputs.distro == 'ubuntu' && inputs.codename == 'lunar') + ) strategy: + fail-fast: false matrix: - stage: [unstable, testing, release-3_2] - distro-codename: [ubuntu-noble] - arch: [amd64, arm64] + stage: ${{ fromJSON(needs.matrix-builder.outputs.stages)['ubuntu-lunar'] }} + arch: ${{ fromJson(needs.matrix-builder.outputs.arches) }} wm: [regolith-session-flashback, regolith-session-sway] - include: - - arch: amd64 - host-os: [self-hosted, Linux, X64, noble] - - arch: arm64 - host-os: [self-hosted, Linux, ARM64, noble] - - distro-codename: ubuntu-noble - distro: ubuntu - codename: noble + env: + distro: ubuntu + codename: lunar steps: - - name: Test ${{ matrix.stage }} ${{ matrix.distro-codename }} ${{ matrix.arch }} - uses: regolith-linux/test-desktop-installable-action/ubuntu/noble@a46d23d5752c3bd45e1c692f908975e4a63c8e26 + - name: Install ${{ matrix.wm }} ${{ matrix.stage }} on ${{ env.distro }} ${{ env.codename }} + uses: regolith-linux/actions/test-desktop/ubuntu/lunar@main with: - apt-key-url: http://regolith-desktop.org/regolith3.key - apt-repo-line: "deb [arch=${{ matrix.arch }}] https://regolith-desktop.org/${{ matrix.stage }}-${{ matrix.distro }}-${{ matrix.codename }}-${{ matrix.arch }} ${{ matrix.codename }} main" + apt-key-url: http://archive.regolith-desktop.com/regolith.key + apt-repo-line: "deb [arch=${{ matrix.arch }}] http://archive.regolith-desktop.com/${{ env.distro }}/${{ fromJSON(needs.matrix-builder.outputs.suites)[matrix.stage]['suite'] }} ${{ env.codename }} ${{ fromJSON(needs.matrix-builder.outputs.suites)[matrix.stage]['component'] }}" target-package: "regolith-desktop ${{ matrix.wm }}" - test-ubuntu-oracular-install: - runs-on: ${{ matrix.host-os }} + ubuntu-mantic: + runs-on: [self-hosted, Linux, "${{ fromJSON(needs.matrix-builder.outputs.runners)[matrix.arch] }}", mantic] + needs: matrix-builder + if: | + (inputs.legacy == 'yes') && + ( + (inputs.distro == '' && inputs.codename == '') || + (inputs.distro == 'ubuntu' && inputs.codename == '') || + (inputs.distro == '' && inputs.codename == 'mantic') || + (inputs.distro == 'ubuntu' && inputs.codename == 'mantic') + ) strategy: + fail-fast: false matrix: - stage: [unstable, testing] #, release-3_2] - distro-codename: [ubuntu-oracular] - arch: [amd64, arm64] + stage: ${{ fromJSON(needs.matrix-builder.outputs.stages)['ubuntu-mantic'] }} + arch: ${{ fromJson(needs.matrix-builder.outputs.arches) }} wm: [regolith-session-flashback, regolith-session-sway] - include: - - arch: amd64 - host-os: [self-hosted, Linux, X64, oracular] - - arch: arm64 - host-os: [self-hosted, Linux, ARM64, oracular] - - distro-codename: ubuntu-oracular - distro: ubuntu - codename: oracular + env: + distro: ubuntu + codename: mantic steps: - - name: Test ${{ matrix.stage }} ${{ matrix.distro-codename }} ${{ matrix.arch }} - uses: regolith-linux/test-desktop-installable-action/ubuntu/oracular@bbc152ea6a55737affa65cbf77e5ff69bee844e4 + - name: Install ${{ matrix.wm }} ${{ matrix.stage }} on ${{ env.distro }} ${{ env.codename }} + uses: regolith-linux/actions/test-desktop/ubuntu/mantic@main with: - apt-key-url: http://regolith-desktop.org/regolith3.key - apt-repo-line: "deb [arch=${{ matrix.arch }}] https://regolith-desktop.org/${{ matrix.stage }}-${{ matrix.distro }}-${{ matrix.codename }}-${{ matrix.arch }} ${{ matrix.codename }} main" + apt-key-url: http://archive.regolith-desktop.com/regolith.key + apt-repo-line: "deb [arch=${{ matrix.arch }}] http://archive.regolith-desktop.com/${{ env.distro }}/${{ fromJSON(needs.matrix-builder.outputs.suites)[matrix.stage]['suite'] }} ${{ env.codename }} ${{ fromJSON(needs.matrix-builder.outputs.suites)[matrix.stage]['component'] }}" target-package: "regolith-desktop ${{ matrix.wm }}" + + ubuntu-noble: + runs-on: [self-hosted, Linux, "${{ fromJSON(needs.matrix-builder.outputs.runners)[matrix.arch] }}", noble] + needs: matrix-builder + if: | + (inputs.distro == '' && inputs.codename == '') || + (inputs.distro == 'ubuntu' && inputs.codename == '') || + (inputs.distro == '' && inputs.codename == 'noble') || + (inputs.distro == 'ubuntu' && inputs.codename == 'noble') + strategy: + fail-fast: false + matrix: + stage: ${{ fromJSON(needs.matrix-builder.outputs.stages)['ubuntu-noble'] }} + arch: ${{ fromJson(needs.matrix-builder.outputs.arches) }} + wm: [regolith-session-flashback, regolith-session-sway] + env: + distro: ubuntu + codename: noble + steps: + - name: Install ${{ matrix.wm }} ${{ matrix.stage }} on ${{ env.distro }} ${{ env.codename }} + uses: regolith-linux/actions/test-desktop/ubuntu/noble@main + with: + apt-key-url: http://archive.regolith-desktop.com/regolith.key + apt-repo-line: "deb [arch=${{ matrix.arch }}] http://archive.regolith-desktop.com/${{ env.distro }}/${{ fromJSON(needs.matrix-builder.outputs.suites)[matrix.stage]['suite'] }} ${{ env.codename }} ${{ fromJSON(needs.matrix-builder.outputs.suites)[matrix.stage]['component'] }}" + target-package: "regolith-desktop ${{ matrix.wm }}" + + ubuntu-oracular: + runs-on: [self-hosted, Linux, "${{ fromJSON(needs.matrix-builder.outputs.runners)[matrix.arch] }}", oracular] + needs: matrix-builder + if: | + (inputs.distro == '' && inputs.codename == '') || + (inputs.distro == 'ubuntu' && inputs.codename == '') || + (inputs.distro == '' && inputs.codename == 'oracular') || + (inputs.distro == 'ubuntu' && inputs.codename == 'oracular') + strategy: + fail-fast: false + matrix: + stage: ${{ fromJSON(needs.matrix-builder.outputs.stages)['ubuntu-oracular'] }} + arch: ${{ fromJson(needs.matrix-builder.outputs.arches) }} + wm: [regolith-session-flashback, regolith-session-sway] + env: + distro: ubuntu + codename: oracular + steps: + - name: Install ${{ matrix.wm }} ${{ matrix.stage }} on ${{ env.distro }} ${{ env.codename }} + uses: regolith-linux/actions/test-desktop/ubuntu/oracular@main + with: + apt-key-url: http://archive.regolith-desktop.com/regolith.key + apt-repo-line: "deb [arch=${{ matrix.arch }}] http://archive.regolith-desktop.com/${{ env.distro }}/${{ fromJSON(needs.matrix-builder.outputs.suites)[matrix.stage]['suite'] }} ${{ env.codename }} ${{ fromJSON(needs.matrix-builder.outputs.suites)[matrix.stage]['component'] }}" + target-package: "regolith-desktop ${{ matrix.wm }}" \ No newline at end of file diff --git a/.github/workflows/test-pkg-build.yml b/.github/workflows/test-pkg-build.yml index a2ad36a2..f4f9dc50 100644 --- a/.github/workflows/test-pkg-build.yml +++ b/.github/workflows/test-pkg-build.yml @@ -16,9 +16,23 @@ on: package-ref: description: 'Package Ref (branch, tag, or hash)' required: true + distro: + description: 'Package Distro' + required: true + options: + - debian + - ubuntu codename: - description: 'Package Codename (focal, bullseye)' + description: 'Package Codename (e.g. focal, bullseye)' + required: true + stage: + description: 'Package Stage' required: true + options: + - experimental + - unstable + - testing + - stable build-os-image: description: 'Build package on (ubuntu-22.04)' required: true @@ -26,33 +40,31 @@ on: jobs: build: - runs-on: ${{ github.event.inputs.build-os-image }} + runs-on: ${{ inputs.build-os-image }} steps: - uses: actions/checkout@v4 - - name: Env Setup - id: init + - name: Environment Setup run: | sudo apt update - sudo apt install -y devscripts reprepro + sudo apt install -y devscripts + mkdir -p ~/.gnupg/ printf "${{ secrets.PACKAGE_PRIVATE_KEY2 }}" | base64 --decode > ~/.gnupg/private.key gpg --batch --import ~/.gnupg/private.key - - name: Build Test Package - id: build + + - name: Build ${{ inputs.package-name }} @ ${{ inputs.package-ref }} for ${{ inputs.distro }}-${{ inputs.codename }} (${{ inputs.stage }}) run: | set -x + export DEBEMAIL=regolith.linux@gmail.com export DEBFULLNAME="Regolith Linux" - extension=${{ github.workspace }}/.github/scripts/${{ github.event.inputs.extension }} - package_name=${{ github.event.inputs.package-name }} - package_url=${{ github.event.inputs.package-url }} - package_ref=${{ github.event.inputs.package-ref }} - codename=${{ github.event.inputs.codename }} ${{ github.workspace }}/.github/scripts/local-build.sh \ - ${{ github.workspace }} \ - $extension \ - $package_name \ - $package_url \ - $package_ref \ - $codename + --extension ${{ github.workspace }}/.github/scripts/${{ inputs.extension }} \ + --git-repo-path "${{ github.workspace }}" \ + --package-name ${{ inputs.package-name }} \ + --package-url "${{ inputs.package-url }}" \ + --package-ref "${{ inputs.package-ref }}" \ + --distro "${{ inputs.distro }}" \ + --codename "${{ inputs.codename }}" \ + --stage "${{ inputs.stage }}" diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5f16bddf..ee8fc2ff 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -110,8 +110,15 @@ occurs in automation. This can be used to test packages build before committing to git or debug problems with packages or the build system. Example: ```console -cd .github/scripts -./local-build.sh ../.. ext-debian.sh regolith-i3status-rust https://github.com/regolith-linux/regolith-i3status-rust.git debian_source focal +$ .github/scripts/local-build.sh \ + --git-repo-path . \ + --extension .github/scripts/ext-debian.sh \ + --package-name regolith-i3status-rust \ + --package-url https://github.com/regolith-linux/regolith-i3status-rust.git \ + --package-ref debian_source \ + --distro ubuntu \ + --codename focal \ + --stage unstable ``` [Debian releases]: https://www.debian.org/releases/ diff --git a/docs/testing.md b/docs/testing.md index 0e1afd1e..668f5845 100644 --- a/docs/testing.md +++ b/docs/testing.md @@ -5,11 +5,35 @@ To test the debian package checking and building, run the script: Check Example: ```console -.github/scripts/main.sh . unstable ubuntu focal amd64 someurl Default check +$ .github/scripts/main.sh \ + check \ + --git-repo-path . \ + --extension .github/scripts/ext-debian.sh \ + --manifest-path /path/to/dir/manifests \ + --pkg-build-path /path/to/dir/packages \ + --pkg-publish-path /path/to/dir/publish \ + --distro ubuntu \ + --codename focal \ + --arch amd64 \ + --stage unstable \ + --suite unstable \ + --component main ``` Build Example: ```console -.github/scripts/main.sh . unstable ubuntu focal amd64 someurl Default build -``` \ No newline at end of file +$ .github/scripts/main.sh \ + build \ + --git-repo-path . \ + --extension .github/scripts/ext-debian.sh \ + --manifest-path /path/to/dir/manifests \ + --pkg-build-path /path/to/dir/packages \ + --pkg-publish-path /path/to/dir/publish \ + --distro ubuntu \ + --codename focal \ + --arch amd64 \ + --stage unstable \ + --suite unstable \ + --component main +```