Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autobuild: Derive all step commands from a base_command + multiple minor fixes #2540

Merged
merged 14 commits into from
Mar 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .github/actions_scripts/analyse_git_reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def write_changelog(version):
f.write(changelog)


def get_release_version_name(jamulus_pro_version):
def get_build_version(jamulus_pro_version):
if "dev" in jamulus_pro_version:
name = "{}-{}".format(jamulus_pro_version, get_git_hash())
print("building an intermediate version: ", name)
Expand All @@ -61,14 +61,14 @@ def set_github_variable(varname, varval):

jamulus_pro_version = get_version_from_jamulus_pro()
write_changelog(jamulus_pro_version)
release_version_name = get_release_version_name(jamulus_pro_version)
build_version = get_build_version(jamulus_pro_version)

fullref = os.environ['GITHUB_REF']
publish_to_release = bool(re.match(r'^refs/tags/r\d+_\d+_\d+\S*$', fullref))

# RELEASE_VERSION_NAME is required for all builds including branch pushes
# BUILD_VERSION is required for all builds including branch pushes
# and PRs:
set_github_variable("RELEASE_VERSION_NAME", release_version_name)
set_github_variable("BUILD_VERSION", build_version)

# PUBLISH_TO_RELEASE is always required as the workflow decides about further
# steps based on this. It will only be true for tag pushes with a tag
Expand All @@ -78,10 +78,10 @@ def set_github_variable(varname, varval):
if publish_to_release:
reflist = fullref.split("/", 2)
release_tag = reflist[2]
release_title = f"Release {release_version_name} ({release_tag})"
release_title = f"Release {build_version} ({release_tag})"
is_prerelease = not re.match(r'^r\d+_\d+_\d+$', release_tag)
if not is_prerelease and release_version_name != release_tag[1:].replace('_', '.'):
raise Exception(f"non-pre-release tag {release_tag} doesn't match Jamulus.pro VERSION = {release_version_name}")
if not is_prerelease and build_version != release_tag[1:].replace('_', '.'):
raise Exception(f"non-pre-release tag {release_tag} doesn't match Jamulus.pro VERSION = {build_version}")

# Those variables are only used when a release is created at all:
set_github_variable("IS_PRERELEASE", str(is_prerelease).lower())
Expand Down
16 changes: 8 additions & 8 deletions .github/autobuild/android.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ export JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64/"
export PATH="${PATH}:${ANDROID_SDK_ROOT}/tools"
export PATH="${PATH}:${ANDROID_SDK_ROOT}/platform-tools"

if [[ ! ${jamulus_buildversionstring:-} =~ [0-9]+\.[0-9]+\.[0-9]+ ]]; then
echo "Environment variable jamulus_buildversionstring has to be set to a valid version string"
if [[ ! ${JAMULUS_BUILD_VERSION:-} =~ [0-9]+\.[0-9]+\.[0-9]+ ]]; then
echo "Environment variable JAMULUS_BUILD_VERSION has to be set to a valid version string"
exit 1
fi

Expand Down Expand Up @@ -75,8 +75,8 @@ setup_qt() {
}

