diff --git a/.github/actions/install_lazarus/action.yaml b/.github/actions/install_lazarus/action.yaml new file mode 100644 index 0000000..f62e0c5 --- /dev/null +++ b/.github/actions/install_lazarus/action.yaml @@ -0,0 +1,101 @@ +# include this file in the cicd_windows.yaml, cicd_ubuntu.yaml, and cicd_macos.yaml like this: +# - name: Install Lazarus IDE +# uses: ./.github/actions/install_lazarus +# with: +# qt_version_ci: 6 # optional, only needed when building with qt5 or qt6 + + +# https://docs.github.com/en/actions/tutorials/create-actions/create-a-composite-action +name: 'Install Lazaurus IDE' +description: 'download and build lazbuild' + +inputs: + qt_version_ci: # id of input + description: 'QT version' + required: false + +runs: + using: "composite" + steps: + - name: Install Lazarus IDE (Windows) + if: runner.os == 'Windows' + run: | + winget install lazarus --disable-interactivity --accept-source-agreements --silent + echo 'c:/lazarus' >> $GITHUB_PATH + shell: pwsh + + - name: Make PATH also in bash available (Windows) + if: runner.os == 'Windows' + run: | + echo 'c:/lazarus' >> $GITHUB_PATH + shell: bash + + - name: Install fpc (Linux) + if: runner.os == 'Linux' + run: | + sudo apt-get update + sudo apt-get install -y fpc + shell: bash + + - name: Install dependency for gtk2 + if: runner.os == 'Linux' && inputs.qt_version_ci == '' + run: sudo apt-get install -y libgtk2.0-dev + shell: bash + + - name: Install dependency for qt5 + if: runner.os == 'Linux' && inputs.qt_version_ci == '5' + run: sudo apt-get install -y libqt5x11extras5-dev + shell: bash + + - name: Install dependency for qt6 + if: runner.os == 'Linux' && inputs.qt_version_ci == '6' + run: sudo apt-get install -y qt6-base-dev + shell: bash + + - name: Install Free Pascal Compiler (FPC) multi arch version for macOS x86_64 and aarch64 (macOS) + if: runner.os == 'macOS' + run: brew install fpc + shell: bash + + - name: Download Lazarus source code into temp folder (Linux and macOS) + if: runner.os != 'Windows' + env: + # Linux and macOS need to build lazbuild from Lazarus source code. + # Copied the latest Lazarus source code from: https://sourceforge.net/projects/lazarus/files/Lazarus%20Zip%20_%20GZip/ + LAZARUS_URL_TAR_GZ: "https://github.com/GerryFerdinandus/bittorrent-tracker-editor/releases/download/V1.32.0/lazarus.tar.gz" + RUNNER_TEMP: ${{ runner.temp }} + run: | + #Download lazarus source code. Directory 'lazarus' will be created in the temp folder. + echo ${RUNNER_TEMP} + cd ${RUNNER_TEMP} + curl -L -O ${{ env.LAZARUS_URL_TAR_GZ }} + tar -xzf *.tar.gz + shell: bash + + - name: Build lazbuild from Lazarus source code (Linux and macOS) + if: runner.os != 'Windows' + env: + RUNNER_TEMP: ${{ runner.temp }} + run: | + # make lazbuild and put the link with extra parameter in the temp folder. + LAZARUS_DIR=${RUNNER_TEMP}/lazarus + cd "$LAZARUS_DIR" + make lazbuild + echo "$LAZARUS_DIR/lazbuild --primary-config-path=$LAZARUS_DIR --lazarusdir=$LAZARUS_DIR \$*" > ${RUNNER_TEMP}/lazbuild + chmod +x ${RUNNER_TEMP}/lazbuild + # Add lazbuild to the PATH variable. + echo ${RUNNER_TEMP} >> $GITHUB_PATH + shell: bash + + - name: Build libQTpas.so (qt5 or qt6) + if: runner.os == 'Linux' && inputs.qt_version_ci != '' + env: + RUNNER_TEMP: ${{ runner.temp }} + run: | + cd "${RUNNER_TEMP}/lazarus/lcl/interfaces/qt${{ inputs.qt_version_ci }}/cbindings/" + /usr/lib/qt${{ inputs.qt_version_ci }}/bin/qmake + make -j$(nproc) + sudo make install + shell: bash + + diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..5b52009 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,14 @@ +# Enable version updates for GitHub Actions at cron schedule every 6 months +# Can be manually triggered via menu: Insights > Dependency graph > "Recent update jobs" -> "Check for updates" + +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "cron" + cronjob: "0 0 1 1/6 *" + commit-message: + prefix: "chore" + include: "scope" + open-pull-requests-limit: 5 diff --git a/.github/workflows/cicd_macos.yaml b/.github/workflows/cicd_macos.yaml index 81cf110..92b4ed2 100644 --- a/.github/workflows/cicd_macos.yaml +++ b/.github/workflows/cicd_macos.yaml @@ -1,3 +1,23 @@ +# CI/CD workflow for macOS systems to build bittorrent tracker editor app +# Uses GitHub Actions macOS runners to build the app for both Apple silicon (aarch64) and Intel Mac (x86_64) +# Then create a Universal binary using lipo tool. +# Finally create a dmg file for end user distribution. +# The build also codesign and notarize the dmg file if the required Apple developer certificate +# and notarization credentials are present in the GitHub secrets. +# The build is triggered on push, pull request, manual workflow dispatch and every 6 months cron job. +# +# macos-15-intel runner is used to build the x86_64 version. +# macos-latest runner is used to build the aarch64 version and also to create the Universal binary dmg file. +# The build uses Free Pascal Compiler (FPC) and Lazarus IDE to build the app. +# +# macos-15-intel runner is the last macOS runner that supports Intel architecture. +# Newer macOS runners only support Apple silicon (aarch64) architecture. +# Keep supporting Intel architecture build while there runners are still available. +# +# Must use macOS ditto tool to create zip files. +# Using zip command creates zip files that missing some metadata required for macOS apps. + + name: CI/CD on macOS systems. permissions: @@ -11,51 +31,109 @@ on: schedule: - cron: "0 0 1 1/6 *" +env: + MACOS_APP: enduser/trackereditor.app + PROGRAM_NAME_WITH_PATH: 'enduser/trackereditor' + BUILD_WITH_CERTIFICATE: ${{ secrets.PROD_MACOS_CERTIFICATE_NAME }} + PROJECT_LPI: source/project/tracker_editor/trackereditor.lpi + RELEASE_DMG_FILE: trackereditor_macOS_notarized_universal_binary.dmg + jobs: build: - runs-on: macos-latest timeout-minutes: 60 - env: - LAZBUILD_WITH_PATH: /Applications/Lazarus/lazbuild - MACOS_APP: enduser/trackereditor.app - PROGRAM_NAME_WITH_PATH: 'enduser/trackereditor' - BUILD_WITH_CERTIFICATE: ${{ secrets.PROD_MACOS_CERTIFICATE_NAME }} - PROJECT_LPI: source/project/tracker_editor/trackereditor.lpi - RELEASE_DMG_FILE: trackereditor_macOS_notarized_universal_binary.dmg + + strategy: + # Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. + fail-fast: false + + # Set up an include to perform the following build configurations. + matrix: + include: + - BUILD_TARGET: build_aarch64 + ARCH: aarch64 + RUNS_ON: macos-latest + + - BUILD_TARGET: build_x86_64 + ARCH: x86_64 + RUNS_ON: macos-15-intel + + name: ${{ matrix.BUILD_TARGET }} + runs-on: ${{ matrix.RUNS_ON }} steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 with: submodules: true - name: Install Lazarus IDE - run: brew install --cask lazarus + uses: ./.github/actions/install_lazarus - - name: Install Create dmg - run: brew install create-dmg - - - name: Build trackereditor app for Apple silicon (aarch64) + - name: Build trackereditor app for Apple (${{ matrix.ARCH }}) run: | - ${{ env.LAZBUILD_WITH_PATH }} --build-all --build-mode=Release --widgetset=cocoa --cpu=aarch64 ${{ env.PROJECT_LPI }} - mv ${{ env.PROGRAM_NAME_WITH_PATH }} ${{ env.PROGRAM_NAME_WITH_PATH }}-aarch64 + lazbuild --build-all --build-mode=Release --widgetset=cocoa --cpu=${{ matrix.ARCH }} ${{ env.PROJECT_LPI }} + shell: bash + + - name: Test App SSL connection + run: open "${{ env.PROGRAM_NAME_WITH_PATH }}" --args -TEST_SSL + shell: bash + + - name: Zip the macOS .app bundle for artifact upload + if: matrix.ARCH == 'aarch64' + run: ditto -c -k enduser/trackereditor.app enduser/trackereditor_app.zip shell: bash - - name: Build trackereditor app for Intel Mac version (x86_64) + - name: Rename built -aarch64 binary for artifact upload run: | - ${{ env.LAZBUILD_WITH_PATH }} --build-all --build-mode=Release --widgetset=cocoa --cpu=x86_64 ${{ env.PROJECT_LPI }} - mv ${{ env.PROGRAM_NAME_WITH_PATH }} ${{ env.PROGRAM_NAME_WITH_PATH }}-x86_64 + mv ${{ env.PROGRAM_NAME_WITH_PATH }} ${{ env.PROGRAM_NAME_WITH_PATH }}-${{ matrix.ARCH }} + ditto -c -k ${{ env.PROGRAM_NAME_WITH_PATH }}-${{ matrix.ARCH }} ${{ env.PROGRAM_NAME_WITH_PATH }}-${{ matrix.ARCH }}.zip shell: bash - - name: Create a Universal macOS binary from aarch64 and x86_64 + - name: Upload Artifact. + uses: actions/upload-artifact@v6 + with: + name: artifact-${{ matrix.ARCH }} + # Include both the zipped universal app bundle and the aarch64 binary zip + path: enduser/*.zip + if-no-files-found: error + + create_universal_macOS_binary: # Create Universal binary from aarch64 and x86_64 builds + needs: build + runs-on: macos-latest + timeout-minutes: 60 + + steps: + - uses: actions/checkout@v6 + with: + sparse-checkout: metainfo + + - name: Install create-dmg tool + run: brew install create-dmg + shell: bash + + - name: Download build artifacts from previous jobs + uses: actions/download-artifact@v7 + with: + path: enduser/ + merge-multiple: true + + - name: Display the downloaded artifact files + run: ls -R enduser/ + shell: bash + + - name: Unzip all the artifact files run: | - # Create a new Universal macOS binary - lipo -create -output ${{ env.PROGRAM_NAME_WITH_PATH }} ${{ env.PROGRAM_NAME_WITH_PATH }}-aarch64 ${{ env.PROGRAM_NAME_WITH_PATH }}-x86_64 + ditto -xk enduser/trackereditor_app.zip enduser/trackereditor.app + ditto -xk ${{ env.PROGRAM_NAME_WITH_PATH }}-x86_64.zip enduser/ + ditto -xk ${{ env.PROGRAM_NAME_WITH_PATH }}-aarch64.zip enduser/ + # Remove the zip files after extraction + rm -f enduser/*.zip + shell: bash - # Remove these extra binary build. Not needed any more. - rm -f ${{ env.PROGRAM_NAME_WITH_PATH }}-* + - name: Display the downloaded artifact files after unzip + run: ls -R enduser/ shell: bash - - name: Extract latest program version from metainfo and update the Info.plist with it + - name: Set correct version number in macOS .app bundle Info.plist from metainfo xml file env: METAINFO_FILE: metainfo/io.github.gerryferdinandus.bittorrent-tracker-editor.metainfo.xml run: | @@ -64,17 +142,10 @@ jobs: plutil -replace CFBundleShortVersionString -string $TRACKER_EDITOR_VERSION ${{ env.MACOS_APP }}/Contents/Info.plist shell: bash - - name: Move program and icon into macOS .app + - name: Create and set app icon in macOS .app bundle env: ICON_FILE: 'metainfo/io.github.gerryferdinandus.bittorrent-tracker-editor.png' run: | - PROGRAM_NAME_ONLY=$(basename -- "${{ env.PROGRAM_NAME_WITH_PATH }}") - - # ------ Move program to app - # remove the previeus app version - rm -f "${{ env.MACOS_APP }}/Contents/MacOS/${PROGRAM_NAME_ONLY}" - # copy the program to the app version. - mv -f "${{ env.PROGRAM_NAME_WITH_PATH }}" "${{ env.MACOS_APP }}/Contents/MacOS" # ------ Create icon set and move it into the app iconset_folder="temp_folder.iconset" @@ -98,7 +169,30 @@ jobs: plutil -insert CFBundleIconFile -string "iconfile" "${{ env.MACOS_APP }}/Contents/Info.plist" shell: bash - - name: Check CPU type generated by Lazbuild + - name: Create a Universal macOS binary from aarch64 and x86_64 + run: | + # Create Universal binary using lipo tool + lipo -create -output ${{ env.PROGRAM_NAME_WITH_PATH }} ${{ env.PROGRAM_NAME_WITH_PATH }}-aarch64 ${{ env.PROGRAM_NAME_WITH_PATH }}-x86_64 + + # Remove the previous architecture specific binaries + rm -f ${{ env.PROGRAM_NAME_WITH_PATH }}-* + shell: bash + + - name: Replace the macOS .app bundle binary with the Universal binary + run: | + PROGRAM_NAME_ONLY=$(basename -- "${{ env.PROGRAM_NAME_WITH_PATH }}") + # remove the previous app (symbolic link) + rm -f "${{ env.MACOS_APP }}/Contents/MacOS/${PROGRAM_NAME_ONLY}" + # copy the program to the app version. + mv -f "${{ env.PROGRAM_NAME_WITH_PATH }}" "${{ env.MACOS_APP }}/Contents/MacOS" + ls -l "${{ env.MACOS_APP }}/Contents/MacOS/" + shell: bash + + - name: Display the enduser/ folder contents + run: ls -R enduser/ + shell: bash + + - name: Verify the Universal binary architectures run: | lipo -archs "${{ env.MACOS_APP }}"/Contents/MacOS/trackereditor lipo -archs "${{ env.MACOS_APP }}"/Contents/MacOS/trackereditor | grep -Fq x86_64 @@ -138,11 +232,12 @@ jobs: /usr/bin/codesign --timestamp --force --options runtime --sign "$MACOS_CERTIFICATE_NAME" "${{ env.MACOS_APP }}" shell: bash + - name: Display the enduser/ folder contents + run: ls -R enduser/ + shell: bash + - name: Create dmg file from the enduser/ folder run: | - # Remove all txt file. There are not needed. - rm -f enduser/*.txt - # Build dmg image. https://github.com/create-dmg/create-dmg create-dmg \ --volname "bittorrent-tracker-editor" \ @@ -202,7 +297,7 @@ jobs: shell: bash - name: Upload Artifact. Signed/Notarize is optional. - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v6 with: name: artifact-${{ runner.os }} path: "*.dmg" diff --git a/.github/workflows/cicd_ubuntu.yaml b/.github/workflows/cicd_ubuntu.yaml index f53f818..82de8e1 100644 --- a/.github/workflows/cicd_ubuntu.yaml +++ b/.github/workflows/cicd_ubuntu.yaml @@ -13,12 +13,8 @@ on: jobs: build: - runs-on: ubuntu-24.04 #ubuntu-latest timeout-minutes: 60 - env: # Use the latest Lazarus source code. - LAZARUS_URL_TAR_GZ: "https://github.com/GerryFerdinandus/bittorrent-tracker-editor/releases/download/V1.32.0/lazarus.tar.gz" - strategy: # Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. fail-fast: false @@ -29,88 +25,68 @@ jobs: - BUILD_TARGET: gtk2_amd64 RELEASE_FILE_NAME: trackereditor_linux_amd64_gtk2.zip LAZ_OPT: --widgetset=gtk2 + RUNS_ON: ubuntu-24.04 - BUILD_TARGET: qt5_amd64 RELEASE_FILE_NAME: trackereditor_linux_amd64_qt5.zip LAZ_OPT: --widgetset=qt5 QT_VERSION_CI: '5' + RUNS_ON: ubuntu-24.04 - BUILD_TARGET: qt6_amd64 RELEASE_FILE_NAME: trackereditor_linux_amd64_qt6.zip LAZ_OPT: --widgetset=qt6 QT_VERSION_CI: '6' + RUNS_ON: ubuntu-24.04 - BUILD_TARGET: AppImage_amd64 RELEASE_FILE_NAME: trackereditor_linux_amd64_qt6.AppImage LAZ_OPT: --widgetset=qt6 QT_VERSION_CI: '6' + LINUX_DEPLOY_FILE_CPU: x86_64 + RUNS_ON: ubuntu-22.04 + + - BUILD_TARGET: AppImage_arm64 + RELEASE_FILE_NAME: trackereditor_linux_arm64_qt6.AppImage + LAZ_OPT: --widgetset=qt6 + QT_VERSION_CI: '6' + LINUX_DEPLOY_FILE_CPU: aarch64 + RUNS_ON: ubuntu-22.04-arm + + name: ${{ matrix.BUILD_TARGET }} + runs-on: ${{ matrix.RUNS_ON }} steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 with: submodules: true - - name: Install dependency for all build - run: sudo apt-get install -y fpc xvfb - shell: bash - - - name: Install dependency for gtk2 - if: matrix.QT_VERSION_CI == '' - run: sudo apt-get install -y libgtk2.0-dev - shell: bash - - - name: Install dependency for qt5 - if: matrix.QT_VERSION_CI == '5' - run: sudo apt-get install -y libqt5x11extras5-dev - shell: bash + - name: Install Lazarus IDE + uses: ./.github/actions/install_lazarus + with: + qt_version_ci: ${{ matrix.QT_VERSION_CI }} - - name: Install dependency for qt6 - if: matrix.QT_VERSION_CI == '6' - run: sudo apt-get install -y qt6-base-dev + - name: Install dependency for all build + run: | + sudo apt-get update + sudo apt-get install -y xvfb shell: bash - name: Install dependency for AppImage - if: matrix.BUILD_TARGET == 'AppImage_amd64' + if: matrix.BUILD_TARGET == 'AppImage_amd64' || matrix.BUILD_TARGET == 'AppImage_arm64' run: | # Add wayland plugin and platform theme sudo apt-get install -y fuse qt6-wayland qt6-xdgdesktopportal-platformtheme qt6-gtk-platformtheme - # Use static versions of AppImage builder. So it won't depend on some specific OS image or library version. - curl -L -O https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-static-x86_64.AppImage - curl -L -O https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-static-x86_64.AppImage - curl -L -O https://github.com/linuxdeploy/linuxdeploy-plugin-appimage/releases/download/continuous/linuxdeploy-plugin-appimage-x86_64.AppImage + # Download/Install AppImage tools + curl -L -O https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-${{ matrix.LINUX_DEPLOY_FILE_CPU }}.AppImage + curl -L -O https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-${{ matrix.LINUX_DEPLOY_FILE_CPU }}.AppImage + curl -L -O https://github.com/linuxdeploy/linuxdeploy-plugin-appimage/releases/download/continuous/linuxdeploy-plugin-appimage-${{ matrix.LINUX_DEPLOY_FILE_CPU }}.AppImage chmod +x linuxdeploy-*.AppImage shell: bash - - name: Download Lazarus source code - run: | - #Download lazarus source code. Directory 'lazarus' will be created in the project folder. - curl -L -O ${{ env.LAZARUS_URL_TAR_GZ }} - tar -xzf *.tar.gz - shell: bash - - - name: Build libQTpas.so - if: matrix.QT_VERSION_CI != '' - run: | - cd "${{ github.workspace }}/lazarus/lcl/interfaces/qt${{ matrix.QT_VERSION_CI }}/cbindings/" - /usr/lib/qt${{ matrix.QT_VERSION_CI }}/bin/qmake - make -j$(nproc) - sudo make install - shell: bash - - - name: Build lazbuild - env: - LAZARUS_DIR: "${{ github.workspace }}/lazarus" - run: | - # make lazbuild and put the link with extra parameter in project folder - cd "$LAZARUS_DIR" - make lazbuild - echo "$LAZARUS_DIR/lazbuild --primary-config-path=$LAZARUS_DIR --lazarusdir=$LAZARUS_DIR \$*" > ${{ github.workspace }}/lazbuild - chmod +x ${{ github.workspace }}/lazbuild - shell: bash - - name: Build trackereditor # Build trackereditor project (Release mode) - run: ./lazbuild --build-all --build-mode=Release ${{ matrix.LAZ_OPT }} source/project/tracker_editor/trackereditor.lpi + run: lazbuild --build-all --build-mode=Release ${{ matrix.LAZ_OPT }} source/project/tracker_editor/trackereditor.lpi shell: bash - name: Test if OpenSSL works on Linux CI @@ -138,7 +114,7 @@ jobs: shell: bash - name: Create AppImage - if: matrix.BUILD_TARGET == 'AppImage_amd64' + if: matrix.BUILD_TARGET == 'AppImage_amd64' || matrix.BUILD_TARGET == 'AppImage_arm64' # LDAI_NO_APPSTREAM=1: skip checking AppStream metadata for issues env: LDAI_NO_APPSTREAM: 1 @@ -148,7 +124,7 @@ jobs: EXTRA_PLATFORM_PLUGINS: libqwayland-generic.so;libqwayland-egl.so DEPLOY_PLATFORM_THEMES: true run: | - ./linuxdeploy-static-x86_64.AppImage \ + ./linuxdeploy-${{ matrix.LINUX_DEPLOY_FILE_CPU }}.AppImage \ --output appimage \ --appdir temp_appdir \ --plugin qt \ @@ -163,7 +139,7 @@ jobs: shell: bash - name: Upload Artifact - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v6 with: name: artifact-${{ matrix.RELEASE_FILE_NAME }} path: ${{ matrix.RELEASE_FILE_NAME }} diff --git a/.github/workflows/cicd_windows.yaml b/.github/workflows/cicd_windows.yaml index c9dca02..05a2fba 100644 --- a/.github/workflows/cicd_windows.yaml +++ b/.github/workflows/cicd_windows.yaml @@ -13,26 +13,19 @@ on: jobs: build: - runs-on: windows-2022 + runs-on: windows-latest timeout-minutes: 60 env: - LAZBUILD_WITH_PATH: c:/lazarus/lazbuild RELEASE_ZIP_FILE: trackereditor_windows_amd64.zip LAZ_OPT: steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 with: submodules: true - - name: Install winget - # winget will be included in windows server 2025 - uses: Cyberboss/install-winget@v1 - with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Install Lazarus IDE - run: winget install lazarus --disable-interactivity --accept-source-agreements --silent + uses: ./.github/actions/install_lazarus - name: Download OpenSSL *.dll run: | @@ -44,12 +37,12 @@ jobs: - name: Build Release version # Build trackereditor project (Release mode) - run: ${{ env.LAZBUILD_WITH_PATH }} --build-all --build-mode=Release ${{ env.LAZ_OPT }} source/project/tracker_editor/trackereditor.lpi + run: lazbuild --build-all --build-mode=Release ${{ env.LAZ_OPT }} source/project/tracker_editor/trackereditor.lpi shell: bash - name: Build Unit Test on Windows # Build unit test project (Debug mode) - run: ${{ env.LAZBUILD_WITH_PATH }} --build-all --build-mode=Debug ${{ env.LAZ_OPT }} source/project/unit_test/tracker_editor_test.lpi + run: lazbuild --build-all --build-mode=Debug ${{ env.LAZ_OPT }} source/project/unit_test/tracker_editor_test.lpi shell: bash - name: Run Unit Test on Windows @@ -73,7 +66,7 @@ jobs: shell: pwsh - name: Upload Artifact - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v6 with: name: artifact-${{ runner.os }} path: ${{ env.RELEASE_ZIP_FILE }} diff --git a/.github/workflows/snap.yml b/.github/workflows/snap.yml index 005920a..2a77953 100644 --- a/.github/workflows/snap.yml +++ b/.github/workflows/snap.yml @@ -13,14 +13,14 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 60 steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 with: submodules: true - uses: snapcore/action-build@v1 - name: Upload Artifact - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v6 with: name: artifact-snap path: "*.snap" diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 9a88fe0..bc6fe21 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -2,23 +2,20 @@ name: bittorrent-tracker-editor adopt-info: mainprogram icon: metainfo/io.github.gerryferdinandus.bittorrent-tracker-editor.png -base: core22 +base: core24 grade: stable confinement: strict -architectures: - - build-on: amd64 - - build-on: arm64 +platforms: + amd64: + arm64: apps: bittorrent-tracker-editor: desktop: io.github.gerryferdinandus.bittorrent-tracker-editor.desktop extensions: - - kde-neon + - kde-neon-6 command: trackereditor - environment: - # Fallback to XWayland if running in a Wayland session. - DISABLE_WAYLAND: 1 plugs: - home - network @@ -32,28 +29,30 @@ parts: - curl - build-essential - fpc - - libqt5x11extras5-dev + - libxkbcommon-dev + build-environment: - LAZARUS_URL_TAR_GZ: "https://github.com/GerryFerdinandus/bittorrent-tracker-editor/releases/download/V1.32.0/lazarus.tar.gz" - - LAZARUS_QT_VERSION: "5" + - LAZARUS_QT_VERSION: "6" - LIB_DIR: "/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR" - LAZARUS_DIR: "$PWD/lazarus" override-build: | - # Remove the older libQTpas.so - rm -f $LIB_DIR/libQt${LAZARUS_QT_VERSION}Pas.* - #Download lazarus source code. Directory 'lazarus' will be created in the root. curl -L -O $LAZARUS_URL_TAR_GZ tar -xzf *.tar.gz - # Create libQTpas.so and put it in snap $CRAFT_PART_INSTALL + #--- Create libQTpas.so and put it in /usr/lib/ and $CRAFT_PART_INSTALL cd "$LAZARUS_DIR/lcl/interfaces/qt${LAZARUS_QT_VERSION}/cbindings/" - qmake + /snap/kde-qt6-core24-sdk/current/usr/bin/qt6/qmake6 make -j$(nproc) - make install + + # copy the libQTpas.so to /usr/lib/ (needed for compile-time linking) + cp -av libQt${LAZARUS_QT_VERSION}Pas.* $LIB_DIR/ + + # copy the libQTpas.so to snap install directory (needed for run-time linking) cp -av --parents $LIB_DIR/libQt${LAZARUS_QT_VERSION}Pas.* $CRAFT_PART_INSTALL - # make lazbuild and put the link with extra parameter in /usr/bin/ + #--- Make lazbuild and put the link with extra parameter in /usr/bin/ cd "$LAZARUS_DIR" make lazbuild echo "$LAZARUS_DIR/lazbuild --primary-config-path=$LAZARUS_DIR --lazarusdir=$LAZARUS_DIR \$*" > /usr/bin/lazbuild @@ -65,19 +64,20 @@ parts: plugin: nil parse-info: [metainfo/io.github.gerryferdinandus.bittorrent-tracker-editor.metainfo.xml] override-build: | - lazbuild --build-mode=Release --widgetset=qt5 source/project/tracker_editor/trackereditor.lpi + lazbuild --build-mode=Release --widgetset=qt6 source/project/tracker_editor/trackereditor.lpi install enduser/trackereditor $CRAFT_PART_INSTALL/ install metainfo/io.github.gerryferdinandus.bittorrent-tracker-editor.desktop $CRAFT_PART_INSTALL/ # -------------------------------------------------------------- -# Only 2 files are explicitly added in this snap +# Only 3 files are explicitly added in this snap # - main program: enduser/trackereditor -# - Lazarus QT suport library: libQt5Pas.so +# - desktop file: metainfo/io.github.gerryferdinandus.bittorrent-tracker-editor.desktop +# - libQt6Pas.so created during the build_lazarus part # # Create snap. Run from the project root folder: -# snapcraft --verbosity verbose +# snapcraft pack --verbosity verbose # -# he snapTo look what is inside t file. Directory 'squashfs-root' will be created in the root folder: +# To look what is inside the snap file. Directory 'squashfs-root' will be created in the root folder: # unsquashfs *.snap # # Install the snap: @@ -86,8 +86,3 @@ parts: # Run the snap # snap run bittorrent-tracker-editor # -------------------------------------------------------------- -# Todo: building for QT6 is still not working with snap -# https://askubuntu.com/questions/1460242/ubuntu-22-04-with-qt6-qmake-could-not-find-a-qt-installation-of -# qtchooser -install qt{LAZARUS_QT_VERSION} $(which qmake6) -# export QT_SELECT=qt{LAZARUS_QT_VERSION} -# -------------------------------------------------------------- diff --git a/source/project/tracker_editor/trackereditor.lpi b/source/project/tracker_editor/trackereditor.lpi index a91b00d..9b49c62 100644 --- a/source/project/tracker_editor/trackereditor.lpi +++ b/source/project/tracker_editor/trackereditor.lpi @@ -74,7 +74,14 @@