diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index a9011a64..a457e40e 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -13,7 +13,14 @@ on: jobs: build: - runs-on: ubuntu-22.04 + strategy: + matrix: + include: + - os: ubuntu-22.04 + - os: ubuntu-22.04-arm64-2core + + name: ${{ matrix.os }} + runs-on: ${{ matrix.os }} steps: - name: Download source codes @@ -24,13 +31,20 @@ jobs: sudo apt-get update -y sudo apt-get install -y build-essential ninja-build patchelf libfuse2 libglib2.0-dev pip install aqtinstall + mkdir executables - name: Install Qt + if: matrix.os == 'ubuntu-22.04' run: | python3 -m aqt install-qt linux desktop $QT_VERSION linux_gcc_64 -O /tmp/qt + + - name: Install Qt + if: matrix.os == 'ubuntu-22.04-arm64-2core' + run: | python3 -m aqt install-qt linux_arm64 desktop $QT_VERSION linux_gcc_arm64 -O /tmp/qt - name: Build for amd64 + if: matrix.os == 'ubuntu-22.04' run: | chmod +x /tmp/qt/$QT_VERSION/gcc_64/bin/qt-cmake /tmp/qt/$QT_VERSION/gcc_64/bin/qt-cmake \ @@ -39,42 +53,55 @@ jobs: -G Ninja \ -D CMAKE_BUILD_TYPE=Release cmake --build build-amd64 --parallel --config Release + cp build-amd64/deploy/*.AppImage executables + + - name: Build for Linux arm64 + if: matrix.os == 'ubuntu-22.04-arm64-2core' + run: | + chmod +x /tmp/qt/$QT_VERSION/gcc_arm64/bin/qt-cmake + /tmp/qt/$QT_VERSION/gcc_arm64/bin/qt-cmake \ + -S . \ + -B build-arm64 \ + -G Ninja \ + -D CMAKE_BUILD_TYPE=Release + cmake --build build-arm64 --parallel --config Release + cp build-arm64/deploy/*.AppImage executables - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 + - name: Cache executables for publication + uses: actions/cache/save@v4 with: - platforms: arm64 + enableCrossOsArchive: true + key: ${{ matrix.os }}-${{ github.run_id }}-${{ github.run_attempt }} + path: executables - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + publish: + name: Publish + needs: build + runs-on: ubuntu-22.04 + permissions: write-all - - name: Build for Linux arm64 - run: | - sudo docker run \ - --rm \ - --platform linux/arm64 \ - -v /tmp/qt:/tmp/qt \ - -v `pwd`:/tmp/qtapp \ - arm64v8/ubuntu:22.04 \ - bash -c ' - cd /tmp/qtapp - apt-get update -y - apt-get install -y build-essential cmake ninja-build patchelf libfuse2 libglib2.0-dev - chmod +x /tmp/qt/'"$QT_VERSION"'/gcc_arm64/bin/qt-cmake - /tmp/qt/'"$QT_VERSION"'/gcc_arm64/bin/qt-cmake \ - -S . \ - -B build-arm64 \ - -G Ninja \ - -D CMAKE_BUILD_TYPE=Release - sed -i "s|AI\x02|\x00\x00\x00|" build-arm64/appimagetool - cmake --build build-arm64 --parallel --config Release - ' - - - name: Publish build artifacts - uses: marvinpinto/action-automatic-releases@latest + steps: + - name: Restore Linux amd64 executables + uses: actions/cache/restore@v4 + with: + fail-on-cache-miss: true + key: ubuntu-22.04-${{ github.run_id }}-${{ github.run_attempt }} + path: executables + + - name: Restore Linux arm64 executables + uses: actions/cache/restore@v4 + with: + fail-on-cache-miss: true + key: ubuntu-22.04-arm64-2core-${{ github.run_id }}-${{ github.run_attempt }} + path: executables + + - name: Publish executables + uses: marvinpinto/action-automatic-releases@v1.2.1 with: repo_token: ${{ secrets.GITHUB_TOKEN }} automatic_release_tag: latest title: latest prerelease: false - files: build/deploy/*.AppImage + files: | + executables/*.AppImage + diff --git a/CMakeLists.txt b/CMakeLists.txt index 15656007..fbc674e0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,7 +9,7 @@ include(Options) project(linuxdeployqt LANGUAGES CXX - VERSION 2.5.1 + VERSION 2.5.2 HOMEPAGE_URL omergoktas.com DESCRIPTION "Qt dependency deployment tool for Linux." ) diff --git a/cmake/Deploy.cmake b/cmake/Deploy.cmake index 10dee8d7..28927cb5 100644 --- a/cmake/Deploy.cmake +++ b/cmake/Deploy.cmake @@ -25,42 +25,42 @@ function(deploy TARGET) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/deploy/icon.desktop ${DEPLOY_PREFIX_PATH}/${TARGET}.desktop @ONLY) - add_custom_command(TARGET deploy VERBATIM + add_custom_command(TARGET deploy VERBATIM POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/deploy/icon.svg ${DEPLOY_PREFIX_PATH}/${TARGET}.svg ) - add_custom_command(TARGET deploy VERBATIM + add_custom_command(TARGET deploy VERBATIM POST_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory ${DEPLOY_PREFIX_PATH}/usr/bin ${DEPLOY_PREFIX_PATH}/usr/lib ) - add_custom_command(TARGET deploy VERBATIM + add_custom_command(TARGET deploy VERBATIM POST_BUILD COMMAND ${APPIMAGETOOL_EXECUTABLE} --appimage-extract WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} ) - add_custom_command(TARGET deploy VERBATIM + add_custom_command(TARGET deploy VERBATIM POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_BINARY_DIR}/squashfs-root/usr/bin ${DEPLOY_PREFIX_PATH}/usr/bin ) - add_custom_command(TARGET deploy VERBATIM + add_custom_command(TARGET deploy VERBATIM POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_BINARY_DIR}/squashfs-root/usr/lib ${DEPLOY_PREFIX_PATH}/usr/lib ) - add_custom_command(TARGET deploy VERBATIM + add_custom_command(TARGET deploy VERBATIM POST_BUILD COMMAND ${CMAKE_COMMAND} -E rm -f ${DEPLOY_PREFIX_PATH}/usr/bin/AppRun ) - add_custom_command(TARGET deploy VERBATIM + add_custom_command(TARGET deploy VERBATIM POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different ${PATCHELF_EXECUTABLE} $ ${DEPLOY_PREFIX_PATH}/usr/bin ) - add_custom_command(TARGET deploy VERBATIM + add_custom_command(TARGET deploy VERBATIM POST_BUILD COMMAND ARCH=${CMAKE_SYSTEM_PROCESSOR} $ ${DEPLOY_PREFIX_PATH}/usr/bin/$ -appimage -no-translations -qmake=${QMAKE_EXECUTABLE}