build_app_as_apk() {
QT_DIR="${QT_BASEDIR}/${QT_VERSION}/android"
MAKE="${ANDROID_NDK_ROOT}/prebuilt/${ANDROID_NDK_HOST}/bin/make"
local QT_DIR="${QT_BASEDIR}/${QT_VERSION}/android"
local MAKE="${ANDROID_NDK_ROOT}/prebuilt/${ANDROID_NDK_HOST}/bin/make"

"${QT_DIR}/bin/qmake" -spec android-clang
"${MAKE}" -j "$(nproc)"
Expand All @@ -87,10 +87,10 @@ build_app_as_apk() {

pass_artifact_to_job() {
mkdir deploy
artifact_deploy_filename="jamulus_${jamulus_buildversionstring}_android.apk"
echo "Moving ${BUILD_DIR}/build/outputs/apk/debug/build-debug.apk to deploy/${artifact_deploy_filename}"
mv "./${BUILD_DIR}/build/outputs/apk/debug/build-debug.apk" "./deploy/${artifact_deploy_filename}"
echo "::set-output name=artifact_1::${artifact_deploy_filename}"
local artifact="jamulus_${JAMULUS_BUILD_VERSION}_android.apk"
echo "Moving ${BUILD_DIR}/build/outputs/apk/debug/build-debug.apk to deploy/${artifact}"
mv "./${BUILD_DIR}/build/outputs/apk/debug/build-debug.apk" "./deploy/${artifact}"
echo "::set-output name=artifact_1::${artifact}"
}

case "${1:-}" in
Expand Down
14 changes: 7 additions & 7 deletions .github/autobuild/ios.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ if [[ ! ${QT_VERSION:-} =~ [0-9]+\.[0-9]+\..* ]]; then
echo "Environment variable QT_VERSION must be set to a valid Qt version"
exit 1
fi
if [[ ! ${jamulus_buildversionstring:-} =~ [0-9]+\.[0-9]+\.[0-9]+ ]]; then
echo "Environment variable jamulus_buildversionstring has to be set to a valid version string"
if [[ ! ${JAMULUS_BUILD_VERSION:-} =~ [0-9]+\.[0-9]+\.[0-9]+ ]]; then
echo "Environment variable JAMULUS_BUILD_VERSION has to be set to a valid version string"
exit 1
fi

setup() {
if [[ -d "${QT_DIR}" ]]; then
echo "Using Qt installation from previous run (actions/cache)"
else
echo "Install dependencies..."
echo "Installing Qt"
python3 -m pip install "aqtinstall==${AQTINSTALL_VERSION}"
python3 -m aqt install-qt --outputdir "${QT_DIR}" mac ios "${QT_VERSION}" --archives qtbase qttools qttranslations qtmacextras
fi
Expand All @@ -30,10 +30,10 @@ build_app_as_ipa() {
}

pass_artifact_to_job() {
artifact_deploy_filename="jamulus_${jamulus_buildversionstring}_iOSUnsigned${ARTIFACT_SUFFIX:-1}.ipa"
echo "Moving build artifact to deploy/${artifact_deploy_filename}"
mv ./deploy/Jamulus.ipa "./deploy/${artifact_deploy_filename}"
echo "::set-output name=artifact_1::${artifact_deploy_filename}"
local artifact="jamulus_${JAMULUS_BUILD_VERSION}_iOSUnsigned${ARTIFACT_SUFFIX:-1}.ipa"
echo "Moving build artifact to deploy/${artifact}"
mv ./deploy/Jamulus.ipa "./deploy/${artifact}"
echo "::set-output name=artifact_1::${artifact}"
}

case "${1:-}" in
Expand Down
28 changes: 14 additions & 14 deletions .github/autobuild/linux_deb.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/bash
set -eu

if [[ ! ${jamulus_buildversionstring:-} =~ [0-9]+\.[0-9]+\.[0-9]+ ]]; then
echo "Environment variable jamulus_buildversionstring has to be set to a valid version string"
if [[ ! ${JAMULUS_BUILD_VERSION:-} =~ [0-9]+\.[0-9]+\.[0-9]+ ]]; then
echo "Environment variable JAMULUS_BUILD_VERSION has to be set to a valid version string"
exit 1
fi

Expand All @@ -20,12 +20,12 @@ case "${TARGET_ARCH}" in
esac

setup() {
export DEBIAN_FRONTEND="noninteractive"

setup_cross_compilation_apt_sources

echo "Update system..."
echo "Installing dependencies..."
sudo apt-get -qq update

echo "Install dependencies..."
sudo apt-get -qq --no-install-recommends -y install devscripts build-essential debhelper fakeroot libjack-jackd2-dev qtbase5-dev qttools5-dev-tools

setup_cross_compiler
Expand All @@ -44,7 +44,7 @@ setup_cross_compiler() {
if [[ "${TARGET_ARCH}" == amd64 ]]; then
return
fi
GCC_VERSION=7 # 7 is the default on 18.04, there is no reason not to update once 18.04 is out of support
local GCC_VERSION=7 # 7 is the default on 18.04, there is no reason not to update once 18.04 is out of support
sudo apt install -qq -y --no-install-recommends "g++-${GCC_VERSION}-${ABI_NAME}" "qt5-qmake:${TARGET_ARCH}" "qtbase5-dev:${TARGET_ARCH}" "libjack-jackd2-dev:${TARGET_ARCH}"
sudo update-alternatives --install "/usr/bin/${ABI_NAME}-g++" g++ "/usr/bin/${ABI_NAME}-g++-${GCC_VERSION}" 10
sudo update-alternatives --install "/usr/bin/${ABI_NAME}-gcc" gcc "/usr/bin/${ABI_NAME}-gcc-${GCC_VERSION}" 10
Expand All @@ -64,15 +64,15 @@ pass_artifacts_to_job() {
mkdir deploy

# rename headless first, so wildcard pattern matches only one file each
artifact_deploy_filename_1="jamulus_headless_${jamulus_buildversionstring}_ubuntu_${TARGET_ARCH}.deb"
echo "Moving headless build artifact to deploy/${artifact_deploy_filename_1}"
mv ../jamulus-headless*"_${TARGET_ARCH}.deb" "./deploy/${artifact_deploy_filename_1}"
echo "::set-output name=artifact_1::${artifact_deploy_filename_1}"
local artifact_1="jamulus_headless_${JAMULUS_BUILD_VERSION}_ubuntu_${TARGET_ARCH}.deb"
echo "Moving headless build artifact to deploy/${artifact_1}"
mv ../jamulus-headless*"_${TARGET_ARCH}.deb" "./deploy/${artifact_1}"
echo "::set-output name=artifact_1::${artifact_1}"

artifact_deploy_filename_2="jamulus_${jamulus_buildversionstring}_ubuntu_${TARGET_ARCH}.deb"
echo "Moving regular build artifact to deploy/${artifact_deploy_filename_2}"
mv ../jamulus*_"${TARGET_ARCH}.deb" "./deploy/${artifact_deploy_filename_2}"
echo "::set-output name=artifact_2::${artifact_deploy_filename_2}"
local artifact_2="jamulus_${JAMULUS_BUILD_VERSION}_ubuntu_${TARGET_ARCH}.deb"
echo "Moving regular build artifact to deploy/${artifact_2}"
mv ../jamulus*_"${TARGET_ARCH}.deb" "./deploy/${artifact_2}"
echo "::set-output name=artifact_2::${artifact_2}"
}

case "${1:-}" in
Expand Down
23 changes: 11 additions & 12 deletions .github/autobuild/mac.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,19 @@ if [[ ! ${QT_VERSION:-} =~ [0-9]+\.[0-9]+\..* ]]; then
echo "Environment variable QT_VERSION must be set to a valid Qt version"
exit 1
fi
if [[ ! ${jamulus_buildversionstring:-} =~ [0-9]+\.[0-9]+\.[0-9]+ ]]; then
echo "Environment variable jamulus_buildversionstring has to be set to a valid version string"
if [[ ! ${JAMULUS_BUILD_VERSION:-} =~ [0-9]+\.[0-9]+\.[0-9]+ ]]; then
echo "Environment variable JAMULUS_BUILD_VERSION has to be set to a valid version string"
exit 1
fi

setup() {
if [[ -d "${QT_DIR}" ]]; then
echo "Using Qt installation from previous run (actions/cache)"
else
echo "Install dependencies..."
echo "Installing Qt..."
python3 -m pip install "aqtinstall==${AQTINSTALL_VERSION}"
python3 -m aqt install-qt --outputdir "${QT_DIR}" mac desktop "${QT_VERSION}" --archives qtbase qttools qttranslations qtmacextras
fi

# Add the qt binaries to the PATH.
# The clang_64 entry can be dropped when Qt <6.2 compatibility is no longer needed.
export PATH="${QT_DIR}/${QT_VERSION}/macos/bin:${QT_DIR}/${QT_VERSION}/clang_64/bin:${PATH}"
echo "::set-env name=PATH::${PATH}"
}

prepare_signing() {
Expand Down Expand Up @@ -56,6 +51,10 @@ prepare_signing() {
}

build_app_as_dmg_installer() {
# Add the qt binaries to the PATH.
# The clang_64 entry can be dropped when Qt <6.2 compatibility is no longer needed.
export PATH="${QT_DIR}/${QT_VERSION}/macos/bin:${QT_DIR}/${QT_VERSION}/clang_64/bin:${PATH}"

# Mac's bash version considers BUILD_ARGS unset without at least one entry:
BUILD_ARGS=("")
if prepare_signing; then
Expand All @@ -65,10 +64,10 @@ build_app_as_dmg_installer() {
}

pass_artifact_to_job() {
artifact_deploy_filename="jamulus_${jamulus_buildversionstring}_mac${ARTIFACT_SUFFIX:-}.dmg"
echo "Moving build artifact to deploy/${artifact_deploy_filename}"
mv ./deploy/Jamulus-*installer-mac.dmg "./deploy/${artifact_deploy_filename}"
echo "::set-output name=artifact_1::${artifact_deploy_filename}"
artifact="jamulus_${JAMULUS_BUILD_VERSION}_mac${ARTIFACT_SUFFIX:-}.dmg"
echo "Moving build artifact to deploy/${artifact}"
mv ./deploy/Jamulus-*installer-mac.dmg "./deploy/${artifact}"
echo "::set-output name=artifact_1::${artifact}"
}

case "${1:-}" in
Expand Down
18 changes: 9 additions & 9 deletions .github/autobuild/windows.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ $Msvc32Version = "win32_msvc2019"
$Msvc64Version = "win64_msvc2019_64"
$JomVersion = "1.1.2"

$JamulusVersion = $Env:jamulus_buildversionstring
$JamulusVersion = $Env:JAMULUS_BUILD_VERSION
if ( $JamulusVersion -notmatch '^\d+\.\d+\.\d+.*' )
{
throw "Environment variable jamulus_buildversionstring has to be set to a valid version string"
throw "Environment variable JAMULUS_BUILD_VERSION has to be set to a valid version string"
}

Function Install-Qt
Expand Down Expand Up @@ -116,7 +116,7 @@ Function Build-App-With-Installer
{
$ExtraArgs += ("-BuildOption", $BuildOption)
}
powershell ".\windows\deploy_windows.ps1" "C:\Qt\5.15.2" "C:\Qt\5.15.2" @ExtraArgs
powershell ".\windows\deploy_windows.ps1" "C:\Qt\${Qt32Version}" "C:\Qt\${Qt64Version}" @ExtraArgs
if ( !$? )
{
throw "deploy_windows.ps1 failed with exit code $LastExitCode"
Expand All @@ -133,16 +133,16 @@ Function Pass-Artifact-to-Job
default { "" }
}

$artifact_deploy_filename = "jamulus_${JamulusVersion}_win${ArtifactSuffix}.exe"
$artifact = "jamulus_${JamulusVersion}_win${ArtifactSuffix}.exe"

echo "Copying artifact to ${artifact_deploy_filename}"
cp ".\deploy\Jamulus*installer-win.exe" ".\deploy\${artifact_deploy_filename}"
echo "Copying artifact to ${artifact}"
move ".\deploy\Jamulus*installer-win.exe" ".\deploy\${artifact}"
if ( !$? )
{
throw "cp failed with exit code $LastExitCode"
throw "move failed with exit code $LastExitCode"
}
echo "Setting Github step output name=artifact_1::${artifact_deploy_filename}"
echo "::set-output name=artifact_1::${artifact_deploy_filename}"
echo "Setting Github step output name=artifact_1::${artifact}"
echo "::set-output name=artifact_1::${artifact}"
}

switch ( $Stage )
Expand Down
Loading