-
Notifications
You must be signed in to change notification settings - Fork 168
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci/flatpak: update scripts to work with current location
Signed-off-by: Bindea Cristian <[email protected]>
- Loading branch information
1 parent
8919443
commit da27e3c
Showing
11 changed files
with
129 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,5 @@ Scopy.flatpak | |
.flatpak-builder | ||
build | ||
repo | ||
org.adi.Scopy.json | ||
org.adi.Scopy.json | ||
tmp.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"] | ||
WORKDIR /home/$USER |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <a href="https://github.com/analogdevicesinc/scopy-flatpak/blob/master/org.adi.Scopy.json.c">here</a>" > 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 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule shared-modules
updated
65 files