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

test #1

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

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


env:
BASE_IMAGE: crosslanguagesoccerframework/rcssserver
BASE_TAG: latest

jobs:
docker:
runs-on: ubuntu-latest
name: Build & Push Docker
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: Find CMakeLists.txt version
id: cmake_version
run: |
cmake_version=$(grep -oP 'project\(.* VERSION \K[0-9]+\.[0-9]+\.[0-9]+' CMakeLists.txt)
echo "::set-output name=version::${cmake_version}"

- name: Check if the version tag exist git then skip
id: check_tag
run: |
git tag -l | grep -q "${{ steps.cmake_version.outputs.version }}" && echo "Tag already exists" && exit 1 || echo "Tag does not exist"
continue-on-error: true

- name: tag the version
if: steps.check_tag.outcome == 'success'
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub Action"
git tag -a "${{ steps.cmake_version.outputs.version }}" -m "Version ${{ steps.cmake_version.outputs.version }}"
git push origin "${{ steps.cmake_version.outputs.version }}"

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

- 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 "::set-output name=version::${cmake_version}"

# ------------------------------------------- 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-x86_64-${{ steps.cmake_version.outputs.version }}.AppImage

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

- name: List files in artifact directory
run: ls -l ${{ github.workspace }}/artifact/

- name: Check if there is no release with the same tag
id: check_release
run: |
result=$(curl -s -o /dev/null -w "%{http_code}" https://api.github.com/repos/${{ github.repository }}/releases/tags/${{ github.ref_name }} -u ${{ secrets.GITHUB_TOKEN }})
echo "::set-output name=release_exists::$result"

# ------------------------------------------- Release
- name: Create Release
id: create_release
uses: ncipollo/release-action@v1
if: steps.check_release.outputs.release_exists == '404'
with:
artifacts: "${{ github.workspace }}/artifact/*"
token: ${{ secrets.GITHUB_TOKEN }}
tag: "${{ steps.cmake_version.outputs.version }}"
release_name: "${{ steps.cmake_version.outputs.version }}"
release_body: "RoboCup Soccer Simulator Server"
draft: false
prerelease: false
33 changes: 31 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# RoboCup Soccer Simulator Server
# :soccer: RoboCup Soccer Simulator Server

[![CircleCI](https://circleci.com/gh/rcsoccersim/rcssserver/tree/master.svg?style=svg)](https://circleci.com/gh/rcsoccersim/rcssserver/tree/master)
![License](https://img.shields.io/github/license/rcsoccersim/rcssserver.svg)
Expand All @@ -9,7 +9,36 @@ The RoboCup Soccer Simulator Server (rcssserver) is a research and educational t

For further reading, please check [the user's manual](https://rcsoccersim.readthedocs.io/).

## :soccer: Quick Start
There are three different solutions to run the RoboCup Soccer Simulator Server.
- Download the AppImage release and run (Linux, Windows WSL)
- Build from source and run (Linux, Windows WSL)
- Use Docker Image

## :gift_heart: AppImage
#### Download AppImage
Download "rcssserver-x86_64-?.?.?.AppImage" from the (release page)[https://github.com/CLSFramework/rcssserver/releases] / latest version
or use the below command to download the latest version of AppImage:
```bash
wget $(curl -s https://api.github.com/repos/clsframework/rcssserver/releases/latest | grep -oP '"browser_download_url": "\K(.*rcssserver-x86_64-.*\.AppImage)' | head -n 1)
```

#### Install dependency and update permission

then you need to update the permission of the AppImage and install fuse:
```bash
sudo apt update
sudo apt-get install fuse
chmod +x rcssserver-x86_64-*.AppImage
```

#### Run

to run the AppImage:
```bash
./rcssserver-x86_64-?.?.?.AppImage
```

## :wrench: Build From Source

rcssserver is implemented by C++14 and depends some libraries.
Make sure you have the required dependencies installed on your system:
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 . /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
Loading