Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support more linux distributions #254

Merged
merged 38 commits into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
fd604cb
feat: build .AppImage asset
monkeyWie Oct 27, 2023
87de5e5
feat: build linux portable asset
monkeyWie Oct 27, 2023
a979c2c
ci: test
monkeyWie Oct 27, 2023
90292d5
ci: test
monkeyWie Oct 27, 2023
b78e838
fix
monkeyWie Oct 27, 2023
3b9031e
fix: appimage-builder bin
monkeyWie Oct 27, 2023
151eac7
fix: appimage-builder env
monkeyWie Oct 27, 2023
e477cc3
fix: appimage-builder skip-tests
monkeyWie Oct 27, 2023
923b4b3
feat: test snap
monkeyWie Oct 27, 2023
aba1ebd
feat: test snap
monkeyWie Oct 27, 2023
26a0700
fix
monkeyWie Oct 27, 2023
3d78b76
fix
monkeyWie Oct 27, 2023
289a1f4
fix
monkeyWie Oct 27, 2023
0997545
fix
monkeyWie Oct 27, 2023
9be9952
fix
monkeyWie Oct 27, 2023
634f934
fix
monkeyWie Oct 27, 2023
bd9e3c3
fix
monkeyWie Oct 27, 2023
7866cc0
fix
monkeyWie Oct 27, 2023
ebe8d51
fix
monkeyWie Oct 27, 2023
5fe7a1b
fix
monkeyWie Oct 27, 2023
916874d
fix
monkeyWie Oct 27, 2023
d58421e
Update build.yml
monkeyWie Oct 27, 2023
b0f8499
test
monkeyWie Oct 31, 2023
44fb137
test
monkeyWie Oct 31, 2023
c1c5d30
test
monkeyWie Oct 31, 2023
80d9d76
test
monkeyWie Oct 31, 2023
884cedf
test
monkeyWie Oct 31, 2023
a12b377
test
monkeyWie Oct 31, 2023
0d637b8
test
monkeyWie Oct 31, 2023
90559bf
test
monkeyWie Oct 31, 2023
87a84dd
test
monkeyWie Oct 31, 2023
8a45464
test
monkeyWie Oct 31, 2023
96b5b02
test
monkeyWie Nov 1, 2023
e4f1ae2
update
monkeyWie Nov 1, 2023
f7897c7
update
monkeyWie Nov 1, 2023
7d5756a
update
monkeyWie Nov 1, 2023
7362081
update
monkeyWie Nov 1, 2023
8e27a46
Merge branch 'main' into feat/more_linux_distribution
monkeyWie Nov 1, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ version-resolver:
- 'patch'
default: patch
template: |
## Changes
# Changes

$CHANGES

# 更新日志

$CHANGES
161 changes: 157 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ name: build

on:
workflow_dispatch:
inputs:
platform:
description: 'Build platform'
required: true
default: 'all'

env:
GO_VERSION: "1.19"
Expand All @@ -24,6 +29,7 @@ jobs:
myToken: ${{ github.token }}

