Skip to content
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
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Dockerfile
.dockerignore
build
112 changes: 112 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
name: ci

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

env:
BASE_IMAGE: sadraiiali/rcssserver
BASE_TAG: latest
RELEASE_PREFIX: "rcssserver-"

jobs:

docker:
runs-on: ubuntu-latest
name: Build & Push Docker
if: github.ref == 'refs/heads/master'
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- 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: Build and push RCSSServer
uses: docker/build-push-action@v5
with:
context: .
file: ./utils/docker/Dockerfile
push: true
tags: "${{ env.BASE_IMAGE }}:latest,${{ env.BASE_IMAGE }}:ubuntu-24-${{ steps.cmake_version.outputs.version }}"

- name: Docker Hub Description
uses: peter-evans/dockerhub-description@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
repository: ${{ env.BASE_IMAGE }}
readme-filepath: utils/docker/README.md
short-description: "RoboCup Soccer Simulator Server"

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

# ------------------------------------------- Ubuntu 20.04 AppImage
- name: Prepare builder image for 20.04
run: |
docker build -t builder-image:2004 -f ./utils/appimage/Dockerfile.builder-2004 .

- name: Build app image on 20.04
run: |
docker run --privileged --name builder-2004 \
builder-image:2004 /rcssserver/utils/appimage/build_appimage.sh
docker cp builder-2004:/rcssserver-x86_64.AppImage ${{ github.workspace }}/artifact/rcssserver-${{ steps.cmake_version.outputs.version }}-x86_64.AppImage

# ------------------------------------------- Artifact
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: rcssserver-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/rcssserver-${{ 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 }}
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
build
*.o
*.so
*.a
.vscode/
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ project(RCSSServer VERSION 18.1.3)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -lstdc++fs")


if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE)
endif()
Expand Down Expand Up @@ -34,6 +37,8 @@ check_include_file_cxx("unistd.h" HAVE_UNISTD_H)
check_include_file_cxx("poll.h" HAVE_POLL_H)
check_include_file_cxx("pwd.h" HAVE_PWD_H)



configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake config.h)

add_subdirectory(rcss)
Expand Down
36 changes: 36 additions & 0 deletions utils/appimage/Dockerfile.builder-1804
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
FROM ubuntu:18.04

COPY . /rcssserver

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 \
libfuse-dev \
zlib1g-dev

RUN cd /rcssserver && \
find . -type f -name "*.cpp" -exec sed -i 's/#include <filesystem>/#include <experimental\/filesystem>/g' {} \; && \
find . -type f -name "*.h" -exec sed -i 's/#include <filesystem>/#include <experimental\/filesystem>/g' {} \; && \
find . -type f -name "*.hpp" -exec sed -i 's/#include <filesystem>/#include <experimental\/filesystem>/g' {} \; && \
find . -type f -name "*.cpp" -exec sed -i 's/std::filesystem/std::experimental::filesystem/g' {} \; && \
find . -type f -name "*.h" -exec sed -i 's/std::filesystem/std::experimental::filesystem/g' {} \; && \
find . -type f -name "*.hpp" -exec sed -i 's/std::filesystem/std::experimental::filesystem/g' {} \; && \
mkdir build && \
cd build && \
cmake .. && \
make && \
cd ..
30 changes: 30 additions & 0 deletions utils/appimage/Dockerfile.builder-2004
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
FROM ubuntu:20.04

COPY . /rcssserver

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 \
libfuse-dev \
zlib1g-dev

RUN cd /rcssserver && \
mkdir build && \
cd build && \
cmake .. && \
make && \
cd ..
24 changes: 24 additions & 0 deletions utils/appimage/Dockerfile.builder-2404
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM ubuntu:24.04

COPY . /rcssserver

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 \
libfuse-dev

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

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

SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
BUILD_PWD="${SCRIPT_DIR}/../../build"
APP_IMAGE_DIR="${SCRIPT_DIR}"


