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

Add AppImageBuilder #80

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
124 changes: 124 additions & 0 deletions .github/workflows/appimage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
# Manually triggered build of mlnet, mlgui and utils binaries and appimage with mlnet+gui

name: Build AppImage

on:
workflow_dispatch

env:
APPIMAGEBUILDER_VERSION: 1.1.0
APPIMAGEBUILDER_SHA1SUM: 6f83a789f6c47a745b97d1b0b3f1df2e7eea7a09

jobs:
build:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think ideally this build part of pipeline should be move to main pipeline, and then here keep only appimage (and use artifacts produced by main build pipeline)

runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install dependencies
run: sudo apt-get install -y --no-install-recommends autoconf ocaml ocaml-findlib liblablgtk2-ocaml-dev camlp4 libnum-ocaml-dev libminiupnpc-dev libnatpmp-dev libbz2-dev librsvg2-dev libmagic-dev libgtk2.0-dev liblablgtk2-ocaml-dev liblablgtk2-gl-ocaml-dev liblablgtk2-gnome-ocaml-dev libgd-dev

- name: Configure options
run: ./configure --enable-batch --enable-upnp-natpmp --disable-directconnect --disable-fasttrack --disable-gnutella --disable-gnutella2 --enable-gui=newgui2
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think directconnect module is in good shape, enable it?


- name: Build binaries
run: make

- name: Build utils
run: make utils

- name: Save version
run: |
VERSION=$(./mlnet -v 2>&1 | sed -ne "1s#^.*Starting MLDonkey \([^ ]\+\) .*#\1#p")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there should be better way to get version without running the binary. Worst case can grep configure log, or actually this :

$ ocaml -e '#use "src/utils/lib/autoconf.ml";; print_endline current_version'
3.2.1.git

see ocaml/ocaml#13637 for why less ugly methods don't work

echo "$VERSION" | grep -i git && COMMIT="_$(git rev-parse --short HEAD)"
{
echo "APP_VERSION=${VERSION}${COMMIT}"
echo "HOST_TYPE=$HOSTTYPE"
echo "OS_TYPE=${{matrix.os}}"
} | tee -a $GITHUB_ENV

- name: Upload mlnet and mlgui binaries
uses: actions/upload-artifact@v4
with:
name: mlnet-and-mlgui-${{env.APP_VERSION}}-${{env.HOST_TYPE}}-${{env.OS_TYPE}}
path: |
mlnet
mlgui

- name: Upload utils
uses: actions/upload-artifact@v4
with:
name: mldonkey-utils-${{env.APP_VERSION}}-${{env.HOST_TYPE}}-${{env.OS_TYPE}}
path: |
bt_dht_node
copysources
get_range
make_torrent
mld_hash
subconv
svg_converter
if-no-files-found: warn

- name: Upload mlnet+gui binary
uses: actions/upload-artifact@v4
with:
name: mlnet+gui-${{env.APP_VERSION}}-${{env.HOST_TYPE}}-${{env.OS_TYPE}}
path: mlnet+gui
if-no-files-found: warn

outputs:
APP_VERSION: ${{env.APP_VERSION}}
HOST_TYPE: ${{env.HOST_TYPE}}
OS_TYPE: ${{env.OS_TYPE}}

appimage:
if: ${{ needs.build.outputs.OS_TYPE == 'ubuntu-22.04' && needs.build.outputs.HOST_TYPE == 'x86_64' }}
needs: build
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Download mlnet+gui binary
uses: actions/download-artifact@v4
with:
name: mlnet+gui-${{needs.build.outputs.APP_VERSION}}-${{needs.build.outputs.HOST_TYPE}}-${{needs.build.outputs.OS_TYPE}}

- name: Install dependencies
run: sudo apt-get install -y --no-install-recommends libfuse2

# env SOURCE_DIR=. doesn't work with --recipe packages/appimage/AppImageBuilder.yml
- name: Link recipe
run: ln -s packages/appimage/AppImageBuilder.yml AppImageBuilder.yml