build-windows:
if: ${{ github.event.inputs.platform == 'all' || github.event.inputs.platform == 'windows' }}
runs-on: windows-latest
needs: [ get-release ]
steps:
Expand Down Expand Up @@ -124,6 +130,7 @@ jobs:
asset_path: ui/flutter/build/windows/Output/*
overwrite: true
build-macos-arm64-lib:
if: ${{ github.event.inputs.platform == 'all' || github.event.inputs.platform == 'macos' }}
runs-on: ubuntu-latest
needs: [ get-release ]
steps:
Expand All @@ -134,13 +141,14 @@ jobs:
- name: Build
run: |
go install src.techknowlogick.com/xgo@latest
xgo -go go-1.19.x --targets=darwin/arm64 -tags="nosqlite" -ldflags="-w -s" -buildmode=c-shared -pkg=bind/desktop -out=libgopeed .
xgo -go go-$GO_VERSION.x --targets=darwin/arm64 -tags="nosqlite" -ldflags="-w -s" -buildmode=c-shared -pkg=bind/desktop -out=libgopeed .
mv libgopeed-*.dylib libgopeed.dylib
- uses: actions/upload-artifact@v3
with:
name: macos-arm64-lib
path: libgopeed.dylib
build-macos:
if: ${{ github.event.inputs.platform == 'all' || github.event.inputs.platform == 'macos' }}
runs-on: macos-latest
needs: [ get-release, build-macos-arm64-lib ]
steps:
Expand Down Expand Up @@ -197,6 +205,7 @@ jobs:
asset_path: ui/flutter/build/macos/Build/Products/Release/dist/*
overwrite: true
build-linux:
if: ${{ github.event.inputs.platform == 'all' || github.event.inputs.platform == 'linux' }}
runs-on: ubuntu-latest
needs: [ get-release ]
steps:
Expand All @@ -210,20 +219,31 @@ jobs:
- run: |
sudo apt-get update -y
sudo apt-get install -y ninja-build libgtk-3-dev libayatana-appindicator3-dev
- name: Setup LXD
uses: canonical/setup-lxd@v0.1.1
with:
channel: latest/stable
- name: Build
env:
VERSION: ${{ needs.get-release.outputs.tag_name }}
run: |
go build -tags nosqlite -ldflags="-w -s" -buildmode=c-shared -o ui/flutter/linux/bundle/lib/libgopeed.so github.com/GopeedLab/gopeed/bind/desktop
cd ui/flutter
flutter build linux
mkdir -p build/dist

# Build portable
tar -czaf build/dist/Gopeed-$VERSION-linux-amd64-portable.tar.gz build/linux/x64/release/bundle


# Build deb package
mkdir -p debian/gui
cp assets/icon/icon_1024.png debian/gui/gopeed.png
cat>debian/debian.yaml<<EOF
flutter_app:
command: gopeed
arch: x64
parent: /usr/local/lib
parent: /usr/local/bin
control:
Package: gopeed
Version: ${VERSION:1}
Expand All @@ -241,6 +261,8 @@ jobs:
Name=Gopeed
GenericName=Gopeed
Comment=High speed downloader that supports all platforms.
Exec=gopeed
Icon=gopeed.png
Terminal=false
Type=Application
Categories=Utility
Expand All @@ -249,14 +271,142 @@ jobs:

dart pub global activate flutter_to_debian
flutter_to_debian
mv debian/packages/gopeed*.deb debian/packages/Gopeed-$VERSION-linux-amd64.deb
mv debian/packages/gopeed*.deb build/dist/Gopeed-$VERSION-linux-amd64.deb


# Build AppImage
sudo apt-get -y install libfuse2
wget -O appimage-builder https://github.com/AppImageCrafters/appimage-builder/releases/download/v1.1.0/appimage-builder-1.1.0-x86_64.AppImage
chmod +x appimage-builder
mkdir AppDir
cp -r build/linux/x64/release/bundle/* AppDir
mkdir -p AppDir/usr/share/icons
cp assets/icon/icon_1024.png AppDir/usr/share/icons/gopeed.png
cat>AppImageBuilder.yml<<EOF
version: 1
AppDir:
path: ${PWD}/AppDir
app_info:
id: com.gopeed.gopeed
name: Gopeed
icon: gopeed.png
version: ${VERSION:1}
exec: gopeed
exec_args: \$@
apt:
arch: amd64
allow_unauthenticated: true
sources:
- sourceline: deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted
universe multiverse
- sourceline: deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main
restricted universe multiverse
- sourceline: deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports
main restricted universe multiverse
- sourceline: deb http://security.ubuntu.com/ubuntu/ jammy-security main restricted
universe multiverse
include: []
files:
include: []
exclude:
- usr/share/man
- usr/share/doc/*/README.*
- usr/share/doc/*/changelog.*
- usr/share/doc/*/NEWS.*
- usr/share/doc/*/TODO.*
test:
fedora-30:
image: appimagecrafters/tests-env:fedora-30
command: ./AppRun
debian-stable:
image: appimagecrafters/tests-env:debian-stable
command: ./AppRun
archlinux-latest:
image: appimagecrafters/tests-env:archlinux-latest
command: ./AppRun
centos-7:
image: appimagecrafters/tests-env:centos-7
command: ./AppRun
ubuntu-xenial:
image: appimagecrafters/tests-env:ubuntu-xenial
command: ./AppRun
AppImage:
arch: x86_64
update-information: guess
EOF
./appimage-builder --skip-tests --recipe AppImageBuilder.yml
mv Gopeed-*-x86_64.AppImage build/dist/Gopeed-$VERSION-linux-amd64.AppImage

# Build snap
sudo snap install snapcraft --classic
rm -rf build/linux
mkdir -p snap/gui
cp assets/icon/icon_1024.png snap/gui/gopeed.png

cat>snap/snapcraft.yaml<<EOF
name: gopeed
version: ${VERSION:1}
summary: A modern download manager
description: High speed downloader that supports all platforms.

confinement: strict
base: core22
grade: stable

architectures:
- build-on: amd64
build-for: amd64

slots:
dbus-gopeed:
interface: dbus
bus: session
name: com.gopeed.gopeed

apps:
gopeed:
command: gopeed
extensions: [gnome]
plugs:
- network
slots:
- dbus-gopeed
parts:
gopeed:
source: .
plugin: flutter
stage-packages:
- libayatana-appindicator3-dev
flutter-target: lib/main.dart
EOF

cat>snap/gui/gopeed.desktop<<EOF
[Desktop Entry]
Version=${VERSION:1}
Name=Gopeed
GenericName=Gopeed
Comment=High speed downloader that supports all platforms.
Exec=gopeed
Icon=\${SNAP}/meta/gui/gopeed.png
Terminal=false
Type=Application
Categories=Utility
Keywords=Flutter;Downloader;
EOF

snapcraft --use-lxd

# Snapcraft login
export SNAPCRAFT_STORE_CREDENTIALS=${{ secrets.SNAP_STORE_LOGIN }}
snapcraft upload --release=stable gopeed_${VERSION:1}_amd64.snap
- name: Upload
uses: shogo82148/actions-upload-release-asset@v1
with:
upload_url: ${{ needs.get-release.outputs.upload_url }}
asset_path: ui/flutter/debian/packages/*
asset_path: ui/flutter/build/dist/*
overwrite: true
build-android:
if: ${{ github.event.inputs.platform == 'all' || github.event.inputs.platform == 'android' }}
runs-on: ubuntu-latest
needs: [ get-release ]
steps:
Expand Down Expand Up @@ -294,6 +444,7 @@ jobs:
asset_path: ui/flutter/dist/*
overwrite: true
build-ios:
if: ${{ github.event.inputs.platform == 'all' || github.event.inputs.platform == 'ios' }}
runs-on: macos-latest
needs: [ get-release ]
steps:
Expand Down Expand Up @@ -326,6 +477,7 @@ jobs:
asset_path: ui/flutter/dist/*
overwrite: true
build-web:
if: ${{ github.event.inputs.platform == 'all' || github.event.inputs.platform == 'web' }}
runs-on: ubuntu-latest
needs: [ get-release ]
steps:
Expand Down Expand Up @@ -373,6 +525,7 @@ jobs:
asset_path: dist/zip/*
overwrite: true
build-docker:
if: ${{ github.event.inputs.platform == 'all' || github.event.inputs.platform == 'docker' }}
runs-on: ubuntu-latest
needs: [ get-release ]
steps:
Expand Down