Skip to content

Linux Build

Linux Build #77

Workflow file for this run

name: Linux Build
on:
# push:
# branches: [ main ]
# pull_request:
workflow_dispatch:
workflow_call:
jobs:
build-deb:
name: Build DEB
runs-on: ubuntu-latest
container:
image: ubuntu:22.04
steps:
- name: Install core tools
run: |
apt-get update
apt-get install -y curl git tar xz-utils libglu1-mesa file
- name: Checkout repository
uses: actions/checkout@v6
- name: Prepare Linux build paths
run: |
ln -s runner/my_application.cc linux/my_application.cc
ln -s runner/main.cc linux/main.cc
- name: Install Linux dependencies (Ubuntu)
run: |
export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get install -y \
clang \
cmake \
ninja-build \
pkg-config \
libgtk-3-dev \
libwebkit2gtk-4.1-dev \
liblzma-dev \
libayatana-appindicator3-dev \
libnss3-dev \
libnspr4-dev \
libasound2-dev \
xclip \
sudo
- name: Install Flutter
run: |
curl -o /tmp/flutter.tar.xz https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.41.4-stable.tar.xz
mkdir -p /opt
tar -xf /tmp/flutter.tar.xz -C /opt
rm /tmp/flutter.tar.xz
git config --global --add safe.directory /opt/flutter
echo "/opt/flutter/bin" >> $GITHUB_PATH
- name: Build DEB package
run: |
export PATH="$PATH:/opt/flutter/bin"
/opt/flutter/bin/dart pub global activate fastforge
/opt/flutter/bin/flutter pub get
/opt/flutter/bin/dart pub global run fastforge:main package --platform linux --targets deb
- name: Upload DEB artifact
uses: actions/upload-artifact@v4
with:
name: deb-package
path: dist/*/*.deb
- name: Prepare and rename DEB
run: |
VERSION=$(grep '^version:' pubspec.yaml | cut -d ' ' -f 2)
mkdir -p deploy_out
DEB_FILE=$(find dist/ -name "*.deb" | head -n 1)
if [ -f "$DEB_FILE" ]; then
cp "$DEB_FILE" "deploy_out/lsfusion-client-$VERSION.deb"
fi
- name: Upload DEB to CDN via FTP
uses: sand4rt/ftp-deployer@v1.8
with:
host: ${{ secrets.SFTP_HOST }}
username: ${{ secrets.SFTP_USERNAME }}
password: ${{ secrets.SFTP_PASSWORD }}
local_folder: deploy_out/
remote_folder: flutter/linux/
cleanup: false
build-rpm:
name: Build RPM
runs-on: ubuntu-latest
container:
image: almalinux:9
steps:
- name: Install core tools
run: |
dnf install -y --allowerasing git tar xz which curl epel-release 'dnf-command(config-manager)'
dnf config-manager --set-enabled crb
dnf update -y
dnf makecache
- name: Checkout repository
uses: actions/checkout@v6
- name: Prepare Linux build paths
run: |
ln -s runner/my_application.cc linux/my_application.cc
ln -s runner/main.cc linux/main.cc
- name: Install build dependencies
run: |
dnf install -y --allowerasing \
clang \
cmake \
ninja-build \
pkg-config \
gtk3-devel \
'pkgconfig(webkit2gtk-4.1)' \
xz-devel \
libayatana-appindicator-gtk3-devel \
rpm-build \
unzip \
libstdc++-devel \
mesa-libGLU-devel \
libX11-devel \
nss-devel \
nspr-devel \
alsa-lib-devel \
xclip
- name: Install Flutter
run: |
curl -o /tmp/flutter.tar.xz https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.41.4-stable.tar.xz
mkdir -p /opt
tar -xf /tmp/flutter.tar.xz -C /opt
rm /tmp/flutter.tar.xz
git config --global --add safe.directory /opt/flutter
echo "/opt/flutter/bin" >> $GITHUB_PATH
- name: Build RPM package
run: |
# Configure RPM build to ignore internal shared libraries
# We use both __requires_exclude and _use_internal_dependency_generator
# Also we disable automatic requirements discovery to avoid finding internal .so
cat <<EOF > $HOME/.rpmmacros
%__requires_exclude ^lib(flutter_.*|printing_plugin|webview_all_linux_plugin)\\.so.*
%_use_internal_dependency_generator 0
%__find_requires /bin/true
%__find_provides /bin/true
EOF
cp $HOME/.rpmmacros /root/.rpmmacros || true
export PATH="$PATH:/opt/flutter/bin"
/opt/flutter/bin/dart pub global activate fastforge
/opt/flutter/bin/flutter pub get
/opt/flutter/bin/dart pub global run fastforge:main package --platform linux --targets rpm
- name: Upload RPM artifact
uses: actions/upload-artifact@v4
with:
name: rpm-package
path: dist/*/*.rpm
- name: Prepare and rename RPM
run: |
VERSION=$(grep '^version:' pubspec.yaml | cut -d ' ' -f 2)
mkdir -p deploy_out
RPM_FILE=$(find dist/ -name "*.rpm" | head -n 1)
if [ -f "$RPM_FILE" ]; then
cp "$RPM_FILE" "deploy_out/lsfusion-client-$VERSION.rpm"
fi
- name: Upload RPM to CDN via FTP
uses: sand4rt/ftp-deployer@v1.8
with:
host: ${{ secrets.SFTP_HOST }}
username: ${{ secrets.SFTP_USERNAME }}
password: ${{ secrets.SFTP_PASSWORD }}
local_folder: deploy_out/
remote_folder: flutter/linux/
cleanup: false
build-pacman:
name: Build Arch
runs-on: ubuntu-latest
container:
image: archlinux:latest
steps:
- name: Install core tools
run: |
pacman -Sy --noconfirm archlinux-keyring
pacman -Syu --noconfirm
pacman -S --needed --noconfirm \
base-devel \
clang \
cmake \
ninja \
pkgconf \
gtk3 \
libayatana-appindicator \
nss \
nspr \
alsa-lib \
glu \
libx11 \
xclip \
xz \
zstd \
webkit2gtk-4.1 \
git \
curl \
tar \
which \
sudo
- name: Checkout repository
uses: actions/checkout@v6
- name: Prepare Linux build paths
run: |
ln -s runner/my_application.cc linux/my_application.cc
ln -s runner/main.cc linux/main.cc
- name: Install Flutter
run: |
curl -o /tmp/flutter.tar.xz https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.41.4-stable.tar.xz
mkdir -p /opt
tar -xf /tmp/flutter.tar.xz -C /opt
rm /tmp/flutter.tar.xz
git config --global --add safe.directory /opt/flutter
echo "/opt/flutter/bin" >> $GITHUB_PATH
- name: Build Arch package
run: |
# Create a non-root user for makepkg
useradd -m builduser
echo "builduser ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
chown -R builduser:builduser .
# Run build and packaging as builduser
sudo -u builduser bash <<'EOF'
export PATH="$PATH:/opt/flutter/bin"
# Build the flutter app bundle
flutter pub get
flutter build linux --release
# Extract metadata
VERSION=$(grep '^version:' pubspec.yaml | cut -d ' ' -f 2 | cut -d '+' -f 1)
PROJECT_DIR=$(pwd)
# Create PKGBUILD
cat > PKGBUILD <<PKGEFF
pkgname=lsfusion-client
pkgver=$VERSION
pkgrel=1
pkgdesc="lsFusion client"
arch=('x86_64')
url="https://lsfusion.org"
license=('MIT')
depends=('gtk3' 'libayatana-appindicator' 'xz' 'nss' 'nspr' 'alsa-lib' 'glu' 'libx11' 'webkit2gtk-4.1')
options=('!strip')
package() {
install -d "\$pkgdir/usr/bin"
install -d "\$pkgdir/usr/share/\$pkgname"
# Copy build bundle from build directory
cp -r "$PROJECT_DIR/build/linux/x64/release/bundle/." "\$pkgdir/usr/share/\$pkgname/"
# Executable symlink (using hyphen for the command name)
ln -s "/usr/share/\$pkgname/lsfusion_client" "\$pkgdir/usr/bin/lsfusion-client"
# Icon
install -Dm644 "$PROJECT_DIR/web/icons/Icon-192.png" "\$pkgdir/usr/share/icons/hicolor/192x192/apps/\$pkgname.png"
# Desktop entry
install -d "\$pkgdir/usr/share/applications"
cat > "\$pkgdir/usr/share/applications/\$pkgname.desktop" <<EOD
[Desktop Entry]
Type=Application
Name=lsFusion client
Exec=lsfusion-client %U
Icon=\$pkgname
Categories=Office;Utility;
Terminal=false
EOD
}
PKGEFF
# Build the package
makepkg -f
EOF
- name: Prepare and rename Arch
run: |
VERSION=$(grep '^version:' pubspec.yaml | cut -d ' ' -f 2 | cut -d '+' -f 1)
mkdir -p deploy_out
# makepkg produces a file like lsfusion-client-1.0.0-1-x86_64.pkg.tar.zst
ARCH_FILE=$(find . -name "lsfusion-client-*-x86_64.pkg.tar.zst" | head -n 1)
if [ -f "$ARCH_FILE" ]; then
cp "$ARCH_FILE" "deploy_out/lsfusion-client-$VERSION-x86_64.pkg.tar.zst"
fi
- name: Upload Arch artifact
uses: actions/upload-artifact@v4
with:
name: arch-package
path: deploy_out/*.pkg.tar.zst
- name: Upload Arch to CDN via FTP
uses: sand4rt/ftp-deployer@v1.8
with:
host: ${{ secrets.SFTP_HOST }}
username: ${{ secrets.SFTP_USERNAME }}
password: ${{ secrets.SFTP_PASSWORD }}
local_folder: deploy_out/
remote_folder: flutter/linux/
cleanup: false