Skip to content

Commit

Permalink
ci/kuiper: workflow that build Scopy for Kuiper
Browse files Browse the repository at this point in the history
Signed-off-by: Bindea Cristian <[email protected]>
  • Loading branch information
bindea-cristian committed Apr 1, 2024
1 parent 373d69e commit 3ea7269
Show file tree
Hide file tree
Showing 14 changed files with 205 additions and 5 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/kuiperbuild.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Kuiper Scopy Build

on: [push, pull_request]

env:
BUILD_HOST: ubuntu-22.04
USERNAME: github-actions

jobs:

build_scopy_on_ubuntu22:
runs-on: ubuntu-22.04
container:
image: cristianbindea/scopy2-kuiper:latest
options: --user root
steps:
- uses: actions/checkout@v3

- name: Build Scopy
shell: bash
run: |
$GITHUB_WORKSPACE/ci/kuiper/kuiper_build_process.sh move_sysroot build_scopy create_appdir create_appimage move_appimage
- name: Set short git commit SHA
shell: bash
run: echo "commit_sha=$(git rev-parse --short ${{ github.sha }})" >> "$GITHUB_ENV"

- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ github.workspace }}\Scopy.appimage
asset_name: scopy-linux-armhf-${{ env.commit_sha }}
tag: ${{ github.ref }}
overwrite: true
body: "Scopy armhf"
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ build/*
.vscode/*
ci/ubuntu/staging
ci/macOS/staging
ci/kuiper/staging
ci/kuiper/docker/sysroot
windows/*
core/include/scopy-core_config.h
core/include/scopy-core_export.h
Expand Down
13 changes: 13 additions & 0 deletions ci/kuiper/AppRun
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
set -e
SELF=$(readlink -f "$0")
HERE=${SELF%/*}

export QT_PLUGIN_PATH=$HERE/usr/plugins
export QT_QPA_PLATFORM_PLUGIN_PATH=$HERE/usr/plugins/platforms
export LD_LIBRARY_PATH=$HERE/usr/lib

echo LD_LIBRARY_PATH: $LD_LIBRARY_PATH
echo PATH: $PATH
ldd $HERE/usr/bin/scopy
exec $HERE/usr/bin/scopy
Binary file added ci/kuiper/AppRun-armhf
Binary file not shown.
36 changes: 36 additions & 0 deletions ci/kuiper/copy-deps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash

set -x
SRC_DIR=$(git rev-parse --show-toplevel)
source $SRC_DIR/ci/kuiper/kuiper_build_config.sh

BINARY=$1
LOCATION=$2


if [ ! -f "${SRC_DIR}"/ci/kuiper/ldd-mod ]; then
sed 's|.*RTLDLIST=.*|RTLDLIST="/usr/arm-linux-gnueabihf/lib/ld-2.31.so /usr/arm-linux-gnueabihf/lib/ld-linux-armhf.so.3"|' /usr/bin/ldd | tee "${SRC_DIR}"/ci/kuiper/ldd-mod
chmod +x "${SRC_DIR}"/ci/kuiper/ldd-mod
fi

export LD_LIBRARY_PATH="${SYSROOT}/lib:${SYSROOT}/lib/arm-linux-gnueabihf:${SYSROOT}/usr/arm-linux-gnueabihf/lib:${SYSROOT}/usr/local/qt5.15:${SYSROOT}/usr/local/lib:${SRC_DIR}/build"
LIBS_ARRAY=()
run_ldd(){
for library in $("${SRC_DIR}"/ci/kuiper/ldd-mod "$1" | cut -d '>' -f 2 | awk '{print $1}')
do
# check if the library exists at that path and if it was processed already
if [ -f "${library}" ] && ! [[ "${LIBS_ARRAY[*]}" =~ "${library}" ]]; then
LIBS_ARRAY+=("${library}")
echo "---NEW--- ${library}"
if [ ! -f "${LOCATION}"/"${library##*/}" ]; then
cp --verbose "${library}" "${LOCATION}"
[ -L "${library}" ] && cp --verbose "$(realpath "${library}")" "${LOCATION}"
fi
run_ldd "${library}"
fi
done
}

for arg in $BINARY; do
run_ldd "${arg}"
done
52 changes: 52 additions & 0 deletions ci/kuiper/create_docker_image.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/bin/bash

set -ex
SRC_DIR=$(git rev-parse --show-toplevel)
source $SRC_DIR/ci/kuiper/kuiper_build_config.sh

install_packages(){
sudo apt install docker ...
}

create_sysroot(){
$SRC_DIR/ci/kuiper/create_sysroot.sh \
install_packages \
download_kuiper \
install_qemu \
extract_sysroot \
configure_sysroot
}

build_qt(){
$SRC_DIR/ci/kuiper/build_qt.sh \
install_packages \
download_qt \
download_crosscompiler \
build_qt5.15.2
}

