From d26a0458633009c8bf0c1e315510653c70fd6133 Mon Sep 17 00:00:00 2001 From: Hanh Date: Fri, 3 Mar 2023 21:11:45 +1000 Subject: [PATCH] Merge flatpak and appimage builders --- .github/workflows/build-appimage.yml | 68 ---------------------------- .github/workflows/build-flatpak.yml | 37 --------------- .github/workflows/build-linux.yml | 27 +++++++++-- build-scripts/build-appimage.sh | 8 ++++ build-scripts/build-flatpak.sh | 10 ++-- build-scripts/build-flatpak2.sh | 5 -- build-scripts/build-linux.sh | 26 +++++++++-- build-scripts/build-linux2.sh | 20 -------- docker/Dockerfile-builder-flatpak | 1 + docker/Dockerfile-builder-win | 14 ------ docker/Dockerfile-flatpak | 39 ++++------------ misc/AppImageBuilder.yml | 3 +- misc/me.hanh.zwallet.Ywallet.yml | 3 +- 13 files changed, 67 insertions(+), 194 deletions(-) delete mode 100644 .github/workflows/build-appimage.yml delete mode 100644 .github/workflows/build-flatpak.yml create mode 100755 build-scripts/build-appimage.sh delete mode 100755 build-scripts/build-flatpak2.sh delete mode 100644 build-scripts/build-linux2.sh delete mode 100644 docker/Dockerfile-builder-win diff --git a/.github/workflows/build-appimage.yml b/.github/workflows/build-appimage.yml deleted file mode 100644 index c67cda5..0000000 --- a/.github/workflows/build-appimage.yml +++ /dev/null @@ -1,68 +0,0 @@ -name: Build and Release AppImage / Linux - -on: - workflow_dispatch: - push: - tags: - - "v*" - -jobs: - build_appimage: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - submodules: recursive - - - name: env - run: | - cat build.env >> $GITHUB_ENV - echo $PWD/flutter/bin >> $GITHUB_PATH - - - name: appimage tool - run: | - sudo apt-get update - sudo apt-get install -y binutils coreutils desktop-file-utils fakeroot fuse libgdk-pixbuf2.0-dev patchelf python3-pip python3-setuptools squashfs-tools strace util-linux zsync - sudo wget https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage -O /usr/local/bin/appimagetool - sudo chmod +x /usr/local/bin/appimagetool - sudo pip3 install appimage-builder - - - name: params - run: | - mkdir $HOME/.zcash-params - curl https://download.z.cash/downloads/sapling-output.params --output $HOME/.zcash-params/sapling-output.params - curl https://download.z.cash/downloads/sapling-spend.params --output $HOME/.zcash-params/sapling-spend.params - - - name: wget flutter - run: | - git clone -b "${{ env.FLUTTER_VERSION }}" --depth 1 https://github.com/flutter/flutter.git flutter - echo $PATH - flutter doctor -v - - - name: Build dylib - run: | - cargo install cargo-make - cargo make flatpak - - - name: install deps - run: | - sudo apt-get install -y libunwind-dev - sudo apt-get install -y clang cmake ninja-build libgtk-3-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libsecret-1-dev libjsoncpp-dev - - - name: Build flutter - run: | - flutter pub get - flutter pub run build_runner build - (cd packages/warp_api_ffi;flutter pub get;flutter pub run build_runner build) - flutter build linux - - - name: appimage - run: | - (cd misc;appimage-builder --recipe AppImageBuilder.yml;ls) - - - name: Release - uses: softprops/action-gh-release@v1 - if: startsWith(github.ref, 'refs/tags/v') - with: - files: | - ./misc/Ywallet-latest-x86_64.AppImage diff --git a/.github/workflows/build-flatpak.yml b/.github/workflows/build-flatpak.yml deleted file mode 100644 index bf50d32..0000000 --- a/.github/workflows/build-flatpak.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: Build and Release Flatpak - -on: - workflow_dispatch: - push: - tags: - - "v*" - -jobs: - build_flatpak: - name: Build flatpak - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - submodules: recursive - - - name: env - run: | - cat build.env >> $GITHUB_ENV - - - name: Set up Docker Buildx - id: buildx - uses: docker/setup-buildx-action@v1 - - - name: Build flatpak - run: | - ./build-scripts/build-flatpak.sh "${{ env.FLUTTER_VERSION }}" - - - name: Release - uses: softprops/action-gh-release@v1 - if: startsWith(github.ref, 'refs/tags/v') - with: - files: | - ./ywallet.flatpak - ./zwallet.tgz - ./libwarp_api_ffi.so diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml index fbfba19..95ee348 100644 --- a/.github/workflows/build-linux.yml +++ b/.github/workflows/build-linux.yml @@ -1,4 +1,4 @@ -name: Build only Linux +name: Build and Release Linux AppImage/Flatpak on: workflow_dispatch: @@ -7,8 +7,8 @@ on: - "v*" jobs: - build_flatpak: - name: Build flatpak + build: + name: Build runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -18,7 +18,26 @@ jobs: - name: env run: | cat build.env >> $GITHUB_ENV + echo $PWD/flutter/bin >> $GITHUB_PATH - name: Build + run: ./build-scripts/build-linux.sh "${{ env.FLUTTER_VERSION }}" + + - name: appimage + run: ./build-scripts/build-appimage.sh + + - name: Flatpak run: | - ./build-scripts/build-linux2.sh "${{ env.FLUTTER_VERSION }}" "/root" + docker build -f docker/Dockerfile-flatpak -t zwallet_flatpak_sh . + docker run --privileged --name zwallet_flatpak_bin zwallet_flatpak_sh + docker cp zwallet_flatpak_bin:/root/misc/ywallet.flatpak . + + - name: Release + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/v') + with: + files: | + ./misc/Ywallet-latest-x86_64.AppImage + ./ywallet.flatpak + ./zwallet.tgz + ./libwarp_api_ffi.so diff --git a/build-scripts/build-appimage.sh b/build-scripts/build-appimage.sh new file mode 100755 index 0000000..8b1bcd1 --- /dev/null +++ b/build-scripts/build-appimage.sh @@ -0,0 +1,8 @@ +sudo apt-get install -y binutils coreutils desktop-file-utils fakeroot fuse libgdk-pixbuf2.0-dev patchelf python3-pip python3-setuptools squashfs-tools strace util-linux zsync +sudo wget https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage -O /usr/local/bin/appimagetool +sudo chmod +x /usr/local/bin/appimagetool +sudo pip3 install appimage-builder + +pushd misc +appimage-builder --recipe AppImageBuilder.yml +popd diff --git a/build-scripts/build-flatpak.sh b/build-scripts/build-flatpak.sh index c137565..2be5a9c 100755 --- a/build-scripts/build-flatpak.sh +++ b/build-scripts/build-flatpak.sh @@ -1,9 +1,5 @@ #!/bin/sh -docker rm zwallet_flatpak_sh -docker rm zwallet_flatpak_bin -docker build -f docker/Dockerfile-flatpak -t zwallet_flatpak_sh --build-arg FLUTTER_VERSION=$1 . -docker run --privileged --name zwallet_flatpak_bin zwallet_flatpak_sh -docker cp zwallet_flatpak_bin:/root/misc/ywallet.flatpak . -docker cp zwallet_flatpak_bin:/root/misc/root/zwallet.tgz . -docker cp zwallet_flatpak_bin:/root/misc/root/libwarp_api_ffi.so . +flatpak-builder --user --install --force-clean build-dir me.hanh.zwallet.Ywallet.yml +flatpak build-export /root/repo build-dir +flatpak build-bundle /root/repo ywallet.flatpak me.hanh.zwallet.Ywallet diff --git a/build-scripts/build-flatpak2.sh b/build-scripts/build-flatpak2.sh deleted file mode 100755 index 2be5a9c..0000000 --- a/build-scripts/build-flatpak2.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -flatpak-builder --user --install --force-clean build-dir me.hanh.zwallet.Ywallet.yml -flatpak build-export /root/repo build-dir -flatpak build-bundle /root/repo ywallet.flatpak me.hanh.zwallet.Ywallet diff --git a/build-scripts/build-linux.sh b/build-scripts/build-linux.sh index e454e7c..f534d65 100755 --- a/build-scripts/build-linux.sh +++ b/build-scripts/build-linux.sh @@ -1,8 +1,26 @@ -# apt-get install clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev -git config --global --add safe.directory /flutter -flutter config --enable-linux-desktop +FLUTTER_VERSION=$1 + +mkdir -p $HOME/.zcash-params +curl https://download.z.cash/downloads/sapling-output.params --output $HOME/.zcash-params/sapling-output.params +curl https://download.z.cash/downloads/sapling-spend.params --output $HOME/.zcash-params/sapling-spend.params + +git clone -b "$FLUTTER_VERSION" --depth 1 https://github.com/flutter/flutter.git flutter +flutter doctor -v + +sed -e 's/rlib/cdylib/' < native/zcash-sync/Cargo.toml >/tmp/out.toml +mv /tmp/out.toml native/zcash-sync/Cargo.toml + +cargo b -r --features=dart_ffi + +sudo apt-get install -y libunwind-dev +sudo apt-get install -y clang cmake ninja-build libgtk-3-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libsecret-1-dev libjsoncpp-dev + flutter pub get flutter pub run build_runner build -cargo make flatpak (cd packages/warp_api_ffi;flutter pub get;flutter pub run build_runner build) flutter build linux + +pushd build/linux/x64/release/bundle +tar cvzf $OLDPWD/zwallet.tgz * +popd +cp target/release/libwarp_api_ffi.so . diff --git a/build-scripts/build-linux2.sh b/build-scripts/build-linux2.sh deleted file mode 100644 index c7d1f88..0000000 --- a/build-scripts/build-linux2.sh +++ /dev/null @@ -1,20 +0,0 @@ -FLUTTER_VERSION=$1 -HOME=$2 - -mkdir -p $HOME/.zcash-params -curl https://download.z.cash/downloads/sapling-output.params --output $HOME/.zcash-params/sapling-output.params -curl https://download.z.cash/downloads/sapling-spend.params --output $HOME/.zcash-params/sapling-spend.params - -git clone -b "$FLUTTER_VERSION" --depth 1 https://github.com/flutter/flutter.git flutter -flutter doctor -v - -cargo install cargo-make -cargo make flatpak - -sudo apt-get install -y libunwind-dev -sudo apt-get install -y clang cmake ninja-build libgtk-3-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libsecret-1-dev libjsoncpp-dev - -flutter pub get -flutter pub run build_runner build -(cd packages/warp_api_ffi;flutter pub get;flutter pub run build_runner build) -flutter build linux diff --git a/docker/Dockerfile-builder-flatpak b/docker/Dockerfile-builder-flatpak index d24656e..3b87bc1 100644 --- a/docker/Dockerfile-builder-flatpak +++ b/docker/Dockerfile-builder-flatpak @@ -7,3 +7,4 @@ RUN apt-get install -yq curl gnupg2 flatpak flatpak-builder RUN flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo RUN flatpak install -y flathub org.freedesktop.Platform//22.08 org.freedesktop.Sdk//22.08 +RUN flatpak install -y flathub org.gnome.Platform//43 org.gnome.Sdk//43 diff --git a/docker/Dockerfile-builder-win b/docker/Dockerfile-builder-win deleted file mode 100644 index 2700ffc..0000000 --- a/docker/Dockerfile-builder-win +++ /dev/null @@ -1,14 +0,0 @@ -#syntax=docker/dockerfile:1.2 -FROM mcr.microsoft.com/windows/server:ltsc2022 - -SHELL ["cmd", "/S", "/C"] - -ADD https://aka.ms/vs/16/release/vs_buildtools.exe /vs_buildtools.exe - -RUN vs_buildtools.exe --quiet --wait --norestart --nocache \ - --installPath C:\BuildTools \ - --add Microsoft.Component.MSBuild \ - --add Microsoft.VisualStudio.Component.Windows10SDK.18362 \ - --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 \ - || IF "%ERRORLEVEL%"=="3010" EXIT 0 - diff --git a/docker/Dockerfile-flatpak b/docker/Dockerfile-flatpak index a879fbc..bf87be7 100644 --- a/docker/Dockerfile-flatpak +++ b/docker/Dockerfile-flatpak @@ -1,38 +1,15 @@ #syntax=docker/dockerfile:1.2 -FROM ubuntu:focal AS builder -ARG FLUTTER_VERSION -ENV PATH $PATH:/flutter/bin:/root/.cargo/bin -ENV HOME /root - -RUN apt-get update -RUN DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install tzdata -RUN apt-get install -y git curl unzip -RUN apt-get install -y clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev libgdk-pixbuf2.0-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libsecret-1-dev libjsoncpp-dev - -RUN mkdir -p /root/.zcash-params -RUN curl https://download.z.cash/downloads/sapling-output.params --output /root/.zcash-params/sapling-output.params -RUN curl https://download.z.cash/downloads/sapling-spend.params --output /root/.zcash-params/sapling-spend.params - -RUN curl --proto '=https' --tlsv1.3 https://sh.rustup.rs -sSf | sh -s -- -y -RUN rustup install stable -RUN cargo install cargo-make - -RUN git clone -b $FLUTTER_VERSION --depth 1 https://github.com/flutter/flutter.git /flutter -RUN flutter doctor -v - -COPY . /zwallet - -RUN cd /zwallet && ./build-scripts/build-linux.sh -RUN cd /zwallet/build/linux/x64/release/bundle && tar cvzf /zwallet.tgz * - FROM hhanh00/zwallet_builder_flatpak -COPY . /root -RUN mkdir /root/misc/root -COPY --from=builder /zwallet.tgz /root/misc/root/ -COPY --from=builder /zwallet/target/release/libwarp_api_ffi.so /root/misc/root/ +RUN mkdir -p /root/misc +COPY misc /root/misc +COPY build-scripts/build-flatpak.sh /root/misc +COPY assets/icon.png /root/misc + +COPY zwallet.tgz /root/misc/root/ +COPY libwarp_api_ffi.so /root/misc/root/ RUN mkdir /root/repo WORKDIR /root/misc -ENTRYPOINT ["/root/build-scripts/build-flatpak2.sh"] +ENTRYPOINT ["/root/misc/build-flatpak.sh"] diff --git a/misc/AppImageBuilder.yml b/misc/AppImageBuilder.yml index b3b3ac3..a5eb0d2 100644 --- a/misc/AppImageBuilder.yml +++ b/misc/AppImageBuilder.yml @@ -4,7 +4,7 @@ script: - rm -rf AppDir - mkdir -p AppDir/usr/share/icons/hicolor/256x256/apps - cp ../assets/icon.png AppDir/usr/share/icons/hicolor/256x256/apps/ywallet.png - - cp -r ../build/linux/x64/release/bundle/* AppDir + - tar xf ../zwallet.tgz -C AppDir - cp ../target/release/libwarp_api_ffi.so AppDir/lib AppDir: path: AppDir @@ -23,7 +23,6 @@ AppDir: include: - libgtk-3-0 - libgstreamer1.0 libgstreamer-plugins-base1.0 - - libjsoncpp25 libsecret-1-0 exclude: - humanity-icon-theme - hicolor-icon-theme diff --git a/misc/me.hanh.zwallet.Ywallet.yml b/misc/me.hanh.zwallet.Ywallet.yml index 813a409..71319de 100644 --- a/misc/me.hanh.zwallet.Ywallet.yml +++ b/misc/me.hanh.zwallet.Ywallet.yml @@ -9,7 +9,6 @@ finish-args: - --socket=fallback-x11 - --socket=wayland - --device=dri - - --filesystem=xdg-data/databases:create modules: - name: zwallet_build sources: @@ -33,7 +32,7 @@ modules: - type: file path: ywallet.metainfo.xml - type: file - path: ../assets/icon.png + path: icon.png buildsystem: simple build-commands: - install -Dp -m 644 icon.png /app/share/icons/hicolor/256x256/apps/me.hanh.zwallet.Ywallet.png