-
Notifications
You must be signed in to change notification settings - Fork 1
140 lines (115 loc) Β· 5.62 KB
/
server.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
name: Server
on:
push:
branches: [ main ]
paths-ignore:
- 'BallanceMMOClient/**'
- '.git*'
- 'README.md'
- '.github/workflows/client.yml'
pull_request:
branches: [ main ]
paths-ignore:
- 'BallanceMMOClient/**'
- '.git*'
- 'README.md'
- '.github/workflows/client.yml'
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
jobs:
build-server-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Fetch git submodules
run: git submodule update --init --recursive
- name: Install dependencies (OpenSSL, Protobuf)
run: sudo apt install libssl-dev libprotobuf-dev protobuf-compiler
- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: |
echo -e "\nfile(WRITE version.txt \${BMMO_VER})" >> CMakeLists.txt
cmake -B ${{github.workspace}}/build -S ${{github.workspace}} -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_SERVER=ON -DBUILD_CLIENT=OFF -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_SERVER_APPIMAGE=ON
echo "BMMO_VER=$(cat version.txt)" >> "$GITHUB_ENV"
echo "SHA_SHORT=$(git rev-parse --short ${{github.sha}})" >> "$GITHUB_ENV"
- name: Build and install
# Build your program with the given configuration
working-directory: ${{github.workspace}}
run: DESTDIR=AppDir cmake --build ./build --config ${{env.BUILD_TYPE}} --target install
- name: Test
working-directory: ${{github.workspace}}
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest -C ${{env.BUILD_TYPE}}
- name: Build AppImage
working-directory: ${{github.workspace}}/build/BallanceMMOServer
run: |
curl -o linuxdeploy.AppImage -L https://github.com/linuxdeploy/linuxdeploy/releases/download/1-alpha-20240109-1/linuxdeploy-x86_64.AppImage
chmod +x linuxdeploy.AppImage
appdeploy=$(./linuxdeploy.AppImage --appimage-extract | grep AppRun | head -n 1)
echo Got linuxdeploy exec entry at $appdeploy
$appdeploy --appdir ../AppDir --output appimage --desktop-file ../../BallanceMMOServer/appimage/BMMOLaunchSelector.desktop --icon-file ../../BallanceMMOServer/appimage/BallanceMMO.svg
- name: Prepare artifact directory and dry run
working-directory: ${{github.workspace}}/build/BallanceMMOServer
run: |
appfile=$(ls BallanceMMOLaunchSelector*.AppImage | awk '{print $1}')
chmod +x $appfile
mkdir artifacts
mv -t artifacts $appfile start_ballancemmo_loop.sh
server_binary=$(artifacts/$appfile --appimage-extract | grep "bin/BallanceMMOServer" | head -n 1)
chmod +x $server_binary && ./$server_binary --dry-run
- name: Release Artifact
uses: actions/upload-artifact@v4
with:
name: server-linux-${{env.BMMO_VER}}-${{env.SHA_SHORT}}
path: build/BallanceMMOServer/artifacts
build-server-windows:
runs-on: windows-latest
env:
VCPKG_ROOT: ${{github.workspace}}/submodule/vcpkg
steps:
- uses: actions/checkout@v4
- uses: lukka/get-cmake@latest
- name: Fetch git submodules
run: git submodule update --init --recursive
# Setup MSVC command prompt environment vars
- uses: ilammy/msvc-dev-cmd@v1
- name: Restore artifacts, setup vcpkg
uses: lukka/run-vcpkg@v11
with:
vcpkgGitCommitId: 861c33057553ee836e7061ffbdabc25ea343145d
vcpkgDirectory: '${{env.VCPKG_ROOT}}'
vcpkgJsonGlob: vcpkg.json
runVcpkgInstall: false
# - name: vcpkg check / install dependencies
# working-directory: ${{env.VCPKG_ROOT}}
# run: vcpkg install --triplet x64-windows
- name: Configure CMake
run: |
echo "`nfile(WRITE version.txt `${BMMO_VER})" | Out-File CMakeLists.txt -Encoding "UTF8" -Append
cmake -B ${{github.workspace}}/build -S ${{github.workspace}} -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_TOOLCHAIN_FILE="${{env.VCPKG_ROOT}}/scripts/buildsystems/vcpkg.cmake" -DVCPKG_MANIFEST_MODE=ON -DVCPKG_MANIFEST_DIR="${{github.workspace}}" -DYAML_BUILD_SHARED_LIBS=ON -DBUILD_SERVER=ON -DBUILD_CLIENT=OFF
echo "BMMO_VER=$(cat version.txt)" >> $env:GITHUB_ENV
echo "SHA_SHORT=$(git rev-parse --short ${{github.sha}})" >> $env:GITHUB_ENV
- name: Build
working-directory: ${{github.workspace}}/build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
# - name: List build dir
# working-directory: ${{github.workspace}}/build
# run: dir
# - name: Run post-build script
# working-directory: ${{github.workspace}}/build/BallanceMMOServer
# run: ${{github.workspace}}/build/BallanceMMOServer/postbuild.bat ${{env.BUILD_TYPE}}
- name: Test
working-directory: ${{github.workspace}}
run: ctest -C ${{env.BUILD_TYPE}}
# by setting a different working directory we avoid releasing the config file
- name: Dry run
working-directory: ${{github.workspace}}/build/BallanceMMOServer
run: ${{env.BUILD_TYPE}}/BallanceMMOServer.exe --dry-run
- name: Release Artifact
uses: actions/upload-artifact@v4
with:
name: server-windows-${{env.BMMO_VER}}-${{env.SHA_SHORT}}
path: build/BallanceMMOServer/${{env.BUILD_TYPE}}