diff --git a/.github/workflows/flatpak-snapshot.yml b/.github/workflows/flatpak-snapshot.yml new file mode 100644 index 000000000..37e0eacc2 --- /dev/null +++ b/.github/workflows/flatpak-snapshot.yml @@ -0,0 +1,66 @@ +name: Build Flatpak Snapshot + +on: + push: + branches: + - flatpak-snapshot + workflow_dispatch: + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + permissions: + contents: write + steps: + # 1. Checkout repo + - name: Checkout + uses: actions/checkout@v4 + + # 2. Set up Flatpak + - name: Install Flatpak + run: | + sudo apt update + sudo apt install -y flatpak flatpak-builder git wget xz-utils + + - name: Cache Flatpak SDK + if: always() + uses: actions/cache@v3 + with: + path: ~/.local/share/flatpak + key: flatpak-sdk-48-${{ runner.os }} + + # 3. Install GNOME SDK runtime + - name: Install GNOME SDK + run: | + sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo + sudo flatpak install --noninteractive flathub org.freedesktop.Sdk//25.08 org.freedesktop.Platform//25.08 + + # 4. Determine snapshot version from Git + - name: Set snapshot version + id: vars + run: | + SHORT_HASH=$(git rev-parse --short HEAD) + VERSION="0.10.0~git${SHORT_HASH}" + echo "VERSION=${VERSION}" >> $GITHUB_ENV + echo "Snapshot version set to ${VERSION}" + + # 5. Build Flatpak + - name: Build Flatpak + run: | + flatpak-builder --force-clean build-dir scripts/flatpak/io.github.iptux_src.iptux.snapshot.yml + + # 6. Export repository to repo/ + - name: Export Flatpak repo + run: | + flatpak build-export repo build-dir --collection-id=io.github.iptux + + # 7. Commit & push to gh-pages + - name: Deploy to GitHub Pages + uses: peaceiris/actions-gh-pages@v4 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: repo + publish_branch: gh-pages + user_name: "GitHub Actions" + user_email: "actions@github.com" + commit_message: "Update Flatpak snapshot: ${{ env.VERSION }}" diff --git a/scripts/flatpak/io.github.iptux_src.iptux.snapshot.yml b/scripts/flatpak/io.github.iptux_src.iptux.snapshot.yml new file mode 100644 index 000000000..9b88ec50f --- /dev/null +++ b/scripts/flatpak/io.github.iptux_src.iptux.snapshot.yml @@ -0,0 +1,37 @@ +app-id: io.github.iptux_src.iptux +runtime: org.freedesktop.Platform +runtime-version: '25.08' +sdk: org.freedesktop.Sdk +command: iptux +finish-args: + - --share=network + - --share=ipc + - --socket=fallback-x11 + - --socket=wayland + - --filesystem=home + +modules: + - name: libsigc++ + buildsystem: meson + sources: + - type: archive + url: https://download.gnome.org/sources/libsigc++/2.10/libsigc++-2.10.8.tar.xz + sha256: 235a40bec7346c7b82b6a8caae0456353dc06e71f14bc414bcc858af1838719a + + - name: jsoncpp + buildsystem: meson + sources: + - type: archive + url: https://github.com/open-source-parsers/jsoncpp/archive/1.9.5.tar.gz + sha256: f409856e5920c18d0c2fb85276e24ee607d2a09b5e7d5f0a371368903c275da2 + + # - "shared-modules/libayatana-appindicator/libayatana-appindicator-gtk3.json" + + - name: iptux + buildsystem: meson + sources: + - type: git + url: https://github.com/iptux-src/iptux.git + branch: flatpak-snapshot + config-opts: + - --buildtype=release \ No newline at end of file diff --git a/src/iptux/LogSystem.cpp b/src/iptux/LogSystem.cpp index e6afd88a5..3fd703a5c 100644 --- a/src/iptux/LogSystem.cpp +++ b/src/iptux/LogSystem.cpp @@ -12,6 +12,7 @@ #include "config.h" #include "LogSystem.h" +#include "iptux-utils/output.h" #include #include @@ -84,7 +85,9 @@ void LogSystem::communicateLogv(const MsgPara* msgpara, msg = g_strdup_vprintf(fmt, ap); log = g_strdup_printf("%s\n%s\n%s\n%s\n\n", LOG_START_HEADER, ptr, msg, LOG_END_HEADER); - write(fdc, log, strlen(log)); + if (write(fdc, log, strlen(log)) < 0) { + LOG_WARN("Write communicate log failed!"); + } g_free(log); g_free(ptr); g_free(msg); @@ -104,7 +107,9 @@ void LogSystem::systemLogv(const char* fmt, va_list ap) { g_free(ptr); g_free(msg); - write(fds, log, strlen(log)); + if (write(fds, log, strlen(log)) < 0) { + LOG_WARN("Write system log failed!"); + } g_free(log); }