From a9e96f86f26205c226b17504f6a70b68653716b3 Mon Sep 17 00:00:00 2001 From: uncor3 Date: Sat, 18 Oct 2025 23:51:34 +0000 Subject: [PATCH] refactor: linux build workflow --- .github/workflows/build-linux.yml | 118 ++++++++++++++ .github/workflows/build.yml | 252 ++---------------------------- 2 files changed, 131 insertions(+), 239 deletions(-) create mode 100644 .github/workflows/build-linux.yml diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml new file mode 100644 index 0000000..f92791e --- /dev/null +++ b/.github/workflows/build-linux.yml @@ -0,0 +1,118 @@ +name: Build Linux + +on: + workflow_dispatch: + +jobs: + build-linux: + runs-on: ubuntu-22.04 + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + submodules: "recursive" + token: ${{ secrets.PAT }} + + - name: Set up Go + uses: actions/setup-go@v6 + with: + go-version: "^1.23.0" + + - name: Install Linux dependencies + run: | + sudo apt-get update + sudo apt-get install -y \ + build-essential \ + autoconf \ + automake \ + checkinstall \ + git \ + pkg-config \ + libpugixml-dev \ + libusb-1.0-0-dev \ + libqrencode-dev \ + libirecovery-1.0-dev \ + libcurl4-openssl-dev \ + libusbmuxd-dev \ + libssl-dev \ + libtool-bin \ + libreadline-dev \ + libavahi-compat-libdnssd-dev \ + libavcodec-dev \ + libavutil-dev \ + libswscale-dev \ + libgstreamer1.0-dev \ + libgstreamer-plugins-base1.0-dev \ + libfuse2 \ + libunwind-dev \ + libxcb-cursor0 \ + libxkbcommon-x11-0 \ + libheif-dev \ + libplist-dev \ + libtatsu-dev \ + libimobiledevice-dev \ + libimobiledevice-glue-dev \ + libirecovery-1.0-dev + + - name: Install Qt + uses: jurplel/install-qt-action@v3 + with: + version: "6.7.2" + modules: "qtmultimedia qtlocation qtpositioning qtserialport" + + # - name: Build libimobiledevice suite + # run: | + # repos=("libplist" "libtatsu" "libimobiledevice-glue" "libimobiledevice" "libirecovery") + + # for repo in "${repos[@]}"; do + # echo "Building $repo..." + + # git clone --depth=1 --recursive "https://github.com/libimobiledevice/$repo" + # pushd "$repo" + # ./autogen.sh + # sudo make install + # popd + + # echo "Built $repo successfully." + # done + + - name: Update linker cache + run: sudo ldconfig + + - name: Configure CMake + run: | + cmake -B build -S . -DCMAKE_BUILD_TYPE=Release -DRUN_CLANG_TIDY=OFF + + - name: Build with CMake + run: cmake --build build --config Release + + - name: Prepare for AppImage + run: | + cp resources/icons/app-icon/icon.png build/iDescriptor.png + + cat < build/iDescriptor.desktop + [Desktop Entry] + Name=iDescriptor + Exec=iDescriptor + Icon=iDescriptor + Type=Application + Categories=Utility; + EOF + + - name: Install linuxdeployqt + run: | + wget -c -nv "https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage" + chmod a+x linuxdeployqt-continuous-x86_64.AppImage + + - name: Build AppImage + working-directory: ./build + run: | + export VERSION=1.0.0 + ../linuxdeployqt-continuous-x86_64.AppImage iDescriptor -appimage + + - name: Upload Artifact + uses: actions/upload-artifact@v4 + with: + name: iDescriptor-Linux + path: build/iDescriptor-*.AppImage diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 966f9b4..6e55c10 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,247 +1,21 @@ name: Build iDescriptor on: - push: - branches: ['main'] - pull_request: - branches: ['main'] + # push: + # branches: ["main"] + # pull_request: + # branches: ["main"] workflow_dispatch: jobs: - build: - strategy: - matrix: - os: [ubuntu-22.04, windows-2022] - # os: [ubuntu-latest, macos-latest, windows-latest] - runs-on: ${{ matrix.os }} - defaults: - run: - shell: ${{ matrix.os == 'windows-2022' && 'msys2 {0}' || 'bash' }} + build-linux: + uses: ./.github/workflows/build-linux.yml + secrets: inherit - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - submodules: 'recursive' - token: ${{ secrets.PAT }} + build-windows: + uses: ./.github/workflows/build-windows.yml + secrets: inherit - - name: Setup MSYS2 (Windows) - if: runner.os == 'Windows' - uses: msys2/setup-msys2@v2 - with: - msystem: mingw64 - release: false - update: false - install: >- - coreutils - base-devel - git - mingw-w64-x86_64-gcc - make - libtool - autoconf - automake-wrapper - mingw-w64-x86_64-cmake - mingw-w64-x86_64-qt6-base - mingw-w64-x86_64-qt6-svg - mingw-w64-x86_64-qt6-multimedia - mingw-w64-x86_64-qt6-location - mingw-w64-x86_64-qt6-positioning - mingw-w64-x86_64-qt6-serialport - mingw-w64-x86_64-pugixml - mingw-w64-x86_64-libusb - mingw-w64-x86_64-qrencode - mingw-w64-x86_64-curl - mingw-w64-x86_64-openssl - mingw-w64-x86_64-libzip - mingw-w64-x86_64-go - p7zip - - - name: Download and Extract Bonjour SDK (Windows) - if: runner.os == 'Windows' - run: | - # Download the SDK installer - wget "https://gsf-fl.softonic.com/b18/d44/cbdcd43ad683cf6760d45ce891c3035044/bonjoursdksetup.exe?Expires=1757906571&Signature=af8dfce8a002130f34c0e93e17b8dd96d547ff69&url=https://bonjour.en.softonic.com/&Filename=bonjoursdksetup.exe" -O bonjour-sdk.exe - - # Compare checksum to verify download - # This hash was obtained from Apple's official Bonjour SDK download page - EXPECTED_HASH="4ff2aae8205aec31b06743782cfcadce" - ACTUAL_HASH=$(md5sum bonjour-sdk.exe | awk '{print $1}') - - echo "Expected MD5: $EXPECTED_HASH" - echo "Actual MD5: $ACTUAL_HASH" - - if [ "$ACTUAL_HASH" != "$EXPECTED_HASH" ]; then - echo "::error::Checksum mismatch!" - exit 1 - fi - - echo "Checksum verified. Extracting installer..." - # Extract the .exe to get the .msi files - 7z x bonjour-sdk.exe -oBonjourInstaller - - - name: Install Bonjour Runtime (Windows) - if: runner.os == 'Windows' - shell: powershell - run: | - # The SDK requires the normal version of Bonjour to be installed first - $currentPath = Get-Location - $msiFilePath = Join-Path -Path $currentPath -ChildPath "BonjourInstaller\Bonjour64.msi" - $msiexecArguments = "/i `"$msiFilePath`" /qn" - Write-Host "Installing Bonjour Runtime..." - Start-Process msiexec -ArgumentList $msiexecArguments -NoNewWindow -Wait - - - name: Install Bonjour SDK (Windows) - if: runner.os == 'Windows' - shell: powershell - run: | - $currentPath = Get-Location - $msiFilePath = Join-Path -Path $currentPath -ChildPath "BonjourInstaller\BonjourSDK64.msi" - $msiexecArguments = "/i `"$msiFilePath`" /qn" - Write-Host "Installing Bonjour SDK..." - Start-Process msiexec -ArgumentList $msiexecArguments -NoNewWindow -Wait - - # Set the environment variable for CMake to find the SDK - "BONJOUR_SDK_HOME=C:/Program Files/Bonjour SDK" | Out-File -FilePath $env:GITHUB_ENV -Append - - - name: Install Qt (Linux) - if: runner.os == 'Linux' - uses: jurplel/install-qt-action@v3 - with: - version: '6.7.2' - modules: 'qtmultimedia qtlocation qtpositioning qtserialport' - - - name: Set up Go (Linux) - if: runner.os == 'Linux' - uses: actions/setup-go@v6 - with: - go-version: '^1.23.0' - - - name: Install Linux dependencies (apt) - if: runner.os == 'Linux' - run: | - sudo apt-get update - sudo apt-get install -y \ - build-essential \ - autoconf \ - automake \ - checkinstall \ - git \ - pkg-config \ - libpugixml-dev \ - libusb-1.0-0-dev \ - libqrencode-dev \ - libirecovery-1.0-dev \ - libcurl4-openssl-dev \ - libusbmuxd-dev \ - libssl-dev \ - libtool-bin \ - libreadline-dev \ - libavahi-compat-libdnssd-dev \ - libavcodec-dev \ - libavutil-dev \ - libswscale-dev \ - libgstreamer1.0-dev \ - libgstreamer-plugins-base1.0-dev \ - libfuse2 \ - libunwind-dev \ - libxcb-cursor0 \ - libxkbcommon-x11-0 \ - - - name: Build libimobiledevice suite (Linux) - if: runner.os == 'Linux' - run: | - # List of repositories to build in order (dependencies first) - repos=("libplist" "libtatsu" "libimobiledevice-glue" "libimobiledevice" "libirecovery") - - for repo in "${repos[@]}"; do - echo "Building $repo..." - - git clone --depth=1 --recursive "https://github.com/libimobiledevice/$repo" - pushd "$repo" - ./autogen.sh - sudo make install - popd - - echo "Built $repo successfully." - done - - - name: Build libimobiledevice suite (Windows) - if: runner.os == 'Windows' - run: | - echo "target_triplet=`gcc -dumpmachine`" >> $GITHUB_ENV - git config --global core.autocrlf false - - # List of repositories to build in order (dependencies first) - repos=("libplist" "libimobiledevice-glue" "libusbmuxd" "libtatsu" "libimobiledevice" "libirecovery") - - for repo in "${repos[@]}"; do - echo "Building $repo..." - - git clone --depth=1 --recursive "https://github.com/libimobiledevice/$repo" - pushd "$repo" - ./autogen.sh CC=gcc CXX=g++ --enable-debug --without-cython - make -j install - popd - echo "Built $repo successfully." - done - - - name: Update linker cache - if: runner.os == 'Linux' - run: sudo ldconfig - - - name: Configure CMake (Linux) - if: runner.os == 'Linux' - run: | - cmake -B build -S . -DCMAKE_BUILD_TYPE=Release -DRUN_CLANG_TIDY=OFF - - - name: Configure CMake (Windows) - if: runner.os == 'Windows' - run: | - cmake -B build -S . -DCMAKE_BUILD_TYPE=Release - - - name: Build with CMake - run: cmake --build build --config Release - - - name: Prepare for AppImage - if: runner.os == 'Linux' - run: | - cp icons/icon.png build/iDescriptor.png - - # Create a .desktop file required for the AppImage - cat < build/iDescriptor.desktop - [Desktop Entry] - Name=iDescriptor - Exec=iDescriptor - Icon=iDescriptor - Type=Application - Categories=Utility; - EOF - - - name: Install linuxdeployqt - if: runner.os == 'Linux' - run: | - wget -c -nv "https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage" - chmod a+x linuxdeployqt-continuous-x86_64.AppImage - - - name: Build AppImage - if: runner.os == 'Linux' - working-directory: ./build - run: | - export VERSION=1.0.0 - # Include the Go library as an additional executable/library - ../linuxdeployqt-continuous-x86_64.AppImage iDescriptor -appimage - - - name: Upload Artifact (Linux) - if: runner.os == 'Linux' - uses: actions/upload-artifact@v4 - with: - name: iDescriptor-AppImage - path: build/iDescriptor-*.AppImage - - - name: Upload Artifact (Windows) - if: runner.os == 'Windows' - uses: actions/upload-artifact@v4 - with: - name: iDescriptor-Windows - path: build/Release/iDescriptor.exe + build-macos: + uses: ./.github/workflows/build-macos.yml + secrets: inherit