From: <fli...@li...> - 2025-07-17 19:26:32
|
unknown user pushed a commit to branch next in repository fgmeta. The following commit(s) were added to refs/heads/next by this push: new 72ac40f Forward port the installer naming changes 72ac40f is described below SF URL: http://sourceforge.net/p/flightgear/fgmeta/ci/72ac40f8c992cefc278b365b9e3e8a4a6a1e9427/ Commit: 72ac40f8c992cefc278b365b9e3e8a4a6a1e9427 Author: James Turner Committer: James Turner AuthorDate: Thu Jul 17 14:38:54 2025 +0100 Forward port the installer naming changes --- .gitlab-ci.yml | 99 ++++++++++++++++++-- .gitlab-image/Dockerfile | 4 + FlightGear.iss | 1 + build_appimage.sh | 40 +++++++- build_macos_dmg.rb | 36 +++++--- build_win_installers.bat | 3 - flightgear | 2 +- release_builder/create_point_release.sh | 159 ++++++++++++++++++++++++++++++++ release_builder/upload_installers.sh | 51 ++++++++++ 9 files changed, 366 insertions(+), 29 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 54cba53..26103c5 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -32,11 +32,35 @@ variables: HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1 HOMEBREW_NO_INSTALL_CLEANUP: 1 + BUILD_INSTALLERS: + value: "no" + options: + - "no" + - "yes" + description: "Should we build (and upload) installers." + + BUILD_BASE_PACKAGE: + value: "no" + options: + - "no" + - "yes" + description: "Should we build (and upload) the base package." + +# add extra 'upload' stage +stages: + - build + - test + - deploy + - upload + workflow: name: '$FG_PIPELINE_NAME' rules: - if: $CI_PROJECT_NAMESPACE != "flightgear" when: never + + # comment from James: thinking we should disable this in favour of building only + # when a tag is pushed to the release branch? - if: '$CI_COMMIT_REF_NAME =~ /release\/*/' variables: FG_IS_RELEASE: 1 @@ -48,6 +72,10 @@ workflow: FG_PIPELINE_NAME: "Nightly build of $CI_COMMIT_REF_NAME" - if: $CI_PIPELINE_SOURCE == 'merge_request_event' - if: $CI_COMMIT_TAG + variables: + FG_IS_RELEASE: 1 + FG_BUILD_TYPE: "Release" + FG_PIPELINE_NAME: "Release build of $CI_COMMIT_REF_NAME" - if: $CI_COMMIT_REF_PROTECTED == "true" linux-build: @@ -284,7 +312,6 @@ linux-appimage: ref: $OSG_REF artifacts: true script: - # ensure linuxDeploy can find the OSG libs - export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CI_PROJECT_DIR/osg-dist/lib @@ -293,12 +320,12 @@ linux-appimage: # create the appdir in $CI_PROJECT_DIR - cmake --install $FG_BUILD_DIR --component packaging --prefix $CI_PROJECT_DIR - - - ./build_appimage.sh + - source $FG_BUILD_DIR/exportFGVersion.sh + - ./build_appimage.sh --suffix "$FG_RELEASE_SUFFIX" artifacts: paths: - - FlightGear-*.AppImage + - flightgear-*.AppImage cache: key: "linux-x64-$CI_COMMIT_REF_SLUG" @@ -336,11 +363,12 @@ macos-package: - security unlock-keychain -p $FG_KEYCHAIN_PASSWORD $FG_KEYCHAIN script: - cmake --install $FG_BUILD_DIR --component packaging --prefix $CI_PROJECT_DIR - - ./build_macos_dmg.rb --dist $CI_PROJECT_DIR/dist --osg $CI_PROJECT_DIR/osg-dist + - source $FG_BUILD_DIR/exportFGVersion.sh + - ./build_macos_dmg.rb --dist $CI_PROJECT_DIR/dist --osg $CI_PROJECT_DIR/osg-dist --suffix "$FG_RELEASE_SUFFIX" artifacts: paths: - - 'output/*.dmg' + - flightgear-*.dmg cache: key: "macos-$CI_COMMIT_REF_SLUG" @@ -379,7 +407,7 @@ windows-installer: - .\build_win_installers.bat artifacts: paths: - - 'Output/*.exe' + - flightgear-*.exe cache: key: "win-vs2022-x64-$CI_COMMIT_REF_SLUG" @@ -401,6 +429,63 @@ rebuild_website: needs: - [linux-appimage,macos-package,windows-installer] +upload-binaries: + tags: + - saas-linux-large-amd64 + + image: registry.gitlab.com/flightgear/flightgear/stable-build + rules: + - if: $FG_IS_RELEASE && $CI_COMMIT_TAG + + stage: upload + needs: + - job: windows-installer + artifacts: true + - job: macos-package + artifacts: true + - job: linux-appimage + artifacts: true + + # setup the secure-files client + before_script: + - curl --silent "https://gitlab.com/gitlab-org/incubation-engineering/mobile-devops/download-secure-files/-/raw/main/installer" | bash + - eval "$(ssh-agent -s)" + - chmod 0600 $CI_PROJECT_DIR/.secure_files/fgfs_ci_id + - ssh-add $CI_PROJECT_DIR/.secure_files/fgfs_ci_id + + script: + - export WORKSPACE=$CI_PROJECT_DIR + - echo "$GLAB_TOKEN" | glab auth login --stdin --hostname gitlab.com + - ./release_builder/upload_installers.sh + +create-basepackage: + tags: + - saas-linux-large-amd64 + + image: registry.gitlab.com/flightgear/flightgear/stable-build + + rules: + - if: $BUILD_BASE_PACKAGE == "yes" + - if: $FG_IS_RELEASE && $CI_COMMIT_TAG + + # important that this is deploy stage, so it completes *before* upload runs + # this ensures the base package is uploaded and synced, before installers are available + stage: deploy + variables: + GIT_SUBMODULE_PATHS: fgdata + + # setup the secure-files client + before_script: + - curl --silent "https://gitlab.com/gitlab-org/incubation-engineering/mobile-devops/download-secure-files/-/raw/main/installer" | bash + - eval "$(ssh-agent -s)" + - chmod 0600 $CI_PROJECT_DIR/.secure_files/fgfs_ci_id + - ssh-add $CI_PROJECT_DIR/.secure_files/fgfs_ci_id + + script: + - export WORKSPACE=$CI_PROJECT_DIR + - ./release_builder/create_base_package.sh + + # Build and release new WS30 build tools docker image, if the relevant VERSION file has changed # - Pulls the image first to enable use of build cache # - This will build, tag and push images with two tags: diff --git a/.gitlab-image/Dockerfile b/.gitlab-image/Dockerfile index 23ffc00..e93e595 100644 --- a/.gitlab-image/Dockerfile +++ b/.gitlab-image/Dockerfile @@ -70,3 +70,7 @@ RUN cmake -B build-ares -S c-ares -G Ninja -D CMAKE_BUILD_TYPE=Release -D CMAKE_ && cmake --build build-ares \ && cmake --install build-ares \ && rm -rf build-ares + +# Add WakeMeOps repository +RUN curl -sSL "https://raw.githubusercontent.com/upciti/wakemeops/main/assets/install_repository" | bash \ + && apt install glab diff --git a/FlightGear.iss b/FlightGear.iss index d8eb615..01a55c2 100644 --- a/FlightGear.iss +++ b/FlightGear.iss @@ -84,6 +84,7 @@ UninstallDisplayIcon={app}\bin\fgfs.exe ArchitecturesInstallIn64BitMode=x64 ArchitecturesAllowed=x64 OutputBaseFilename={#FGOutputFilename} +OutputDir=. ; Sign tool must be defined in the Inno Setup GUI, to avoid ; exposing the certificate password diff --git a/build_appimage.sh b/build_appimage.sh index 8010628..fdf6845 100755 --- a/build_appimage.sh +++ b/build_appimage.sh @@ -12,6 +12,35 @@ # # errors/comments to en...@gm... +suffix="" + +usage(){ +>&2 cat << EOF +Usage: $0 + [ --suffix <filename-suffix> ] +EOF +exit 1 +} + +args=$(getopt -a -o h --long help,suffix: -- "$@") +if [[ $? -gt 0 ]]; then + usage +fi + +eval set -- ${args} +while : +do + case $1 in + -h | --help) usage ; shift ;; + --suffix) suffix="${2}" ; shift 2 ;; + # -- means the end of the arguments; drop this, and break out of the while loop + --) shift; break ;; + *) >&2 echo Unsupported option: $1 + usage ;; + esac +done + + #generate AppRun script cat << 'EOF' > appdir/AppRun @@ -78,7 +107,6 @@ else fi EOF - chmod +x appdir/AppRun appImageName=linuxdeploy-x86_64.AppImage @@ -88,7 +116,14 @@ wget -q https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/c chmod +x *.AppImage -export LINUXDEPLOY_OUTPUT_VERSION=`cat flightgear/flightgear-version` +export LINUXDEPLOY_OUTPUT_VERSION=$FG_VERSION +if [[ "$FG_BUILD_TYPE" == "Release" ]]; then + export LDAI_OUTPUT="flightgear-${LINUXDEPLOY_OUTPUT_VERSION}${suffix}-linux-amd64.AppImage" +elif [[ "$FG_BUILD_TYPE" == "Nightly" ]]; then + export LDAI_OUTPUT="flightgear-${FG_BUILD_DATE}-linux-amd64.AppImage" +else + export LDAI_OUTPUT="flightgear-${FG_GIT_SHA}-linux-amd64.AppImage" +fi # Add all executable binaries as additional binaries to AppImage and use special quoted array expansion ADDITIONAL_EXES=() @@ -104,4 +139,3 @@ export QML_SOURCES_PATHS=$PWD/flightgear/src/GUI/qml --desktop-file appdir/usr/share/applications/org.flightgear.FlightGear.desktop \ --icon-file appdir/usr/share/icons/flightgear.svg - diff --git a/build_macos_dmg.rb b/build_macos_dmg.rb index b750100..5b5933e 100755 --- a/build_macos_dmg.rb +++ b/build_macos_dmg.rb @@ -7,15 +7,17 @@ include FileUtils require 'optparse' -options = {:dist => Dir.pwd + "dist", :osg => Dir.pwd + "dist"} +options = {:dist => Dir.pwd + "dist", :osg => Dir.pwd + "dist", :file_suffix => ""} OptionParser.new do |opt| opt.on('--dist <distdir>') { |o| options[:dist] = o } opt.on('--osg <osgdist>') { |o| options[:osg] = o } + opt.on('--suffix <suffix>') { |o| options[:file_suffix] = o } end.parse! $prefixDir=options[:dist] $osgDir=options[:osg] +$releaseSuffix=options[:file_suffix] # from http://drawingablank.me/blog/ruby-boolean-typecasting.html class String @@ -34,11 +36,8 @@ $codeSignIdentity = ENV['FG_CODESIGN_IDENTITY'] $keychain = ENV['FG_KEYCHAIN'] $keychainProfile=ENV['FG_NOTARIZE_PROFILE'] -#puts "Code signing identity is #{$codeSignIdentity}" -#puts "Keychain is at #{$keychain}" - -$isRelease = ENV['FG_IS_RELEASE'].to_bool -puts "Is-release? : ##{$isRelease}" +$buildType = ENV['FG_BUILD_TYPE'] +puts "Build Type : #{$buildType}" dmgDir=Dir.pwd + "/image" srcDir=Dir.pwd + "/flightgear" @@ -65,20 +64,27 @@ resourcesDir=contents+"/Resources" fgVersion = File.read("#{srcDir}/flightgear-version").strip -if $isRelease - dmgPath = Dir.pwd + "/output/FlightGear-#{fgVersion}.dmg" +if $buildType == "Release" + if $releaseSuffix.empty? + dmgPath = Dir.pwd + "/flightgear-#{fgVersion}-macos-universal.dmg" + else + dmgPath = Dir.pwd + "/flightgear-#{fgVersion}#{$releaseSuffix}-macos-universal.dmg" + end + + # we don't include the release suffix in the volume name volName="\"FlightGear #{fgVersion}\"" -else +elsif $buildType == "Nightly" # nightly build - n = Date.today - dateStr = n.strftime('%Y%m%d') - dmgPath = Dir.pwd + "/output/FlightGear-#{dateStr}-nightly.dmg" + dateStr = ENV['FG_BUILD_DATE'] + dmgPath = Dir.pwd + "/flightgear-#{dateStr}-macos-universal.dmg" volName="\"FlightGear Nightly #{dateStr}\"" +else + # dev buils + hash = ENV['FG_GIT_SHA'] + dmgPath = Dir.pwd + "/flightgear-#{hash}-macos-universal.dmg" + volName="\"FlightGear Development Build\"" end -# hidutil create won't create enclosing directories -`mkdir -p output` - # FIXME once the CMake-based copying is working otherLibs = ['dbus-1.3'] otherLibs.each do |l| diff --git a/build_win_installers.bat b/build_win_installers.bat index 908f75e..5ed40de 100644 --- a/build_win_installers.bat +++ b/build_win_installers.bat @@ -11,9 +11,6 @@ REM not neeed inside the VM REM subst X: /D - subst X: %WORKSPACE%. -REM ensure output dir is clean since we upload the entirety of it -rmdir /S /Q output - ECHO #define IncludeData "FALSE" >> InstallConfig.iss iscc /Q FlightGear.iss diff --git a/flightgear b/flightgear index 56de802..b1a28a3 160000 --- a/flightgear +++ b/flightgear @@ -1 +1 @@ -Subproject commit 56de8029a1cf15348a72ecd299fbf0321c42293b +Subproject commit b1a28a320e3048ec6f2e3c8b7154d86009faf2d0 diff --git a/release_builder/create_point_release.sh b/release_builder/create_point_release.sh new file mode 100755 index 0000000..1708c7a --- /dev/null +++ b/release_builder/create_point_release.sh @@ -0,0 +1,159 @@ +#!/bin/bash +# SPDX-FileCopyrightText: James Turner <ja...@fl...> +# SPDX-License-Identifier: GPL-2.0-or-later + +SUBMODULES="simgear flightgear fgdata getstart" +THIS_RELEASE="2025.1" +SUFFIX="" + +dryRunFlag="" +forceFlag="" + +usage="\ +Usage: $PROGNAME [OPTION...] <version-major.minor.patch> + +Options: + -f, --force overwrite tags when creating and pushing + --dry-run don't push, just pretend to push + --suffix=SUFFIX set a build suffix, eg 'rc2' + --help display this help message and exit" + +print_usage() +{ + echo "$usage" +} + +validateVersion() { + if [[ "$1" != "$THIS_RELEASE"* ]]; then + echo "Specified version '$1' is not prefixed by the current branch version ('$THIS_RELEASE')" + exit 1 + else + echo "Version: ${1}" + fi +} + +# Options processing +TEMP=$(getopt -o '+f' \ + --longoptions force,dry-run,suffix:,help \ + -n "$PROGNAME" -- "$@") + +case $? in + 0) : ;; + 1) print_usage >&2; exit 1 ;; + *) exit 1 ;; +esac + +# Don't remove the quotes around $TEMP! +eval set -- "$TEMP" + +while true; do + case "$1" in + --force|-f) forceFlag="--force"; shift ;; + --dry-run) dryRunFlag="--dry-run"; shift ;; + --suffix) SUFFIX="$2"; shift 2 ;; + --help) print_usage; exit 0 ;; + --) shift; break ;; + *) echo "$PROGNAME: unexpected option '$1'; please report a bug." >&2 + exit 1 ;; + esac +done + +# Check the number of non-option arguments +if [[ $# -ne 1 ]]; then + print_usage >&2 + exit 1 +fi + +validateVersion "$1" +VERSION=$1 +VER_WITH_SUFFIX=$VERSION + +if [[ -n "$SUFFIX" ]]; then + VER_WITH_SUFFIX+="-$SUFFIX" + echo "Suffix is '$SUFFIX'" +fi + +# set the version file (with correct name) & tag on a submodule +setVersionTo() { + local V="$1" + local versionFileName + local -i isGetStart=0 + + case "$2" in + flightgear) + versionFileName="flightgear-version" + ;; + simgear) + versionFileName="simgear-version" + ;; + getstart) + isGetStart=1 + versionFileName="version" + ;; + *) + versionFileName="version" + ;; + esac + + if [[ -n "$SUFFIX" && $isGetStart -eq 1 ]]; then + # skip tagging / versioning getstart for RC builds + return + fi + + echo "Setting version to $V in $PWD/$versionFileName" + echo "$V" > "$versionFileName" + git add "$versionFileName" + echo "New version: $VER_WITH_SUFFIX" | git commit --file=- + + if [[ $isGetStart -eq 0 ]]; then + git tag $forceFlag "$VER_WITH_SUFFIX" + fi +} + + +for f in $SUBMODULES ; do + pushd "$f" + git checkout release/${THIS_RELEASE} + git config user.name "Automatic Release Builder" + git config user.email "bu...@fl..." + + setVersionTo "$VERSION" $f + + git push $dryRunFlag $forceFlag --tags origin + popd +done + +echo "Done with submodules, creating FGmeta commit" +# fgmeta +git checkout release/${THIS_RELEASE} +git config user.name "Automatic Release Builder" +git config user.email "bu...@fl..." + +echo "$VERSION" > "version" +git add -- "version" $SUBMODULES + +echo "New version: $VER_WITH_SUFFIX" | git commit --file=- +git tag $forceFlag "$VER_WITH_SUFFIX" + +# this commit will trigger the build of the binaries +git push $dryRunFlag $forceFlag --tags origin + +if [[ -x "$(command -v glab)" ]]; then + if [[ -n "$SUFFIX" ]]; then + glab release create "$VER_WITH_SUFFIX" --notes "FlightGear release candidate $VER_WITH_SUFFIX" + else + glab release create "$VERSION" --notes "FlightGear $VERSION" + fi +fi + +# Sentry integration +if [[ -n "$SUFFIX" ]]; then + # this is not really necessary, symbol upload and error reporting will + # create the release automatically + sentry-cli releases --org flightgear --project flightgear new "flightgear@$VERSION" +else + echo "No release suffix is set, finalizing release on Sentry.io" + sentry-cli releases --org flightgear --project flightgear finalize "flightgear@$VERSION" +fi + +echo "All done, pushed new commits and tags." diff --git a/release_builder/upload_installers.sh b/release_builder/upload_installers.sh new file mode 100755 index 0000000..11e5c70 --- /dev/null +++ b/release_builder/upload_installers.sh @@ -0,0 +1,51 @@ +#!/bin/bash +# SPDX-FileCopyrightText: James Turner <ja...@fl...> +# SPDX-License-Identifier: GPL-2.0-or-later + +# ToDo: infer the destination directory from branch name (release/MMMM.N) + +destinations=( + "jmt...@fr...:/home/frs/project/flightgear/release-2025.1/" + "cu...@lo...:/public/mirrors/flightgear/ftp/release-2025.1/" + "jm...@us...:/var/www/download-flightgear/release-2025.1/" +) + +uploadInstaller() { + if [[ ! -f "$1" ]]; then + echo "Skipping missing installer: $1" + return + fi + + for d in "${destinations[@]}"; do + scp "$1" "$d" + done +} + +currentTag="$(git describe --exact-match --tags)" + +if [[ -z "$currentTag" ]]; then + echo "No exact match current tag in Git, won't upload" + exit +fi + +installers=( + "-macos-universal.dmg" + "-windows-amd64.exe" + "-linux-amd64.AppImage" +) + +for i in "${installers[@]}"; do + installFile="flightgear-${currentTag}${i}" + uploadInstaller ${installFile} +done + +if [[ -x "$(command -v glab)" ]]; then + echo "Adding to gitlab release" + + for i in "${installers[@]}"; do + installFile="flightgear-${currentTag}${i}" + + # ToDo set the displayName + glab release upload ${currentTag} "${installFile}" + done +fi |