Skip to content
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

pipeline - automatic appimage and release creator #68

Open
wants to merge 2 commits into
base: master
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
70 changes: 70 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: ci

on:
push:
branches:
- "*"
tags:
- "*"


env:
release-prefix: "soccerwindow2-"


jobs:
app-image:
runs-on: ubuntu-latest
name: Build AppImage
steps:
- uses: actions/checkout@v4

- name: Create release folder
run: |
mkdir -p ${{ github.workspace }}/artifact

- name: Find CMakeLists.txt version
id: cmake_version
run: |
cmake_version=$(grep -oP 'project\(.* VERSION \K[0-9]+\.[0-9]+\.[0-9]+' CMakeLists.txt)
echo "version=${cmake_version}" >> $GITHUB_OUTPUT

- name: Create builder-image
run: |
docker build -t builder-image:2004 -f ./utils/appimage/Dockerfile.builder-2004 .


# ------------------------------------------- Ubuntu 20.04 AppImage
- name: Build app image on 20.04
run: |
docker run --privileged --name builder-2004 builder-image:2004 /soccerwindow2/utils/appimage/docker-entrypoint.sh

docker cp builder-2004:/soccerwindow2/build/soccerwindow2-x86_64.AppImage \
${{ github.workspace }}/artifact/soccerwindow2-${{ steps.cmake_version.outputs.version }}-x86_64.AppImage

# ------------------------------------------- Artifact
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: soccerwindow2-x86_64
path: ${{ github.workspace }}/artifact/*
retention-days: 5

- name: Check if there is no release with the same tag
id: check_release
run: |
out=$(curl -s -o /dev/null -w "%{http_code}" https://api.github.com/repos/${{ github.repository }}/releases/tags/${{ steps.cmake_version.outputs.version }})
echo "release_exists=${out}" >> $GITHUB_OUTPUT


# ------------------------------------------- Release
- name: Create Release
if: ${{ steps.check_release.outputs.release_exists == '404' }}
id: create_release
uses: ncipollo/release-action@v1
with:
artifacts: "${{ github.workspace }}/artifact/soccerwindow2-${{ steps.cmake_version.outputs.version }}-x86_64.AppImage"
token: ${{ secrets.GITHUB_TOKEN }}
body: "TBD"
name: "${{ env.release-prefix }}${{ steps.cmake_version.outputs.version }}"
tag: ${{ steps.cmake_version.outputs.version }}
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.5)

project(soccerwindow2 VERSION 2023)
project(soccerwindow2 VERSION 2.0.0)

if(CMAKE_VERSION VERSION_LESS "3.7.0")
set(CMAKE_INCLUDE_CURRENT_DIR ON)
Expand All @@ -23,6 +23,7 @@ endif()
# check librcsc
set(LIBRCSC_INSTALL_DIR "$ENV{HOME}/.local;$ENV{HOME}/local" CACHE PATH "The path where librcsc is installed.")


find_library(LIBRCSC_LIB NAMES rcsc
PATHS ${LIBRCSC_INSTALL_DIR}
PATH_SUFFIXES lib
Expand Down
37 changes: 37 additions & 0 deletions utils/appimage/Dockerfile.builder-2004
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
FROM ubuntu:20.04

RUN apt-get clean && apt-get update --allow-insecure-repositories && \
DEBIAN_FRONTEND="noninteractive" apt-get -y install \
tzdata \
gcc \
g++ \
wget \
libfl-dev \
flex \
bison \
libboost-all-dev \
automake \
make \
cmake \
iputils-ping \
build-essential \
libtool \
fuse \
tree \
libfuse-dev \
zlib1g-dev \
qt5-default \
libfontconfig1-dev \
libaudio-dev \
libxt-dev \
libglib2.0-dev \
libxi-dev \
libxrender-dev \
autoconf \
git

WORKDIR /soccerwindow2

COPY . /soccerwindow2


37 changes: 37 additions & 0 deletions utils/appimage/build_appimage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash
set -e


SCRIPT_DIR="$(pwd)/build"
M_BUILD_PWD="$SCRIPT_DIR/soccerwindow2-bin"
BIN_PATH="$M_BUILD_PWD/bin/soccerwindow2"
APP_IMAGE_DIR="$SCRIPT_DIR/appimage"

cd $SCRIPT_DIR

wget -c "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage" -O linuxdeploy-x86_64.AppImage
wget -c "https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage" -O linuxdeploy-plugin-qt-x86_64.AppImage
chmod +x linuxdeploy-x86_64.AppImage
chmod +x linuxdeploy-plugin-qt-x86_64.AppImage


rm -rf $APP_IMAGE_DIR || true
mkdir -p $APP_IMAGE_DIR || true



# ------ LIBRARIES
LIBZ_PATH=$(ldd $BIN_PATH | grep libz.so | awk '{ print $3 }')
LIBRCSC_PATH=$(ldd $BIN_PATH | grep librcsc.so | awk '{ print $3 }')

./linuxdeploy-x86_64.AppImage --appdir $APP_IMAGE_DIR \
--plugin qt \
-l $LIBZ_PATH \
-l $LIBRCSC_PATH \
--executable $M_BUILD_PWD/bin/soccerwindow2 \
--desktop-file $SCRIPT_DIR/soccerwindow2.desktop \
--icon-file $SCRIPT_DIR/soccerwindow2.png \
--output appimage



15 changes: 15 additions & 0 deletions utils/appimage/build_code.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash
set -e

WORKDIR="$(pwd)"

BUILD_PWD="$WORKDIR/build"
MONITOR_BIN_PATH="$BUILD_PWD/soccerwindow2-bin"
mkdir -p $MONITOR_BIN_PATH
autoreconf -i
automake --add-missing
$WORKDIR/configure --prefix="$MONITOR_BIN_PATH"
make -j$(nproc)
make install
cp $WORKDIR/utils/appimage/soccerwindow2.desktop $BUILD_PWD
cp $WORKDIR/utils/appimage/soccerwindow2.png $BUILD_PWD
25 changes: 25 additions & 0 deletions utils/appimage/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/sh
set -e

LIBRCSC_REPO="https://github.com/helios-base/librcsc"
LIBRCSC_BRANCH="master"

git clone --depth 1 --branch $LIBRCSC_BRANCH $LIBRCSC_REPO /librcsc

cd /librcsc
./bootstrap
./configure --prefix=/$(whoami)/.local
make -j$(nproc)
make install
cd ..

# if there was ~/.local/lib just put it in the LD_LIBRARY_PATH
if [ -d /$(whoami)/.local/lib ]; then
echo "/$(whoami)/.local/lib" > /etc/ld.so.conf.d/$(whoami)-local.conf
ldconfig
fi

cd /soccerwindow2

bash /soccerwindow2/utils/appimage/build_code.sh
bash /soccerwindow2/utils/appimage/build_appimage.sh
14 changes: 14 additions & 0 deletions utils/appimage/soccerwindow2.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[Desktop Entry]
Version=1.0
Type=Application
Name=soccerwindow2
Comment=Robocup 2D Soccer Simulation Soccerwindow 2
TryExec=soccerwindow2
Exec=soccerwindow2
Icon=soccerwindow2
MimeType=image/x-foo;
Categories=Development;
X-KDE-Library=libsoccerwindow2
X-KDE-FactoryName=soccerwindow2factory
X-KDE-ServiceType=soccerwindow2Service

Binary file added utils/appimage/soccerwindow2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.