From 1f7b01bd9e2485e73164e303201d87ad5d60059a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tam=C3=A1s=20B=C3=A1lint=20Misius?= Date: Mon, 24 Oct 2022 06:41:12 +0200 Subject: [PATCH] Disable update checks for AppImages --- .github/build.sh | 44 +++++++++++++++++++++--------- .github/prepare.py | 52 +++++++++++++++++++----------------- .github/workflows/build.yaml | 18 ++++++++----- 3 files changed, 71 insertions(+), 43 deletions(-) diff --git a/.github/build.sh b/.github/build.sh index 85a7e09eb..16d020c6c 100755 --- a/.github/build.sh +++ b/.github/build.sh @@ -39,24 +39,28 @@ if [[ -z ${MOD_ID-} ]]; then >&2 echo "MOD_ID not set" exit 1 fi -if [[ -z ${ASSET_PATH-} ]]; then - >&2 echo "ASSET_PATH not set" - exit 1 -fi if [[ -z ${SEPARATE_DEBUG-} ]]; then >&2 echo "SEPARATE_DEBUG not set" exit 1 fi +if [[ -z ${BUILD_PACKAGE-} ]]; then + >&2 echo "BUILD_PACKAGE not set" + exit 1 +fi +if [[ -z ${ASSET_PATH-} ]]; then + >&2 echo "ASSET_PATH not set" + exit 1 +fi if [[ -z ${DEBUG_ASSET_PATH-} ]]; then >&2 echo "DEBUG_ASSET_PATH not set" exit 1 fi -if [[ -z ${PACKAGE_APPIMAGE-} ]]; then - >&2 echo "PACKAGE_APPIMAGE not set" +if [[ -z ${PACKAGE_ASSET_PATH-} ]]; then + >&2 echo "PACKAGE_ASSET_PATH not set" exit 1 fi -if [[ -z ${APPIMAGE_ASSET_PATH-} ]]; then - >&2 echo "APPIMAGE_ASSET_PATH not set" +if [[ -z ${PACKAGE_DEBUG_ASSET_PATH-} ]]; then + >&2 echo "PACKAGE_DEBUG_ASSET_PATH not set" exit 1 fi @@ -340,8 +344,18 @@ if [[ $BSH_BUILD_PLATFORM == windows ]]; then else ninja -v fi + strip=strip objcopy=objcopy +function separate_debug() { + local binary=$1 + local debug=$2 + $objcopy --only-keep-debug $binary $debug + $strip --strip-debug --strip-unneeded $binary + $objcopy --add-gnu-debuglink $debug $binary + chmod -x $debug +} + strip_target=$ASSET_PATH if [[ $BSH_HOST_PLATFORM == android ]]; then strip=$ANDROID_NDK_LATEST_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-$strip @@ -349,9 +363,7 @@ if [[ $BSH_HOST_PLATFORM == android ]]; then strip_target=libpowder.so fi if [[ $SEPARATE_DEBUG == yes ]] && [[ $BSH_HOST_PLATFORM-$BSH_HOST_LIBC != windows-msvc ]]; then - $objcopy --only-keep-debug $strip_target $DEBUG_ASSET_PATH - $strip --strip-debug --strip-unneeded $strip_target - $objcopy --add-gnu-debuglink $DEBUG_ASSET_PATH $strip_target + separate_debug $strip_target $DEBUG_ASSET_PATH fi if [[ $BSH_HOST_PLATFORM == android ]]; then $JAVA_HOME_8_X64/bin/keytool -genkeypair -keystore keystore.jks -alias androidkey -validity 10000 -keyalg RSA -keysize 2048 -keypass bagelsbagels -storepass bagelsbagels -dname "CN=nobody" @@ -359,7 +371,13 @@ if [[ $BSH_HOST_PLATFORM == android ]]; then ANDROID_KEYSTORE_PASS=bagelsbagels ninja android/powder.apk mv android/powder.apk powder.apk fi -if [[ $PACKAGE_APPIMAGE == yes ]]; then +if [[ $BUILD_PACKAGE == yes ]]; then + # so far this can only happen with $BSH_HOST_PLATFORM-$BSH_HOST_LIBC == linux-gnu, but this may change later + meson configure -Dinstall_check=false -Dignore_updates=true -Dbuild_render=false -Dbuild_font=false + ninja -v + if [[ $SEPARATE_DEBUG == yes ]]; then + separate_debug $ASSET_PATH $PACKAGE_DEBUG_ASSET_PATH + fi cp resources/appdata.xml appdata.xml sed -i "s|SUBST_DATE|$(date --iso-8601)|g" appdata.xml sed -i "s|SUBST_SAVE_VERSION|$save_version|g" appdata.xml @@ -387,5 +405,5 @@ if [[ $PACKAGE_APPIMAGE == yes ]]; then cp ThePowderToy.AppDir/powder.png ThePowderToy.AppDir/usr/share/icons/powder.png cp ThePowderToy.AppDir/uk.co.powdertoy.tpt.desktop ThePowderToy.AppDir/usr/share/applications/uk.co.powdertoy.tpt.desktop ./appimagetool ThePowderToy.AppDir - [[ -f $APPIMAGE_ASSET_PATH ]] + [[ -f $PACKAGE_ASSET_PATH ]] fi diff --git a/.github/prepare.py b/.github/prepare.py index 172f085b0..e790d8609 100755 --- a/.github/prepare.py +++ b/.github/prepare.py @@ -45,25 +45,25 @@ with open('.github/mod_id.txt') as f: build_matrix = [] publish_matrix = [] # consider disabling line wrapping to edit this monstrosity -for bsh_host_arch, bsh_host_platform, bsh_host_libc, bsh_static_dynamic, bsh_build_platform, runs_on, package_suffix, publish, artifact, debug_suffix, starcatcher_suffix, package_appimage in [ - ( 'x86_64', 'linux', 'gnu', 'static', 'linux', 'ubuntu-18.04', '', True, True, '.dbg', 'x86_64-lin-gcc-static', True ), - ( 'x86_64', 'linux', 'gnu', 'dynamic', 'linux', 'ubuntu-18.04', '', False, False, None, '', False ), -# ( 'x86_64', 'windows', 'mingw', 'static', 'linux', 'ubuntu-20.04', '', False, True, '.dbg', '', False ), # ubuntu-20.04 doesn't have windows TLS headers somehow and I haven't yet figured out how to get them - ( 'x86_64', 'windows', 'mingw', 'dynamic', 'linux', 'ubuntu-20.04', '', False, False, None, '', False ), - ( 'x86_64', 'windows', 'mingw', 'static', 'windows', 'windows-2019', '.exe', False, True, '.dbg', '', False ), - ( 'x86_64', 'windows', 'mingw', 'dynamic', 'windows', 'windows-2019', '.exe', False, False, None, '', False ), - ( 'x86_64', 'windows', 'msvc', 'static', 'windows', 'windows-2019', '.exe', True, True, '.pdb', 'x86_64-win-msvc-static', False ), - ( 'x86_64', 'windows', 'msvc', 'dynamic', 'windows', 'windows-2019', '.exe', False, False, None, '', False ), - ( 'x86', 'windows', 'msvc', 'static', 'windows', 'windows-2019', '.exe', True, True, '.pdb', 'i686-win-msvc-static', False ), - ( 'x86', 'windows', 'msvc', 'dynamic', 'windows', 'windows-2019', '.exe', False, False, None, '', False ), - ( 'x86_64', 'darwin', 'macos', 'static', 'darwin', 'macos-11.0', '', True, True, None, 'x86_64-mac-gcc-static', False ), # I have no idea how to separate debug info on macos - ( 'x86_64', 'darwin', 'macos', 'dynamic', 'darwin', 'macos-11.0', '', False, False, None, '', False ), - ( 'aarch64', 'darwin', 'macos', 'static', 'darwin', 'macos-11.0', '', True, True, None, 'arm64-mac-gcc-static', False ), -# ( 'aarch64', 'darwin', 'macos', 'dynamic', 'darwin', 'macos-11.0', '', False, False, None, '', False ), # macos-11.0 is x86_64 and I haven't yet figured out how to get homebrew to install aarch64 libs on x86_64 - ( 'x86', 'android', 'bionic', 'static', 'linux', 'ubuntu-18.04', '.apk', True, True, '.dbg', 'i686-and-gcc-static', False ), - ( 'x86_64', 'android', 'bionic', 'static', 'linux', 'ubuntu-18.04', '.apk', True, True, '.dbg', 'x86_64-and-gcc-static', False ), - ( 'arm', 'android', 'bionic', 'static', 'linux', 'ubuntu-18.04', '.apk', True, True, '.dbg', 'arm-and-gcc-static', False ), - ( 'aarch64', 'android', 'bionic', 'static', 'linux', 'ubuntu-18.04', '.apk', True, True, '.dbg', 'arm64-and-gcc-static', False ), +for bsh_host_arch, bsh_host_platform, bsh_host_libc, bsh_static_dynamic, bsh_build_platform, runs_on, package_suffix, publish, artifact, debug_suffix, starcatcher_suffix, build_package in [ + ( 'x86_64', 'linux', 'gnu', 'static', 'linux', 'ubuntu-18.04', '', True, True, '.dbg', 'x86_64-lin-gcc-static', True ), + ( 'x86_64', 'linux', 'gnu', 'dynamic', 'linux', 'ubuntu-18.04', '', False, False, None, '', False ), +# ( 'x86_64', 'windows', 'mingw', 'static', 'linux', 'ubuntu-20.04', '', False, True, '.dbg', '', False ), # ubuntu-20.04 doesn't have windows TLS headers somehow and I haven't yet figured out how to get them + ( 'x86_64', 'windows', 'mingw', 'dynamic', 'linux', 'ubuntu-20.04', '', False, False, None, '', False ), + ( 'x86_64', 'windows', 'mingw', 'static', 'windows', 'windows-2019', '.exe', False, True, '.dbg', '', False ), + ( 'x86_64', 'windows', 'mingw', 'dynamic', 'windows', 'windows-2019', '.exe', False, False, None, '', False ), + ( 'x86_64', 'windows', 'msvc', 'static', 'windows', 'windows-2019', '.exe', True, True, '.pdb', 'x86_64-win-msvc-static', False ), + ( 'x86_64', 'windows', 'msvc', 'dynamic', 'windows', 'windows-2019', '.exe', False, False, None, '', False ), + ( 'x86', 'windows', 'msvc', 'static', 'windows', 'windows-2019', '.exe', True, True, '.pdb', 'i686-win-msvc-static', False ), + ( 'x86', 'windows', 'msvc', 'dynamic', 'windows', 'windows-2019', '.exe', False, False, None, '', False ), + ( 'x86_64', 'darwin', 'macos', 'static', 'darwin', 'macos-11.0', '', True, True, None, 'x86_64-mac-gcc-static', False ), # I have no idea how to separate debug info on macos + ( 'x86_64', 'darwin', 'macos', 'dynamic', 'darwin', 'macos-11.0', '', False, False, None, '', False ), + ( 'aarch64', 'darwin', 'macos', 'static', 'darwin', 'macos-11.0', '', True, True, None, 'arm64-mac-gcc-static', False ), +# ( 'aarch64', 'darwin', 'macos', 'dynamic', 'darwin', 'macos-11.0', '', False, False, None, '', False ), # macos-11.0 is x86_64 and I haven't yet figured out how to get homebrew to install aarch64 libs on x86_64 + ( 'x86', 'android', 'bionic', 'static', 'linux', 'ubuntu-18.04', '.apk', True, True, '.dbg', 'i686-and-gcc-static', False ), + ( 'x86_64', 'android', 'bionic', 'static', 'linux', 'ubuntu-18.04', '.apk', True, True, '.dbg', 'x86_64-and-gcc-static', False ), + ( 'arm', 'android', 'bionic', 'static', 'linux', 'ubuntu-18.04', '.apk', True, True, '.dbg', 'arm-and-gcc-static', False ), + ( 'aarch64', 'android', 'bionic', 'static', 'linux', 'ubuntu-18.04', '.apk', True, True, '.dbg', 'arm64-and-gcc-static', False ), ]: separate_debug = True if not debug_suffix: @@ -78,8 +78,10 @@ for bsh_host_arch, bsh_host_platform, bsh_host_libc, bsh_static_dynamic, bsh_bui asset_name = f'powder-{release_name}-{bsh_host_arch}-{bsh_host_platform}-{bsh_host_libc}{package_suffix}' debug_asset_path = f'powder{debug_suffix}' debug_asset_name = f'powder-{release_name}-{bsh_host_arch}-{bsh_host_platform}-{bsh_host_libc}{debug_suffix}' - appimage_asset_path = f'The_Powder_Toy-{bsh_host_arch}.AppImage' - appimage_asset_name = f'The_Powder_Toy-{bsh_host_arch}.AppImage' + package_asset_path = f'The_Powder_Toy-{bsh_host_arch}.AppImage' + package_asset_name = f'The_Powder_Toy-{bsh_host_arch}.AppImage' + package_debug_asset_path = f'The_Powder_Toy-{bsh_host_arch}.AppImage.dbg' + package_debug_asset_name = f'The_Powder_Toy-{bsh_host_arch}.AppImage.dbg' starcatcher_name = f'powder-{release_name}-{starcatcher_suffix}{package_suffix}' build_matrix.append({ 'bsh_build_platform': bsh_build_platform, # part of the unique portion of the matrix @@ -93,13 +95,15 @@ for bsh_host_arch, bsh_host_platform, bsh_host_libc, bsh_static_dynamic, bsh_bui 'publish': publish_release and 'yes' or 'no', 'artifact': artifact_release and 'yes' or 'no', 'separate_debug': separate_debug and 'yes' or 'no', - 'package_appimage': package_appimage and 'yes' or 'no', + 'build_package': build_package and 'yes' or 'no', 'asset_path': asset_path, 'asset_name': asset_name, 'debug_asset_path': debug_asset_path, 'debug_asset_name': debug_asset_name, - 'appimage_asset_path': appimage_asset_path, - 'appimage_asset_name': appimage_asset_name, + 'package_asset_path': package_asset_path, + 'package_asset_name': package_asset_name, + 'package_debug_asset_path': package_debug_asset_path, + 'package_debug_asset_name': package_debug_asset_name, }) if publish_release: publish_matrix.append({ diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index e9ad4bee7..9129abd85 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -77,11 +77,12 @@ jobs: RELEASE_NAME: ${{ needs.prepare.outputs.release_name }} RELEASE_TYPE: ${{ needs.prepare.outputs.release_type }} MOD_ID: ${{ needs.prepare.outputs.mod_id }} + SEPARATE_DEBUG: ${{ matrix.separate_debug }} + BUILD_PACKAGE: ${{ matrix.build_package }} ASSET_PATH: ${{ matrix.asset_path }} DEBUG_ASSET_PATH: ${{ matrix.debug_asset_path }} - SEPARATE_DEBUG: ${{ matrix.separate_debug }} - PACKAGE_APPIMAGE: ${{ matrix.package_appimage }} - APPIMAGE_ASSET_PATH: ${{ matrix.appimage_asset_path }} + PACKAGE_ASSET_PATH: ${{ matrix.package_asset_path }} + PACKAGE_DEBUG_ASSET_PATH: ${{ matrix.package_debug_asset_path }} - uses: LBPHacker/upload-release-asset@v2 # TODO-NTL: ship licenses if: needs.prepare.outputs.do_release == 'yes' && matrix.publish == 'yes' env: @@ -111,10 +112,15 @@ jobs: path: build/${{ matrix.debug_asset_path }} name: ${{ matrix.debug_asset_name }} - uses: actions/upload-artifact@v3 - if: matrix.artifact == 'yes' && matrix.package_appimage == 'yes' + if: matrix.artifact == 'yes' && matrix.build_package == 'yes' with: - path: build/${{ matrix.appimage_asset_path }} - name: ${{ matrix.appimage_asset_name }} + path: build/${{ matrix.package_asset_path }} + name: ${{ matrix.package_asset_name }} + - uses: actions/upload-artifact@v3 + if: matrix.artifact == 'yes' && matrix.build_package == 'yes' && matrix.separate_debug == 'yes' + with: + path: build/${{ matrix.package_debug_asset_path }} + name: ${{ matrix.package_debug_asset_name }} publish: runs-on: ubuntu-latest needs: [build, prepare]