build_dependencies(){
$SRC_DIR/ci/kuiper/kuiper_build_process.sh \
install_packages \
download_cmake \
download_crosscompiler \
clone \
build_deps
}

move_sysroot(){
sudo mv $SYSROOT $SYSROOT_DOCKER
}

create_image(){
pushd ${SRC_DIR}/ci/kuiper/docker
sudo docker build --load --tag cristianbindea/scopy2-kuiper .
popd
}

install_packages
create_sysroot
build_qt
build_dependencies
move_sysroot
create_image
34 changes: 34 additions & 0 deletions ci/kuiper/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# docker build -t cristianbindea/scopy-kuiper:latest


FROM --platform=linux/amd64 ubuntu:20.04
SHELL ["/bin/bash", "-c"]

ARG USER=runner
ENV DEBIAN_FRONTEND=noninteractive

ENV TZ=Europe/Bucharest
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get update && \
apt-get -y upgrade && \
apt-get install -y apt-utils sudo git wget flex bison pkg-config make python3 pip vim

RUN groupadd -g 1000 -r $USER && \
useradd -u 1000 -g 1000 --create-home -r $USER

#Change password
RUN echo "$USER:$USER" | chpasswd

#Make sudo passwordless
RUN echo "${USER} ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/90-$USER && \
usermod -aG sudo $USER && \
usermod -aG plugdev $USER

USER $USER
ENV SYSROOT_LOCATION=/home/${USER}/sysroot
RUN mkdir -p ${SYSROOT_LOCATION}
COPY sysroot/bin ${SYSROOT_LOCATION}/bin
COPY sysroot/lib ${SYSROOT_LOCATION}/lib
COPY sysroot/usr ${SYSROOT_LOCATION}/usr
COPY scopy2 scopy
WORKDIR /home/${USER}/scopy
8 changes: 8 additions & 0 deletions ci/kuiper/kuiper_build_process.sh
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,14 @@ create_appimage(){
chmod a+x $APP_IMAGE
}

move_appimage(){
mv $APP_IMAGE $SRC_DIR/
}

move_sysroot(){
mv $HOME/sysroot $SYSROOT
}


for arg in $@; do
$arg
Expand Down
Binary file added ci/kuiper/runtime-armhf
Binary file not shown.
10 changes: 10 additions & 0 deletions ci/kuiper/scopy.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[Desktop Entry]
Version=1.0
Icon=scopy
Exec=scopy
Terminal=false
Type=Application
Categories=Science
Name=Scopy
GenericName=Oscilloscope
Comment=A software oscilloscope
9 changes: 6 additions & 3 deletions common/src/scopyconfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ QString scopy::config::localPluginFolderPath()
#if defined __APPLE__
return QCoreApplication::applicationDirPath() + "/plugins/plugins";
#endif

return SCOPY_PLUGIN_BUILD_PATH;
// TODO: a check for ARM
// Quickfix for testing purposes
return QCoreApplication::applicationDirPath() + "/../share/plugins";
}

QString scopy::config::defaultTranslationFolderPath() { return SCOPY_TRANSLATION_INSTALL_PATH; }
Expand All @@ -38,7 +39,9 @@ QString scopy::config::localTranslationFolderPath()
return QCoreApplication::applicationDirPath() + "/translations";
#endif

return SCOPY_TRANSLATION_BUILD_PATH;
// TODO: a check for ARM
// Quickfix for testing purposes
return QCoreApplication::applicationDirPath() + "/../share/translations";
}

QString scopy::config::preferencesFolderPath()
Expand Down
6 changes: 5 additions & 1 deletion core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ endif()
option(WITH_PYTHON "Enable Python" ON)
if(${WITH_PYTHON})
set(Python_ADDITIONAL_VERSIONS 3)
find_package(Python3 REQUIRED COMPONENTS Interpreter Development)
if(CMAKE_SYSTEM_PROCESSOR MATCHES arm)
find_package(Python3 REQUIRED COMPONENTS Interpreter)
else()
find_package(Python3 REQUIRED COMPONENTS Interpreter Development)
endif()
set(PYTHON_VERSION python${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR})
set(PYTHON_VERSION ${PYTHON_VERSION} PARENT_SCOPE)
if(NOT Python3_FOUND)
Expand Down
4 changes: 3 additions & 1 deletion core/src/scopymainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,9 @@ void ScopyMainWindow::loadDecoders()
#if defined __APPLE__
QString path = QCoreApplication::applicationDirPath() + "/decoders";
#else
QString path = "decoders";
// TODO: a check for ARM
// Quickfix for testing purposes
QString path = QCoreApplication::applicationDirPath() + "/../lib/decoders";
#endif

bool success = true;
Expand Down
Binary file added gui/res/scopy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 3ea7269

Please sign in to comment.