Merge flatpak and appimage builders

This commit is contained in:
Hanh 2023-03-03 21:11:45 +10:00
parent 31ae8d3579
commit d26a045863
13 changed files with 67 additions and 194 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 .

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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"]

View File

@ -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

View File

@ -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