diff --git a/.github/workflows/linuxflatpakbuild.yml b/.github/workflows/linuxflatpakbuild.yml
index 4e3083df7c..e5f295ad90 100644
--- a/.github/workflows/linuxflatpakbuild.yml
+++ b/.github/workflows/linuxflatpakbuild.yml
@@ -14,16 +14,22 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Pull the Docker Image
- run: docker pull cristianbindea/scopy2-flatpak
+ run: docker pull cristianbindea/scopy2-flatpak:testing
- name: Run Docker Image
run: |
$GITHUB_WORKSPACE/ci/general/gen_ci_envs.sh > $GITHUB_WORKSPACE/ci/general/gh-actions.envs
docker run --privileged \
- -v `pwd`:$GITHUB_WORKSPACE:rw \
+ -e CI_SCRIPT='ON' \
+ --mount type=bind,source="$GITHUB_WORKSPACE",target=$GITHUB_WORKSPACE \
--env-file $GITHUB_WORKSPACE/ci/general/gh-actions.envs \
- cristianbindea/scopy2-flatpak /bin/bash -xe $GITHUB_WORKSPACE/ci/flatpak/inside_flatpak_docker.sh
+ cristianbindea/scopy2-flatpak:testing
+ /bin/bash -c 'sudo chown -R runner:runner $GITHUB_WORKSPACE && $GITHUB_WORKSPACE/ci/flatpak/flatpak_build_process.sh'
+ - name: Setup upterm session
+ uses: lhotari/action-upterm@v1
+ with:
+ wait-timeout-minutes: 5
- name: Set short git commit SHA
shell: bash
run: echo "commit_sha=$(git rev-parse --short ${{ github.sha }})" >> "$GITHUB_ENV"
diff --git a/.gitignore b/.gitignore
index 21921bfd5f..22574da40c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -35,6 +35,7 @@ doc/*
.cache/*
build/*
.vscode/*
+ci/general/gh-actions.envs
ci/ubuntu/staging
ci/macOS/staging
ci/armhf/staging
diff --git a/ci/flatpak/.gitignore b/ci/flatpak/.gitignore
index 73bbfdb2fe..5045a85ee7 100644
--- a/ci/flatpak/.gitignore
+++ b/ci/flatpak/.gitignore
@@ -2,4 +2,5 @@ Scopy.flatpak
.flatpak-builder
build
repo
-org.adi.Scopy.json
\ No newline at end of file
+org.adi.Scopy.json
+tmp.json
diff --git a/ci/flatpak/create_docker.sh b/ci/flatpak/create_docker.sh
new file mode 100755
index 0000000000..2da3f1f185
--- /dev/null
+++ b/ci/flatpak/create_docker.sh
@@ -0,0 +1,24 @@
+#!/bin/bash -xe
+
+SRC_DIR=$(git rev-parse --show-toplevel 2>/dev/null ) || \
+SRC_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && cd ../../ && pwd )
+
+build_docker(){
+ pushd $SRC_DIR/ci/flatpak
+ docker build -t cristianbindea/scopy2-flatpak:testing -f docker/Dockerfile .
+ CONTAINER_NAME=builder-flatpak
+ docker run \
+ --name $CONTAINER_NAME \
+ --privileged \
+ --mount type=bind,source="$SRC_DIR/ci/flatpak/build_flatpak_deps.sh",target=/home/runner/config/build_flatpak_deps.sh,readonly \
+ --mount type=bind,source="$SRC_DIR/ci/flatpak/defined_variables.h",target=/home/runner/config/defined_variables.h,readonly \
+ --mount type=bind,source="$SRC_DIR/ci/flatpak/org.adi.Scopy.json.c",target=/home/runner/config/org.adi.Scopy.json.c,readonly \
+ --mount type=bind,source="$SRC_DIR/ci/flatpak/Makefile",target=/home/runner/config/Makefile,readonly \
+ cristianbindea/scopy2-flatpak:testing /bin/bash -c /home/runner/config/build_flatpak_deps.sh
+
+ docker commit $CONTAINER_NAME cristianbindea/scopy2-flatpak:testing
+ echo "Docker container $CONTAINER_NAME commited as cristianbindea/scopy2-flatpak:testing image"
+ popd
+}
+
+build_docker
\ No newline at end of file
diff --git a/ci/flatpak/defined_variables.h b/ci/flatpak/defined_variables.h
index 873ad9d5eb..ccbaab4260 100644
--- a/ci/flatpak/defined_variables.h
+++ b/ci/flatpak/defined_variables.h
@@ -18,7 +18,7 @@
#define _ENABLE_VOLK OFF
#elif __X86__
- #define RUNTIME_VERSION 5.15-22.08
+ #define RUNTIME_VERSION 5.15-23.08
#define CFLAGS --disable-assembly
#define CMAKE_C_FLAGS -DCMAKE_C_FLAGS= -fno-asynchronous-unwind-tables -fPIC
#define CMAKE_ASM_FLAGS -DCMAKE_ASM_FLAGS=
diff --git a/ci/flatpak/docker/Dockerfile b/ci/flatpak/docker/Dockerfile
index 8185e0dfd2..fd4e910567 100644
--- a/ci/flatpak/docker/Dockerfile
+++ b/ci/flatpak/docker/Dockerfile
@@ -1,32 +1,38 @@
FROM ubuntu:20.04
+CMD ["/bin/bash"]
+ARG USER=runner
+ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe/Bucharest
+ENV CI_SCRIPT=ON
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
-RUN apt-get update -y
+# Install starting packages
+RUN apt update && apt -y upgrade && \
+ apt install -y apt-utils software-properties-common sudo
-# Install base dependencies
-RUN apt-get install -y software-properties-common build-essential git sudo apt-utils subversion mm-common
+# Create user
+RUN groupadd -g 1000 -r $USER && \
+ useradd -u 1000 -g 1000 --create-home -r $USER
-# Install flatpak
-RUN add-apt-repository ppa:alexlarsson/flatpak -y
-RUN apt-get update -y
-RUN apt install flatpak flatpak-builder -y
+# Change password
+RUN echo "$USER:$USER" | chpasswd
-# Install remote
-RUN flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
-RUN flatpak install flathub org.kde.Platform//5.15-22.08 -y
-RUN flatpak install flathub org.kde.Sdk//5.15-22.08 -y
+# Make sudo passwordless
+RUN echo "${USER} ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/90-$USER && \
+ usermod -aG sudo $USER && \
+ usermod -aG plugdev $USER
-# Clean
-RUN apt-get clean -y && apt-get autoclean -y
+USER $USER
-RUN echo Cloning scopy-flatpak
-ARG REPO_LINK=https://github.com/analogdevicesinc/scopy-flatpak
-ARG REPO_LOCAL=/home/docker/scopy-flatpak
-ARG REPO_BRANCH=ci-for-scopy2
+# Install base dependencies
+# Install flatpak
+# Clean apt
+RUN sudo apt install -y git wget vim build-essential subversion mm-common && \
+ sudo apt install flatpak jq flatpak-builder -y && \
+ sudo apt clean -y && sudo apt autoclean -y
-RUN git clone --recurse-submodules "$REPO_LINK" -b "$REPO_BRANCH" "$REPO_LOCAL" 2> /dev/null || (cd "$REPO_LOCAL"; git pull)
+# Install remote
+RUN sudo flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
+RUN sudo flatpak install flathub org.kde.Platform//5.15-23.08 -y && sudo flatpak install flathub org.kde.Sdk//5.15-23.08 -y
-#RUN cd /home/docker/scopy-flatpak && make -j4
-#RUN rm -rf Scopy.flatpak
-CMD ["/bin/bash"]
\ No newline at end of file
+WORKDIR /home/$USER
diff --git a/ci/flatpak/docker/README b/ci/flatpak/docker/README
deleted file mode 100644
index 4e9a665fdd..0000000000
--- a/ci/flatpak/docker/README
+++ /dev/null
@@ -1,11 +0,0 @@
-KDE Runtime Docker image based on Ubuntu 18.04
-
-The provided Dockerfile will install the KDE Runtime over the Ubuntu 18.04 base image.
-Also, the obtained Docker image will contain the clone of https://github.com/analogdevicesinc/scopy-flatpak the scopy-flatpak recipe repository which can be found at /home/docker/scopy-flatpak
-
-In order to build the Flatpak package for Scopy inside this Docker image, it needs to be run using "--privileged" (otherwise there is a lack of access to necessary utilities).
-
-We built Scopy Flatpak in this image, then saved the newly created image as alexandratr/scopy-flatpak-bionic:scopy on Dockerhub. However, a clean image (without the Scopy Flatpak build) can be found as alexandratr/scopy-flatpak-bionic:clean on Dockerhub.
-
-Running make inside the scopy-flatpak folder will build the Scopy.flatpak artifact. An example of how to do this is illustrated in the "build_appveyor_flatpak.sh" and "inside_flatpak_docker.sh" scripts (which deploys a Scopy.flatpak for each Appveyor nightly build).
-
diff --git a/ci/flatpak/flatpak_build_process.sh b/ci/flatpak/flatpak_build_process.sh
new file mode 100755
index 0000000000..185dc0f81d
--- /dev/null
+++ b/ci/flatpak/flatpak_build_process.sh
@@ -0,0 +1,60 @@
+#!/bin/bash -xe
+
+SCOPY_DIR=$(git rev-parse --show-toplevel 2>/dev/null ) || \
+SCOPY_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && cd ../../ && pwd )
+
+SCOPY_JSON=$SCOPY_DIR/ci/flatpak/org.adi.Scopy.json
+
+if [ "$CI_SCRIPT" == "ON" ];
+ then
+ SOURCE_DIR=$GITHUB_WORKSPACE
+ # this is needed in order to be used by flatpak caching system
+ # the docker image already contains the built dependencies so we just have to move them
+ cp -r /home/runner/flatpak_tools/.flatpak-builder $SOURCE_DIR/ci/flatpak
+ cp -r /home/runner/flatpak_tools/build $SOURCE_DIR/ci/flatpak
+ else
+ SOURCE_DIR=$SCOPY_DIR
+fi
+
+pushd $SCOPY_DIR/ci/flatpak
+
+git submodule update --init
+
+# Run the preprocess step to generate org.adi.Scopy.json
+make preprocess
+
+# Disable the preprocess step; The Json file will now be modified and
+# we don't want to re-generate it at the build step
+export EN_PREPROCESS=false
+
+# check the number of elements in the json file in order to get the last element, which is Scopy
+cnt=$( echo $(jq '.modules | length' $SCOPY_JSON) )
+cnt=$(($cnt-1))
+
+# We are building in Github Actions and we use the current directory folder on a CLEAN Docker image
+cat $SCOPY_JSON | jq --tab '.modules['$cnt'].sources[0].type = "dir"' > tmp.json
+cp tmp.json $SCOPY_JSON
+cat $SCOPY_JSON | jq --tab '.modules['$cnt'].sources[0].path = "'$SOURCE_DIR'"' > tmp.json
+cp tmp.json $SCOPY_JSON
+cat $SCOPY_JSON | jq --tab 'del(.modules['$cnt'].sources[0].url)' > tmp.json
+cp tmp.json $SCOPY_JSON
+cat $SCOPY_JSON | jq --tab 'del(.modules['$cnt'].sources[0].branch)' > tmp.json
+cp tmp.json $SCOPY_JSON
+rm tmp.json
+
+# Generate build status info for the about page
+echo "Details about the versions of dependencies can be found here" > build-status
+cp build-status $SOURCE_DIR/build-status
+
+# Insert env vars in the sandboxed flatpak build
+# $SOURCE_DIR/ci/general/gen_ci_envs.sh > $SOURCE_DIR/ci/general/gh-actions.envs
+# CI_ENVS=$(jq -R -n -c '[inputs|split("=")|{(.[0]):.[1]}] | add' $SOURCE_DIR/ci/general/gh-actions.envs)
+# echo "CI_ENVS= $CI_ENVS"
+# cat $SCOPY_JSON | jq --tab '."build-options".env += ('$CI_ENVS')' > tmp.json
+# cp tmp.json $SCOPY_JSON
+
+make
+
+# Copy the Scopy.flatpak file in $SOURCE_DIR (which is the external location, mount when docker starts)
+[ -z $CI_SCRIPT ] || cp Scopy.flatpak $SOURCE_DIR/
+popd
diff --git a/ci/flatpak/inside_flatpak_docker.sh b/ci/flatpak/inside_flatpak_docker.sh
deleted file mode 100755
index 738e4183f4..0000000000
--- a/ci/flatpak/inside_flatpak_docker.sh
+++ /dev/null
@@ -1,68 +0,0 @@
-#!/bin/sh -xe
-
-if [ -n "$BRANCH" ]; then
- ARTIFACT_LOCATION=/scopy
-else
- ARTIFACT_LOCATION=$GITHUB_WORKSPACE
-fi
-
-apt-get install -y jq
-
-REPO_LOCAL=/home/docker/scopy-flatpak
-cd "$REPO_LOCAL"
-
-#workaround for https://github.blog/2021-10-18-git-security-vulnerabilities-announced/#cve-2022-39253
-git config --global protocol.file.allow always
-
-# this ensures that latest master is pulled from origin while keeping file cache
-# the cache should be updated from time to time locally
-git fetch && git reset origin/ci-for-scopy2 --hard
-git submodule update --init
-
-# Run the preprocess step to generate org.adi.Scopy.json
-make preprocess
-
-# Disable the preprocess step; The Json file will now be modified and
-# we don't want to re-generate it at the build step
-export EN_PREPROCESS=false
-
-# check the number of elements in the json file in order to get the last element, which is Scopy
-cnt=$( echo $(jq '.modules | length' org.adi.Scopy.json) )
-cnt=$(($cnt-1))
-
-if [ -n "$BRANCH" ]; then
- REPO_URL=https://github.com/"$REPO"
- # We are building in Appveyor and we have access to the current branch on a CACHED Docker image
- # use jq to replace the Scopy branch + the repo url used for building
- # we want to build the branch and repo we're currently on
- cat org.adi.Scopy.json | jq --tab '.modules['$cnt'].sources[0].branch = "'$BRANCH'"' > tmp.json
- cp tmp.json org.adi.Scopy.json
- cat org.adi.Scopy.json | jq --tab '.modules['$cnt'].sources[0].url = "'$REPO_URL'"' > tmp.json
-else
- # We are building in Github Actions and we use the current directory folder on a CLEAN Docker image
- cat org.adi.Scopy.json | jq --tab '.modules['$cnt'].sources[0].type = "dir"' > tmp.json
- cp tmp.json org.adi.Scopy.json
- cat org.adi.Scopy.json | jq --tab '.modules['$cnt'].sources[0].path = "'$GITHUB_WORKSPACE'"' > tmp.json
- cp tmp.json org.adi.Scopy.json
- cat org.adi.Scopy.json | jq --tab 'del(.modules['$cnt'].sources[0].url)' > tmp.json
- cp tmp.json org.adi.Scopy.json
- cat org.adi.Scopy.json | jq --tab 'del(.modules['$cnt'].sources[0].branch)' > tmp.json
-fi
-cp tmp.json org.adi.Scopy.json
-rm tmp.json
-
-# Generate build status info for the about page
-echo "Details about the versions of dependencies can be found here" > build-status
-cp build-status $GITHUB_WORKSPACE/build-status
-
-# Insert env vars in the sandboxed flatpak build
-CI_ENVS=$(jq -R -n -c '[inputs|split("=")|{(.[0]):.[1]}] | add' $GITHUB_WORKSPACE/ci/general/gh-actions.envs)
-echo "CI_ENVS= $CI_ENVS"
-cat org.adi.Scopy.json | jq --tab '."build-options".env += ('$CI_ENVS')' > tmp.json
-cp tmp.json org.adi.Scopy.json
-
-make clean
-make -j4
-
-# Copy the Scopy.flatpak file in $GITHUB_WORKSPACE (which is the external location, mount when docker starts)
-cp Scopy.flatpak $ARTIFACT_LOCATION/
diff --git a/ci/flatpak/org.adi.Scopy.json.c b/ci/flatpak/org.adi.Scopy.json.c
index 933e9ed92b..48de60cfa3 100644
--- a/ci/flatpak/org.adi.Scopy.json.c
+++ b/ci/flatpak/org.adi.Scopy.json.c
@@ -385,8 +385,8 @@
"-DCMAKE_INSTALL_PREFIX:PATH=/app",
"-DENABLE_PYTHON=OFF",
"-DENABLE_CSHARP=OFF",
- "-DENABLE_LOG=ON",
- "-DENABLE_TOOLS=ON",
+ "-DENABLE_TOOLS=OFF",
+ "-DBUILD_EXAMPLES=OFF",
"-DINSTALL_UDEV_RULES=OFF"
],
"sources": [
@@ -495,7 +495,7 @@
{
"type": "git",
"url": "https://github.com/analogdevicesinc/iio-emu",
- "commit": "b8208485f50573a38263031ab05e9cd30712bf0c"
+ "branch": "master"
}
]
},
diff --git a/ci/flatpak/shared-modules b/ci/flatpak/shared-modules
index 83acd36912..29a1c08976 160000
--- a/ci/flatpak/shared-modules
+++ b/ci/flatpak/shared-modules
@@ -1 +1 @@
-Subproject commit 83acd36912481cd9079cf0e65194c1df8d4afb34
+Subproject commit 29a1c08976b5f7085448fadc57362f9ef8d07129