From 39b7b7d3193b05c8dff7d2927a8ff0c4f19b6705 Mon Sep 17 00:00:00 2001 From: Thomas Rohloff Date: Tue, 24 Jun 2025 11:59:08 +0200 Subject: [PATCH] CI: Add Docker build Signed-off-by: Thomas Rohloff --- .github/workflows/main.yml | 25 ++++++++++++++++++ .gitignore | 3 +-- Dockerfile | 53 ++++++++++++++++++++++++++++++++++++++ build.sh | 17 ++++++++++++ 4 files changed, 96 insertions(+), 2 deletions(-) create mode 100644 Dockerfile create mode 100755 build.sh diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 11b6682c1..44ab56a3f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -296,6 +296,31 @@ jobs: yamls gamecontrollerdb.txt + build-linux-docker: + needs: generate-port-o2r + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - name: Build docker image + if: steps.cache.outputs.cache-hit != 'true' + run: docker build . -t spaghetti + - name: Build AppImage + run: docker run --rm -v ${PWD}:/project spaghetti ./build.sh + - name: Prepare Artifact + run: | + wget -O gamecontrollerdb.txt https://github.com/mdqinc/SDL_GameControllerDB/blob/master/gamecontrollerdb.txt + mv README.md readme.txt + cp build-cmake/*.appimage spaghetti.appimage + - name: Upload build + uses: actions/upload-artifact@v4 + with: + name: Spaghettify-linux + path: | + spaghetti.appimage + config.yml + yamls + gamecontrollerdb.txt + build-switch: needs: generate-port-o2r runs-on: ubuntu-latest diff --git a/.gitignore b/.gitignore index 97b0f0f86..52b37b557 100644 --- a/.gitignore +++ b/.gitignore @@ -110,7 +110,6 @@ mingw64/ # torch torch.hash.yml -build* .idea # the game @@ -125,4 +124,4 @@ cmake-build-*/ .idea/ .vs build*/ -.DS_Store \ No newline at end of file +.DS_Store diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..1df7fe76e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,53 @@ +FROM ubuntu:latest + +# Install dependencies +RUN apt-get update -y && apt-get -y upgrade && apt-get -y install gcc g++ git cmake ninja-build lsb-release libsdl2-dev libsdl2-net-dev libpng-dev libzip-dev zipcmp zipmerge ziptool nlohmann-json3-dev libtinyxml2-dev libspdlog-dev libboost-dev libopengl-dev libogg-dev libvorbis-dev wget file + +# Install latest SDL +RUN wget https://www.libsdl.org/release/SDL2-2.30.3.tar.gz && \ + tar -xzf SDL2-2.30.3.tar.gz && \ + cd SDL2-2.30.3 && \ + ./configure --enable-hidapi-libusb && \ + make -j$(nproc) && \ + make install && \ + cp -av /usr/local/lib/libSDL* /lib/x86_64-linux-gnu/ && \ + cd .. && \ + rm -rf SDL2-2.30.3.tar.gz SDL2-2.30.3 + +# Install latest SDL_net +RUN wget https://www.libsdl.org/projects/SDL_net/release/SDL2_net-2.2.0.tar.gz && \ + tar -xzf SDL2_net-2.2.0.tar.gz && \ + cd SDL2_net-2.2.0 && \ + ./configure && \ + make -j$(nproc) && \ + make install && \ + cp -av /usr/local/lib/libSDL* /lib/x86_64-linux-gnu/ && \ + cd .. && \ + rm -rf SDL2_net-2.2.0.tar.gz SDL2_net-2.2.0 + +# Install latest tinyxml2 +RUN wget https://github.com/leethomason/tinyxml2/archive/refs/tags/10.0.0.tar.gz && \ + tar -xzf 10.0.0.tar.gz && \ + cd tinyxml2-10.0.0 && \ + mkdir -p build && \ + cd build && \ + cmake .. && \ + make -j$(nproc) && \ + make install && \ + cd ../.. && \ + rm -rf 10.0.0.tar.gz tinyxml2-10.0.0 + +# Install libzip without crypto +RUN wget https://github.com/nih-at/libzip/releases/download/v1.10.1/libzip-1.10.1.tar.gz && \ + tar -xzf libzip-1.10.1.tar.gz && \ + cd libzip-1.10.1 && \ + mkdir -p build && \ + cd build && \ + cmake .. -DENABLE_COMMONCRYPTO=OFF -DENABLE_GNUTLS=OFF -DENABLE_MBEDTLS=OFF -DENABLE_OPENSSL=OFF && \ + make -j$(nproc) && \ + make install & \ +# cp -av /usr/local/lib/libzip* /lib/x86_64-linux-gnu/ && \ + cd ../.. && \ + rm -rf libzip-1.10.1.tar.gz libzip-1.10.1 + +WORKDIR /project diff --git a/build.sh b/build.sh new file mode 100755 index 000000000..65fb90e6d --- /dev/null +++ b/build.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +# Init git submodules +git config --global --add safe.directory /project +git submodule update --init + +# Build spaghetti.o2r +cmake -H. -Bbuild-cmake -GNinja -DCMAKE_BUILD_TYPE=Release +cmake --build build-cmake --target GenerateO2R -j$(nproc) + +# Build spaghetti executable +cmake --build build-cmake --config Release -j$(nproc) + +# Pack AppImage +cd build-cmake +cpack -G External +cd ..