From 7bfc3f44c9276b3a7c8f924f5ff9e491ab439a7b Mon Sep 17 00:00:00 2001 From: WerWolv Date: Tue, 22 Jul 2025 18:02:35 +0200 Subject: [PATCH] git: Added Flatpak CI --- .github/workflows/build.yml | 55 ++++++++++++ dist/flatpak/net.werwolv.ImHex.yaml | 127 ++++++++++++++++++++++++++++ 2 files changed, 182 insertions(+) create mode 100644 dist/flatpak/net.werwolv.ImHex.yaml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ca9ec17db..0424e5b3d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1129,6 +1129,61 @@ jobs: name: Snap ${{ matrix.architecture }} path: ${{ steps.snapcraft.outputs.snap }} + flatpak-build: + strategy: + fail-fast: false + matrix: + include: + - architecture: "x86_64" + flatpak_arch: "x86_64" + image: ubuntu-24.04 + - architecture: "arm64" + flatpak_arch: "aarch64" + image: ubuntu-24.04-arm + name: 🐧 Flatpak ${{ matrix.architecture }} + runs-on: ${{ matrix.image }} + + permissions: + id-token: write + attestations: write + + steps: + - name: ⬇️ Install setup dependencies + run: | + sudo apt update && sudo apt install -y git curl flatpak-builder + + - name: 🧰 Checkout + uses: actions/checkout@v4 + with: + submodules: recursive + + - name: 📜 Set version variable + run: | + echo "IMHEX_VERSION=`cat VERSION`" >> $GITHUB_ENV + + - name: 🛠️ Build + uses: flatpak/flatpak-github-actions/flatpak-builder@v6 + with: + bundle: imhex-${{ env.IMHEX_VERSION }}-${{ matrix.architecture }}.flatpak + manifest-path: dist/flatpak/net.werwolv.ImHex.yaml + cache-key: flatpak-builder-${{ matrix.architecture }}-${{ github.sha }} + arch: ${{ matrix.flatpak_arch }} + + - name: 🗝️ Generate build provenance attestations + uses: actions/attest-build-provenance@v2 + if: ${{ github.event.repository.fork == false && github.event_name != 'pull_request' }} + with: + subject-path: | + imhex-${{ env.IMHEX_VERSION }}-${{ matrix.architecture }}.flatpak + + - name: ⬆️ Upload Flatpak + uses: actions/upload-artifact@v4 + with: + if-no-files-found: error + name: ${{ matrix.name }} ${{ matrix.release_num }} Flatpak ${{ matrix.architecture }} + path: | + imhex-${{ env.IMHEX_VERSION }}-${{ matrix.architecture }}.flatpak + webassembly-build: runs-on: ubuntu-24.04 name: 🌍 Web diff --git a/dist/flatpak/net.werwolv.ImHex.yaml b/dist/flatpak/net.werwolv.ImHex.yaml new file mode 100644 index 000000000..130c75bbb --- /dev/null +++ b/dist/flatpak/net.werwolv.ImHex.yaml @@ -0,0 +1,127 @@ +app-id: net.werwolv.ImHex +runtime: org.freedesktop.Platform +runtime-version: '24.08' +sdk: org.freedesktop.Sdk +command: imhex +rename-desktop-file: imhex.desktop + +finish-args: + - --share=ipc + - --share=network + - --socket=wayland + - --socket=fallback-x11 + - --filesystem=host + - --device=dri + +modules: + - name: glfw + buildsystem: cmake-ninja + builddir: true + config-opts: + - -DBUILD_SHARED_LIBS=ON + - -DGLFW_BUILD_EXAMPLES=OFF + - -DGLFW_BUILD_TESTS=OFF + - -DGLFW_BUILD_DOCS=OFF + sources: + - type: archive + url: https://github.com/glfw/glfw/releases/download/3.4/glfw-3.4.zip + sha256: b5ec004b2712fd08e8861dc271428f048775200a2df719ccf575143ba749a3e9 + cleanup: + - /include + - /lib/pkgconfig + - /lib/pkgconfig + - /lib64/pkgconfig + - /lib/cmake + - /lib64/cmake + + - name: mbedtls + buildsystem: cmake-ninja + config-opts: + - -DCMAKE_C_FLAGS=-fPIC + - -DENABLE_TESTING=OFF + - -DENABLE_PROGRAMS=OFF + sources: + - type: archive + url: https://github.com/ARMmbed/mbedtls/archive/refs/tags/v3.4.0.tar.gz + sha256: 1b899f355022e8d02c4d313196a0a16af86c5a692456fa99d302915b8cf0320a + cleanup: + - /include + - /lib/pkgconfig + - /lib64/pkgconfig + - /lib/cmake + - /lib64/cmake + + - name: fmt + buildsystem: cmake-ninja + config-opts: + - -DBUILD_SHARED_LIBS=ON + - -DFMT_TEST=OFF + sources: + - type: archive + url: https://github.com/fmtlib/fmt/releases/download/10.0.0/fmt-10.0.0.zip + sha256: 4943cb165f3f587f26da834d3056ee8733c397e024145ca7d2a8a96bb71ac281 + cleanup: + - /include + - /lib/pkgconfig + - /lib64/pkgconfig + - /lib/cmake + - /lib64/cmake + + - name: yara + buildsystem: autotools + sources: + - type: git + url: https://github.com/VirusTotal/yara.git + tag: v4.3.1 + commit: a6f6ce1d6d74a03c396660db25765f2a794d9e30 + cleanup: + - /include + - /lib/pkgconfig + - /lib64/pkgconfig + - /lib/cmake + - /lib64/cmake + + - name: libssh2 + buildsystem: cmake-ninja + config-opts: + - -DBUILD_SHARED_LIBS=ON + - -DENABLE_ZLIB_COMPRESSION=OFF + - -DENABLE_MANUAL=OFF + - -DENABLE_EXAMPLES=OFF + - -DENABLE_TESTING=OFF + sources: + - type: git + url: https://github.com/libssh2/libssh2.git + tag: libssh2-1.11.1 + cleanup: + - /include + - /lib/pkgconfig + - /lib64/pkgconfig + - /lib/cmake + - /lib64/cmake + + - name: imhex + buildsystem: cmake-ninja + builddir: true + config-opts: + - -DUSE_SYSTEM_CURL=ON + - -DUSE_SYSTEM_FMT=ON + - -DUSE_SYSTEM_YARA=ON + - -DIMHEX_OFFLINE_BUILD=ON + - -DCMAKE_INSTALL_LIBDIR=lib + - -DCMAKE_INSTALL_RPATH='$ORIGIN/../lib:$ORIGIN/../lib64' + sources: + - type: dir + path: ../.. + - type: git + url: https://github.com/WerWolv/ImHex-Patterns.git + tag: master + dest: ImHex-Patterns + x-checker-data: + type: git + tag-pattern: ^ImHex-v([\d.]+)$ + post-install: + - mv ${FLATPAK_DEST}/share/metainfo/net.werwolv.imhex.metainfo.xml ${FLATPAK_DEST}/share/metainfo/net.werwolv.ImHex.metainfo.xml + - mkdir -p ${FLATPAK_DEST}/share/icons/hicolor/scalable/apps + - cp ${FLATPAK_DEST}/share/pixmaps/imhex.svg ${FLATPAK_DEST}/share/icons/hicolor/scalable/apps/${FLATPAK_ID}.svg + - desktop-file-edit --set-key="Icon" --set-value="${FLATPAK_ID}" "${FLATPAK_DEST}/share/applications/imhex.desktop"