Skip to content

Fix gns 1.4.1 build issues #172

Fix gns 1.4.1 build issues

Fix gns 1.4.1 build issues #172

Workflow file for this run

on: [push, pull_request, workflow_dispatch]
name: OpenSoldat
jobs:
linux:
runs-on: ubuntu-22.04
steps:
- name: Checkout OpenSoldat code
uses: actions/checkout@v4
- name: Checkout launcher code
uses: actions/checkout@v4
with:
repository: opensoldat/launcher
path: launcher
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install cmake git libprotobuf-dev protobuf-compiler libssl-dev libsdl2-dev libopenal-dev libphysfs-dev libfreetype6 patchelf
- name: Setup Lazarus environment
uses: gcarreno/setup-lazarus@v3.3.1
with:
lazarus-version: "3.0"
#include-packages: "Synapse 40.1"
#with-cache: true
# - name: Install fpc
# run: |
# curl -L -o ./fpc.deb https://sourceforge.net/projects/lazarus/files/Lazarus%20Linux%20amd64%20DEB/Lazarus%202.2.2/fpc-laz_3.2.2-210709_amd64.deb/download
# sudo apt-get install ./fpc.deb
- name: Compile OpenSoldat
run: |
export BUILD_ID=${GITHUB_SHA::8}
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=./opensoldat \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_LIBDIR="." \
-DCMAKE_INSTALL_BINDIR="." \
-DCMAKE_INSTALL_DATADIR="."
make
make install
cd opensoldat
../../.github/workflows/copy-libs.sh . .
cd ..
cmake .. -DBUILD_CLIENT=0 \
-DCMAKE_INSTALL_PREFIX=./OpenSoldatServer \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_LIBDIR="." \
-DCMAKE_INSTALL_BINDIR="." \
-DCMAKE_INSTALL_DATADIR="."
make install
cd OpenSoldatServer
../../.github/workflows/copy-libs.sh . .
- name: Build launcher
run: |
cp -R build/opensoldat/ launcher/
cd launcher
npm ci
npm run make
# We use .tar to preserve file permissions
- name: Tar files
run: |
tar -cvf OpenSoldatServer-linux-x64.tar -C build OpenSoldatServer
- name: Upload game build
uses: actions/upload-artifact@v4
with:
name: linux-build
path: launcher/out/make/zip/linux/x64/
- name: Upload server-only build
uses: actions/upload-artifact@v4
with:
name: linux-server-build
path: OpenSoldatServer-linux-x64.tar
windows:
runs-on: windows-latest
steps:
- name: Checkout OpenSoldat code
uses: actions/checkout@v4
- name: Checkout launcher code
uses: actions/checkout@v4
with:
repository: opensoldat/launcher
path: launcher
#- name: Cache fpc
# id: fpc
# uses: actions/cache@v4
# with:
# path: C:\fpc
# key: freepascal-3.2.2
- name: Cache vcpkg
id: vcpkg-cache
uses: actions/cache@v4
with:
path: C:\vcpkg\installed
key: vcpkg-cache
# - name: Download freepascal
# if: steps.fpc.outputs.cache-hit != 'true'
# run: |
# curl -o C:\fpc64.exe ftp://mirror.freemirror.org/pub/fpc/dist/3.2.2/i386-win32/fpc-3.2.2.win32.and.win64.exe
# - name: Install freepascal
# if: steps.fpc.outputs.cache-hit != 'true'
# run: |
# C:\fpc64.exe /silent /nocancel /suppressmsgboxes=no
# shell: cmd
- name: Setup Lazarus environment
uses: gcarreno/setup-lazarus@v3.3.1
with:
lazarus-version: "3.0"
#include-packages: "Synapse 40.1"
with-cache: false
- name: Install dependencies
run: |
vcpkg.exe --triplet x64-windows install sdl2 physfs openssl protobuf freetype openal-soft
- name: Build OpenSoldat
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
set PATH=%PATH%;C:\fpc\3.2.2\bin\i386-win32
set OPENSSL_ROOT_DIR=C:\vcpkg\installed\x64-windows
set PHYSFSDIR=C:\vcpkg\installed\x64-windows
set BUILD_ID=%GITHUB_SHA:~0,8%
mkdir build
cd build
cmake -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX=..\launcher\opensoldat -DCROSS_WINDOWS_64=1 -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE="C:\vcpkg\scripts\buildsystems\vcpkg.cmake" -DSDL2_BUILDING_LIBRARY=1 ..
nmake
nmake install
cmake -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX=.\OpenSoldatServer-win32-x64 -DCROSS_WINDOWS_64=1 -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE="C:\vcpkg\scripts\buildsystems\vcpkg.cmake" -DSDL2_BUILDING_LIBRARY=1 -DBUILD_CLIENT=0 ..
nmake
nmake install
shell: cmd
- name: Build launcher
run: |
cd launcher
npm ci
npm run make
- uses: actions/upload-artifact@v4
with:
name: windows-build
path: launcher/out/make/zip/win32/x64/
- uses: actions/upload-artifact@v4
with:
name: OpenSoldatServer-win32-x64
path: build/OpenSoldatServer-win32-x64
macos:
runs-on: macos-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: true
- name: Install dependencies
run: |
brew install openssl@3 protobuf fpc cmake sdl2 physfs freetype2
- name: Compile OpenSoldat
run: |
export BUILD_ID=${GITHUB_SHA::8}
mkdir build
cd build
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/opt/openssl@3/lib/pkgconfig
cmake -DCMAKE_INSTALL_PREFIX=./OpenSoldat-macos-x64 -DOPENSSL_ROOT_DIR=$(brew --prefix openssl@3) .. -DCMAKE_BUILD_TYPE="Release"
make
make install
- uses: actions/upload-artifact@v4
with:
name: OpenSoldat-macos-x64
path: build/OpenSoldat-macos-x64
continuous:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/develop'
needs: [linux, windows, macos]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
- name: Zip build dirs back together
run: |
ls
zip -r OpenSoldat-macos-x64.zip OpenSoldat-macos-x64
zip -r OpenSoldatServer-win32-x64.zip OpenSoldatServer-win32-x64
- name: Upload release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if ! git show-ref --tags continuous &>/dev/null; then
gh release delete continuous --yes || echo "Failed to delete GitHub release. Ignoring."
git tag --delete continuous || echo "Failed to delete local tag. Ignoring."
git push --delete origin continuous || echo "Failed to delete remote tag. Ignoring."
fi
git tag continuous
git push --tags origin continuous
gh release create continuous \
windows-build/*.zip \
OpenSoldatServer-win32-x64.zip \
OpenSoldat-macos-x64.zip \
linux-build/*.zip \
linux-server-build/*.tar \
--notes "OpenSoldat 1.8 alpha dev build" \
--title "OpenSoldat 1.8 alpha dev build"