- name: Restore mlnet+gui executable permisions
run: |
chmod +x mlnet+gui
ls -l

- name: Build AppImage
run: |
# Get application version
APP_VERSION="${{needs.build.outputs.APP_VERSION}}"
echo "APP_VERSION=$APP_VERSION"
export APP_VERSION
# Download appimage-builder
APPIMAGEBUILDER_FILE="appimage-builder-${APPIMAGEBUILDER_VERSION}-${{needs.build.outputs.HOST_TYPE}}.AppImage"
APPIMAGEBUILDER_URL="https://github.com/AppImageCrafters/appimage-builder/releases/download/v${APPIMAGEBUILDER_VERSION}/${APPIMAGEBUILDER_FILE}"
wget "${APPIMAGEBUILDER_URL}"
# Check the hash to verify that it was correctly downloaded
echo "${APPIMAGEBUILDER_SHA1SUM} *${APPIMAGEBUILDER_FILE}" | sha1sum --check --strict
chmod +x "${APPIMAGEBUILDER_FILE}"
./"${APPIMAGEBUILDER_FILE}" --skip-tests

- name: Upload AppImage
uses: actions/upload-artifact@v4
with:
name: mldonkey-${{needs.build.outputs.APP_VERSION}}-${{needs.build.outputs.HOST_TYPE}}.AppImage
path: mldonkey-*.AppImage

88 changes: 88 additions & 0 deletions packages/appimage/AppImageBuilder.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# appimage-builder recipe see https://appimage-builder.readthedocs.io for details
version: 1

script:
# Remove any previous build
- rm -rf AppDir
# Make some needed dirs
- mkdir -p "$TARGET_APPDIR"/usr/bin
- mkdir -p "$TARGET_APPDIR"/usr/share/icons/default
- mkdir -p "$TARGET_APPDIR"/usr/share/applications
# Copy the application data into the AppDir
- cp "$SOURCE_DIR"/mlnet+gui "$TARGET_APPDIR"/usr/bin/
- cp "$SOURCE_DIR"/distrib/mldonkey.desktop "$TARGET_APPDIR"/usr/share/applications
- cp "$SOURCE_DIR"/icons/rsvg/type_source_normal.svg "$TARGET_APPDIR"/usr/share/icons/default/mldonkey.svg

AppDir:
path: ./AppDir
app_info:
id: mldonkey
name: mldonkey
icon: mldonkey
version: ${APP_VERSION}
exec: usr/bin/mlnet+gui
exec_args: $@
apt:
arch:
- amd64
sources:
- sourceline: 'deb [arch=amd64] http://archive.ubuntu.com/ubuntu jammy main restricted universe multiverse'
key_url: 'http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x871920d1991bc93c'
- sourceline: 'deb [arch=amd64] http://archive.ubuntu.com/ubuntu jammy-updates main restricted universe multiverse'
- sourceline: 'deb [arch=amd64] http://archive.ubuntu.com/ubuntu jammy-backports main restricted universe multiverse'
- sourceline: 'deb [arch=amd64] http://security.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse'
- sourceline: 'deb [arch=amd64] http://archive.canonical.com/ubuntu/ jammy partner'
include:
- ca-certificates
- libc6
- bzip2
- librsvg2-2
- libmagic1
- libmagic-mgc
- libminiupnpc17
- libnatpmp1
- libgtk2.0-0
- libatk-adaptor
- libgail-common
- libgd3
- perl-base
- dash
- make
files:
include:
- lib64/ld-linux-x86-64.so.2
- /usr/lib/file/libmagic-mgc
exclude:
- usr/share/man
- usr/share/doc/*/ANNOUNCE*
- usr/share/doc/*/AUTHORS*
- usr/share/doc/*/FAQ*
- usr/share/doc/*/HOWTO*
- usr/share/doc/*/NEWS*
- usr/share/doc/*/README*
- usr/share/doc/*/THANKS*
- usr/share/doc/*/TODO*
- usr/share/doc/*/changelog*
- usr/share/doc/*/copyright*
- usr/share/doc/*/examples/*
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: None
# sign-key: None