Skip to content

Commit

Permalink
Disable update checks for AppImages
Browse files Browse the repository at this point in the history
  • Loading branch information
LBPHacker committed Oct 24, 2022
1 parent 5935473 commit 1f7b01b
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 43 deletions.
44 changes: 31 additions & 13 deletions .github/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -340,26 +344,40 @@ 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
objcopy=$ANDROID_NDK_LATEST_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-$objcopy
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"
meson configure -Dandroid_keystore=$(realpath keystore.jks)
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
Expand Down Expand Up @@ -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
52 changes: 28 additions & 24 deletions .github/prepare.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,25 +45,25 @@ def set_output(key, value):
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:
Expand All @@ -78,8 +78,10 @@ def set_output(key, value):
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
Expand All @@ -93,13 +95,15 @@ def set_output(key, value):
'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({
Expand Down
18 changes: 12 additions & 6 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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.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.appimage_asset_path }}
name: ${{ matrix.appimage_asset_name }}
path: build/${{ matrix.package_debug_asset_path }}
name: ${{ matrix.package_debug_asset_name }}
publish:
runs-on: ubuntu-latest
needs: [build, prepare]
Expand Down

0 comments on commit 1f7b01b

Please sign in to comment.