From eacb8db96ad86fe2b0bdd292b03ba9b10569b0ce Mon Sep 17 00:00:00 2001 From: Martin Marmsoler Date: Mon, 19 Jun 2023 16:38:29 +0200 Subject: [PATCH] appimagetool --- .github/workflows/build.yml | 363 +++++++++--------------------------- 1 file changed, 83 insertions(+), 280 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c1fe997d6..f71eee784 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,109 +17,6 @@ env: jobs: - formatting-check: - name: Formatting Check - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Run clang-format style check for C/C++/Protobuf programs. - uses: jidicula/clang-format-action@v4.8.0 - with: - clang-format-version: '13' - exclude-regex: 'dep' - - - name: Check CMake code style - run: | - pip install cmake-format==0.6.13 && \ - find \( -type d -path './dep/*/*' -prune \) -o \( -name CMakeLists.txt -exec cmake-format --check {} + \) - - flatpak: - name: "Flatpak" - runs-on: ubuntu-latest - container: - # image: bilelmoussaoui/flatpak-github-actions:kde-5.15-21.08 - image: archlinux:latest - options: --privileged - steps: - - - name: Update - run: | - pacman --noconfirm -Suy - pacman --noconfirm -S flatpak flatpak-builder xorg-server-xvfb - flatpak install --assumeyes org.kde.Sdk//5.15-21.08 - flatpak install --assumeyes org.freedesktop.Sdk.Extension.golang//21.08 - flatpak install --assumeyes org.kde.Platform//5.15-21.08 - - - name: Show environment variables - run: > - echo IS_RELEASE: ${{ env.IS_RELEASE }} - - # https://stackoverflow.com/questions/60916931/github-action-does-the-if-have-an-else - - name: Determine flatpak release branch - uses: haya14busa/action-cond@v1 - id: flatpak_release_branch - with: - cond: ${{ env.IS_RELEASE }} - if_true: 'stable' - if_false: 'development' - - - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Clone flatpak manifest from Flathub - uses: GuillaumeFalourd/clone-github-repo-action@v2 - with: - owner: 'flathub' - repository: 'com.github.Murmele.Gittyup' - - - name: Replace git tag by the commit id on which it runs - if: github.ref_type != 'tag' - run: > - sed -i 's@tag: .*@commit: "${{ (github.event.pull_request && github.event.pull_request.head.sha) || github.sha }}"@' com.github.Murmele.Gittyup/com.github.Murmele.Gittyup.yml - - - name: Use correct git tag - if: github.ref_type == 'tag' - run: > - sed -i 's@tag: .*$@tag: "${{ github.ref_name }}"@' com.github.Murmele.Gittyup/com.github.Murmele.Gittyup.yml - - - name: Replace source url - run: > - sed -i "s@url: .*Gittyup.git@url: $GITHUB_SERVER_URL/$GITHUB_REPOSITORY@" com.github.Murmele.Gittyup/com.github.Murmele.Gittyup.yml - - - name: Add dev build marker to cmake options - if: github.ref_type != 'tag' - run: > - sed -i 's@config-opts: \["\(.*\)"\]@config-opts: ["\1", "-DDEV_BUILD=${{ github.ref_name }}"]@' com.github.Murmele.Gittyup/com.github.Murmele.Gittyup.yml - - - name: Replace desktop file name suffix - if: github.ref_type != 'tag' - run: > - sed -i 's@desktop-file-name-suffix: ""@desktop-file-name-suffix: " (Development)"@' com.github.Murmele.Gittyup/com.github.Murmele.Gittyup.yml - - - name: Enable automatic update - if: github.ref_type != 'tag' - run: > - sed -i 's@-DENABLE_UPDATE_OVER_GUI=OFF@-DENABLE_UPDATE_OVER_GUI=ON@' com.github.Murmele.Gittyup/com.github.Murmele.Gittyup.yml - - - name: Show Flatpak manifest - run: cat com.github.Murmele.Gittyup/com.github.Murmele.Gittyup.yml - - - name: Build package - uses: bilelmoussaoui/flatpak-github-actions/flatpak-builder@v4 - with: - bundle: Gittyup.flatpak - manifest-path: com.github.Murmele.Gittyup/com.github.Murmele.Gittyup.yml - cache: false - branch: ${{ steps.flatpak_release_branch.outputs.value }} - - - name: Publish build artifacts - uses: actions/upload-artifact@v2 - with: - path: com.github.Murmele.Gittyup/* - name: Gittyup Flatpak - - build: runs-on: ${{ matrix.env.os }} strategy: @@ -129,65 +26,26 @@ jobs: - version: 5.15.2 check_only: false - - version: 5.12.0 - check_only: true - env: - - name: linux - os: ubuntu-latest + - name: linux_appimage + os: ubuntu-20.04 ninja_platform: linux qt_platform: linux openssl_arch: linux-x86_64 - cmake_flags: "-DGENERATE_APPDATA=ON" - cmake_env: {} - - - name: macos - os: macos-latest - ninja_platform: mac - qt_platform: mac - openssl_arch: darwin64-x86_64-cc - cmake_env: {} - pack: 1 - - - name: win64 - os: windows-latest - ninja_platform: win - qt_platform: windows - qt_arch: win64_msvc2019_64 - qt_arch_check_only: win64_msvc2017_64 - openssl_arch: VC-WIN64A - msvc_arch: x64 - cmake_flags: "-DUSE_BUNDLED_ZLIB=1" - cmake_env: - CMAKE_RC_FLAGS: "/C 1252" - CC: clang - CXX: clang++ + cmake_flags: "-DGENERATE_APPDATA=ON -DCMAKE_INSTALL_PREFIX=/usr" pack: 1 + cmake_env: {} - - name: win32 - os: windows-latest - ninja_platform: win - qt_platform: windows - qt_arch: win32_msvc2019 - qt_arch_check_only: win32_msvc2017 - openssl_arch: VC-WIN32 - msvc_arch: x86 - cmake_flags: "-DUSE_BUNDLED_ZLIB=1" - cmake_env: - CMAKE_RC_FLAGS: "/C 1252" - CC: clang - CXX: clang++ - CMAKE_C_FLAGS: -m32 - CMAKE_CXX_FLAGS: -m32 + - name: linux_appimage + os: ubuntu-latest + ninja_platform: linux + qt_platform: linux + openssl_arch: linux-x86_64 + cmake_flags: "-DGENERATE_APPDATA=ON -DCMAKE_INSTALL_PREFIX=/usr" pack: 1 + cmake_env: {} steps: - # otherwise the testcases will fail, because signature is invalid - - name: Set git name and email - run: | - git config --global user.name "Your Name" - git config --global user.email "youremail@yourdomain.com" - git config --list - name: Configure development build if: github.ref_type != 'tag' uses: allenevans/set-env@c4f231179ef63887be707202a295d9cb1c687eb9 @@ -218,18 +76,6 @@ jobs: install-deps: true modules: qtwebengine - - name: Install Qt - uses: jurplel/install-qt-action@v2.13.0 - timeout-minutes: 10 - if: matrix.qt.check_only - with: - version: ${{ matrix.qt.version }} - target: desktop - host: ${{ matrix.env.qt_platform }} - arch: ${{ matrix.env.qt_arch_check_only }} - install-deps: true - modules: qtwebengine - - name: Install Ninja uses: seanmiddleditch/gha-setup-ninja@v3 with: @@ -237,16 +83,6 @@ jobs: platform: ${{ matrix.env.ninja_platform }} destination: ninja - - name: Setup MSVC environment - if: matrix.env.ninja_platform == 'win' - uses: seanmiddleditch/gha-setup-vsdevenv@v3 - with: - arch: ${{ matrix.env.msvc_arch }} - - - name: Install NASM - if: matrix.env.ninja_platform == 'win' - uses: ilammy/setup-nasm@v1.2.0 - - name: Build OpenSSL (Linux) if: matrix.env.ninja_platform == 'linux' run: | @@ -254,25 +90,6 @@ jobs: ./config -fPIC make - - name: Build OpenSSL (macOS) - if: matrix.env.ninja_platform == 'mac' - run: | - cd dep/openssl/openssl - - # this is necessary until https://github.com/openssl/openssl/issues/18720 - # is fixed in OpenSSL 1.1.1r - export CFLAGS=-Wno-error=implicit-function-declaration - - ./Configure ${{ matrix.env.openssl_arch }} no-shared - make - - - name: Build OpenSSL (Windows) - if: matrix.env.ninja_platform == 'win' - run: | - cd dep/openssl/openssl - perl Configure ${{ matrix.env.openssl_arch }} - nmake - - name: Configure Release env: ${{ matrix.env.cmake_env }} run: | @@ -292,18 +109,6 @@ jobs: cd build/release ninja package - # Command copied from flathub build process - - name: Validate appdata file - if: matrix.env.ninja_platform == 'linux' && !matrix.qt.check_only - run: | - echo "Show generated appdata file" - cat ./build/release/rsrc/linux/com.github.Murmele.Gittyup.appdata.xml - echo "Start validating appdata file" - sudo apt install flatpak - sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo - sudo flatpak install -y org.freedesktop.appstream-glib - flatpak run --env=G_DEBUG=fatal-criticals org.freedesktop.appstream-glib validate ./build/release/rsrc/linux/com.github.Murmele.Gittyup.appdata.xml - - name: Publish build artifacts if: matrix.env.pack && !matrix.qt.check_only uses: actions/upload-artifact@v3 @@ -318,91 +123,89 @@ jobs: path: build/release/VERSION.txt name: Gittyup-VERSION - - name: Test - if: matrix.env.ninja_platform != 'win' && matrix.env.ninja_platform != 'mac' - uses: GabrielBB/xvfb-action@v1 - with: - working-directory: build/release - run: ninja check --verbose - - - name: Test (Windows) - if: matrix.env.ninja_platform == 'win' + - name: Install + if: matrix.env.ninja_platform == 'linux' && !matrix.qt.check_only run: | cd build/release - ninja check_no_win32_offscreen - - publish: - # https://github.com/marvinpinto/actions/issues/177 - needs: [flatpak, build] - runs-on: ubuntu-latest # does not matter which - # a prerelase is created when pushing to master - # a release is created when a tag will be set - # last condition is the same as IS_RELEASE, - # but environment variables cannot be used outside of steps - # so it was copied to here too - if: ${{ github.ref == 'refs/heads/master' || (github.event_name == 'push' && github.ref_type == 'tag' && startswith(github.ref_name, 'gittyup_v')) }} - steps: - - name: Download artifacts - uses: actions/download-artifact@v3 + mkdir -p AppDir + DESTDIR=AppDir ninja install + + - name: Publish LinuxInstall + if: matrix.env.ninja_platform == 'linux' && !matrix.qt.check_only + uses: actions/upload-artifact@v3 with: - path: artifacts + path: build/release/AppDir + name: Gittyup LinuxInstall - - name: list artifacts folder + - name: Install linuxdeployqt + if: matrix.env.ninja_platform == 'linux' run: | - echo "Show artifacts folder:" - ls artifacts - echo "Show artifacts/Gittyup Flatpak folder:" - ls "artifacts/Gittyup Flatpak" - echo "Show artifacts/Gittyup-x86_64:" - ls "artifacts/Gittyup-x86_64" - echo "Show artifacts/Gittyup VERSION" - ls "artifacts/Gittyup-VERSION" - - # version is exported from cmake to file - - name: Retrieve version + sudo apt-get -y install git g++ libgl1-mesa-dev + git clone https://github.com/probonopd/linuxdeployqt.git + cd linuxdeployqt + qmake + sudo make install + + - name: Install patchelf + if: matrix.env.ninja_platform == 'linux' run: | - echo "::set-output name=VERSION::$(cat artifacts/Gittyup-VERSION/VERSION.txt)" - id: version + wget https://nixos.org/releases/patchelf/patchelf-0.9/patchelf-0.9.tar.bz2 + tar xf patchelf-0.9.tar.bz2 + ( cd patchelf-0.9/ && ./configure && make && sudo make install ) - - name: Update GitHub release (latest tag) - uses: marvinpinto/action-automatic-releases@latest + - name: Install appimage tool + if: matrix.env.ninja_platform == 'linux' + run: | + sudo wget -c "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage" -O /usr/local/bin/appimagetool + sudo chmod a+x /usr/local/bin/appimagetool + + + - name: Build Appimage + if: matrix.env.ninja_platform == 'linux' + run: | + cd build/release + sudo apt -y install appstream + sudo apt -y install libfuse2 + sudo apt -y install libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-shape0 + sudo apt -y install libxcb-shm0 libxcb-sync1 libxcb-util1 libxcb-xinerama0 libxcb-xinput0 libxcb-xkb1 libxcb-xrm0 libxcb-xv0 libxcb-xvmc0 libxcb1 + + wget -c https://github.com/$(wget -q https://github.com/probonopd/go-appimage/releases/expanded_assets/continuous -O - | grep "appimagetool-.*-x86_64.AppImage" | head -n 1 | cut -d '"' -f 2) + chmod +x appimagetool-*.AppImage + ./appimagetool-*.AppImage -s deploy ./AppDir/usr/share/applications/*.desktop # Bundle EVERYTHING + # and + VERSION=1.0 ./appimagetool-*.AppImage ./Some.AppDir # turn AppDir into AppImage + + - name: Publish LinuxInstall + if: matrix.env.ninja_platform == 'linux' + uses: actions/upload-artifact@v3 with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - prerelease: true - title: 'Latest Build (Development)' - automatic_release_tag: 'development' - files: | - **/artifacts/Gittyup win64/Gittyup*.exe - **/artifacts/Gittyup win32/Gittyup*.exe - **/artifacts/Gittyup macos/Gittyup*.dmg - **/artifacts/Gittyup Flatpak/com.github.Murmele.Gittyup.yml - **/Gittyup-x86_64/*.flatpak + path: build/release/AppDir + name: Gittyup LinuxInstall Appimage - - name: Update GitHub release (version tag) - uses: marvinpinto/action-automatic-releases@latest - if: ${{ env.IS_RELEASE == 'true'}} + - name: Publish LinuxDeploy + if: matrix.env.ninja_platform == 'linux' + uses: actions/upload-artifact@v3 with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - prerelease: false - title: Gittyup Release ${{ steps.version.outputs.VERSION }} - automatic_release_tag: ${{ github.ref_name }} - files: | - **/artifacts/Gittyup win64/Gittyup*.exe - **/artifacts/Gittyup win32/Gittyup*.exe - **/artifacts/Gittyup macos/Gittyup*.dmg - **/artifacts/Gittyup Flatpak/com.github.Murmele.Gittyup.yml - **/Gittyup-x86_64/*.flatpak + path: build/release/AppDir + name: Gittyup LinuxDeploy - # needed otherwise the docs folder is not available - - name: Checkout repository - if: ${{ env.IS_RELEASE == 'true'}} - uses: actions/checkout@v3 + - name: Publish Appimage + if: matrix.env.ninja_platform == 'linux' + uses: actions/upload-artifact@v3 + with: + path: build/release/*.AppImage + name: Gittyup Appimage - # update github pages only if it is a release - - name: Deploy Github pages - if: ${{ env.IS_RELEASE == 'true'}} - uses: JamesIves/github-pages-deploy-action@v4.4.0 + - name: Test + if: matrix.env.ninja_platform != 'win' && matrix.env.ninja_platform != 'mac' + uses: GabrielBB/xvfb-action@v1 with: - branch: gh-pages # The branch the action should deploy to. - folder: docs # The folder the action should deploy. + working-directory: build/release + run: ninja check --verbose + + - name: Test (Windows) + if: matrix.env.ninja_platform == 'win' + run: | + cd build/release + ninja check_no_win32_offscreen ...