Skip to content

Add debian package build and upload in CI #201

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

Open
wants to merge 4 commits into
base: develop
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
76 changes: 76 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ jobs:
uses: mxschmitt/action-tmate@v3
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled }}

- name: Update apt sources
run: sudo apt-get update

- name: Install Qt
uses: jurplel/install-qt-action@v2

Expand Down Expand Up @@ -89,6 +92,79 @@ jobs:
name: linux-latest-appimage
path: Scripts/*.AppImage

build-linux-deb:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup interactive shell session
uses: mxschmitt/action-tmate@v3
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled }}

- name: Update apt sources
run: sudo apt-get update

- name: Install Qt
run: sudo apt-get install qtbase5-dev

- name: Install sndfile
run: sudo apt-get install libsndfile1-dev

- name: Install Volk
run: sudo apt-get install libvolk2-dev

- name: Install cURL
run: sudo apt-get install libcurl4-openssl-dev

- name: Install FFTW3
run: sudo apt-get install libfftw3-dev

- name: Install SoapySDR modules
run: sudo apt-get install soapysdr-module-all

- name: Install SoapySDR development files
run: sudo apt-get install libsoapysdr-dev

- name: Install libxml2
run: sudo apt-get install libxml2-dev

- name: Install portaudio
run: sudo apt-get install portaudio19-dev

- name: Install ALSA libraries
run: sudo apt-get install libasound2-dev

- name: Download linuxdeployqt AppImage
run: wget https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage

- name: Install linuxdeployqt system-wide
run: |
sudo mv linuxdeployqt-continuous-x86_64.AppImage /usr/bin/linuxdeployqt
sudo chmod a+x /usr/bin/linuxdeployqt

- name: Get short hash
id: vars
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT

- name: Build & Distribute (SigDigger)
run: |
cd Scripts
chmod a+x dist-deb.sh
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH":"$PWD"/deploy-root/lib
./dist-deb.sh 0.3.0-${{steps.vars.outputs.sha_short}}
cd ..

- name: Upload deb artifact
uses: actions/upload-artifact@v2
with:
name: sigdigger_0.3.0-${{steps.vars.outputs.sha_short}}_amd64.deb
path: Scripts/build-root/sigdigger_0.3.0-${{steps.vars.outputs.sha_short}}_amd64.deb

- name: Upload dev deb artifact
uses: actions/upload-artifact@v2
with:
name: sigdigger-dev_0.3.0-${{steps.vars.outputs.sha_short}}_amd64.deb
path: Scripts/build-root/sigdigger-dev_0.3.0-${{steps.vars.outputs.sha_short}}_amd64.deb

build-macos:
runs-on: macos-11
steps:
Expand Down
108 changes: 108 additions & 0 deletions Scripts/dist-deb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
#!/bin/bash
#
# dist-dist.sh: Deploy SigDigger in a debian package
#
# Copyright (C) 2023 Ángel Ruiz Fernández
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, version 3.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program. If not, see
# <http://www.gnu.org/licenses/>
#

if [ "$#" != "1" ]; then
echo $0: Usage:
echo " $0 version"
exit 1
fi

PKG_VERSION=$1

shift

# build SigDigger
. dist-common.sh

build

PKG_ARCH=`dpkg --print-architecture`
PKG_DEPENDS='libsuscan (>= 0.3.0-1), libsuwidgets (>= 0.3.0-1)'
PKG_DEV_DEPENDS='libsuscan-dev (>= 0.3.0-1), libsuwidgets-dev (>= 0.3.0-1)'

BINDIR=sigdigger_${PKG_VERSION}_${PKG_ARCH}
DEVDIR=sigdigger-dev_${PKG_VERSION}_${PKG_ARCH}
############################ Binary package ####################################
# create structure
rm -Rf $BINDIR
mkdir $BINDIR
cd $BINDIR
mkdir -p usr/bin/
mkdir -p usr/share/applications/
mkdir -p usr/share/icons/hicolor/256x256/apps/
mkdir -p DEBIAN/

# create debian thing
rm -f DEBIAN/control
cat <<EOF >>DEBIAN/control
Package: sigdigger
Version: $PKG_VERSION
Section: hamradio
Priority: optional
Architecture: $PKG_ARCH
Depends: $PKG_DEPENDS
Maintainer: arf20 <aruizfernandez05@gmail.com>
Description: The Free Digital Signal Analyzer
EOF

# copy files
cp ../SigDigger/SigDigger usr/bin/
cp ../SigDigger/SigDigger.desktop ../SigDigger/RMSViewer.desktop usr/share/applications/
cp ../SigDigger/icons/SigDigger.png usr/share/icons/hicolor/256x256/apps/

# set permissions
cd ..
chmod 755 -R $BINDIR/

# build deb
dpkg-deb --build $BINDIR

############################ Development package ###############################
# create structure
rm -Rf $DEVDIR
mkdir $DEVDIR
cd $DEVDIR
mkdir -p usr/include/x86_64-linux-gnu/qt5/SigDigger/Suscan/Messages/
mkdir -p DEBIAN/

# create debian thing
rm -f DEBIAN/control
cat <<EOF >>DEBIAN/control
Package: sigdigger-dev
Version: $PKG_VERSION
Section: libdevel
Priority: optional
Architecture: $PKG_ARCH
Depends: sigdigger (= $PKG_VERSION), $PKG_DEV_DEPENDS, pkg-config
Maintainer: arf20 <aruizfernandez05@gmail.com>
Description: The Free Digital Signal Analyzer development files
EOF

# copy files
cp ../SigDigger/include/AppConfig.h ../SigDigger/include/Application.h ../SigDigger/include/AppUI.h ../SigDigger/include/AudioFileSaver.h ../SigDigger/include/AudioPlayback.h ../SigDigger/include/Averager.h ../SigDigger/include/ColorConfig.h ../SigDigger/include/ConfigTab.h ../SigDigger/include/FeatureFactory.h ../SigDigger/include/GuiConfig.h ../SigDigger/include/InspectionWidgetFactory.h ../SigDigger/include/SigDiggerHelpers.h ../SigDigger/include/MainSpectrum.h ../SigDigger/include/MainWindow.h ../SigDigger/include/Palette.h ../SigDigger/include/PersistentWidget.h ../SigDigger/include/TabWidgetFactory.h ../SigDigger/include/TLESourceConfig.h ../SigDigger/include/ToolWidgetFactory.h ../SigDigger/include/UIComponentFactory.h ../SigDigger/include/UIListenerFactory.h ../SigDigger/include/UIMediator.h ../SigDigger/include/GenericDataSaver.h ../SigDigger/include/Version.h usr/include/x86_64-linux-gnu/qt5/SigDigger/
cp ../SigDigger/include/Suscan/AnalyzerRequestTracker.h ../SigDigger/include/Suscan/CancellableTask.h ../SigDigger/include/Suscan/Analyzer.h ../SigDigger/include/Suscan/AnalyzerParams.h ../SigDigger/include/Suscan/Channel.h ../SigDigger/include/Suscan/Compat.h ../SigDigger/include/Suscan/Config.h ../SigDigger/include/Suscan/Estimator.h ../SigDigger/include/Suscan/Library.h ../SigDigger/include/Suscan/Logger.h ../SigDigger/include/Suscan/Message.h ../SigDigger/include/Suscan/MQ.h ../SigDigger/include/Suscan/MultitaskController.h ../SigDigger/include/Suscan/Object.h ../SigDigger/include/Suscan/Plugin.h ../SigDigger/include/Suscan/Serializable.h ../SigDigger/include/Suscan/Source.h ../SigDigger/include/Suscan/SpectrumSource.h usr/include/x86_64-linux-gnu/qt5/SigDigger/Suscan/
cp ../SigDigger/include/Suscan/Messages/ChannelMessage.h ../SigDigger/include/Suscan/Messages/GenericMessage.h ../SigDigger/include/Suscan/Messages/InspectorMessage.h ../SigDigger/include/Suscan/Messages/PSDMessage.h ../SigDigger/include/Suscan/Messages/SamplesMessage.h ../SigDigger/include/Suscan/Messages/SourceInfoMessage.h ../SigDigger/include/Suscan/Messages/StatusMessage.h usr/include/x86_64-linux-gnu/qt5/SigDigger/Suscan/Messages/

# set permissions
cd ..
chmod 755 -R $DEVDIR

# build deb
dpkg-deb --build $DEVDIR