# find libc and libstdc++ libz dependencies
LIBSTDCPP_PATH=$(ldd $BUILD_PWD/rcssserver | grep libstdc++ | awk '{ print $3 }')
LIBZ_PATH=$(ldd $BUILD_PWD/rcssserver | grep libz.so | awk '{ print $3 }')
LIBRCSSCLANGPARSER_PATH=$(ldd $BUILD_PWD/rcssserver | grep librcssclangparser.so | awk '{ print $3 }')
LIBRCSSCONFPARSER_PATH=$(ldd $BUILD_PWD/rcssserver | grep librcssconfparser.so | awk '{ print $3 }')
LIBRCSSGZ_PATH=$(ldd $BUILD_PWD/rcssserver | grep librcssgz.so | awk '{ print $3 }')
LIBRCSSNET_PATH=$(ldd $BUILD_PWD/rcssserver | grep librcssnet.so | awk '{ print $3 }')

echo "LIBSTDCPP_PATH=" $LIBSTDCPP_PATH
echo "LIBZ_PATH=" $LIBZ_PATH
echo "LIBRCSSCLANGPARSER_PATH=" $LIBRCSSCLANGPARSER_PATH
echo "LIBRCSSCONFPARSER_PATH=" $LIBRCSSCONFPARSER_PATH
echo "LIBRCSSGZ_PATH=" $LIBRCSSGZ_PATH
echo "LIBRCSSNET_PATH=" $LIBRCSSNET_PATH

./linuxdeploy-x86_64.AppImage --appdir ./rcssserver-x86_64 \
-e $BUILD_PWD/rcssserver \
-l $LIBRCSSCLANGPARSER_PATH \
-l $LIBRCSSCONFPARSER_PATH \
-l $LIBRCSSGZ_PATH \
-l $LIBRCSSNET_PATH \
-l $LIBSTDCPP_PATH \
-l $LIBZ_PATH \
-d $APP_IMAGE_DIR/rcssserver.desktop \
-i $APP_IMAGE_DIR/rcssserver.png \
--output appimage
echo "App Image Created."
8 changes: 8 additions & 0 deletions utils/appimage/build_code.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash
set -e

mkdir build
cd build
cmake -DCMAKE_CXX_STANDARD=17 ..
make
cd ..
14 changes: 14 additions & 0 deletions utils/appimage/rcssserver.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[Desktop Entry]
Version=1.0
Type=Application
Name=rcssserver
Comment=Robocup 2D Soccer Simulation Server
TryExec=rcssserver
Exec=rcssserver
Icon=rcssserver
MimeType=image/x-foo;
Categories=Development;
X-KDE-Library=librcssserver
X-KDE-FactoryName=rcssserverfactory
X-KDE-ServiceType=RcssserverService

Binary file added utils/appimage/rcssserver.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
60 changes: 60 additions & 0 deletions utils/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#------------------------------------------------------
# build stage
#------------------------------------------------------

FROM ubuntu:24.04 AS BUILD

WORKDIR /rcssserver

# set environment variables
ENV config_file=server.conf \
DATE_FORMAT="%Y%m%d%H%M%S" \
VERSION=18.1.3


# install dependencies
RUN apt-get clean && apt-get update --allow-insecure-repositories && \
DEBIAN_FRONTEND="noninteractive" apt-get -y install \
tzdata \
sudo \
gcc \
g++ \
wget \
flex \
bison \
libboost-all-dev \
automake \
make \
cmake \
iputils-ping

# copy rcssserver source code
#COPY [ "./src", "./rcss", "./m4", "config*","Make*" , "CMake*", "/rcssserver/"]
COPY . /rcssserver/

# make and install rcssserver
RUN cd /rcssserver/ \
&& ./bootstrap \
&& ./configure --prefix=`pwd`/server-bin \
&& make \
&& make install \
&& ldconfig




#------------------------------------------------------
# run stage
#------------------------------------------------------
FROM ubuntu:24.04 AS RUN

ENV LD_LIBRARY_PATH=/app/server-bin/lib:/usr/local/lib:/usr/lib:/lib \
PATH=/app/server-bin/bin:$PATH

WORKDIR /app

COPY --from=BUILD /rcssserver/server-bin /app/server-bin

COPY utils/docker/docker-entrypoint.sh /app/docker-entrypoint.sh

CMD [ "bash", "/app/docker-entrypoint.sh" ]
Loading