-
Notifications
You must be signed in to change notification settings - Fork 10
163 lines (158 loc) · 5.71 KB
/
build.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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
name: build
on:
push:
branches:
- master
jobs:
android:
name: Android
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: recursive
- name: Setup Java
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'temurin'
cache: gradle
- name: Setup Android SDK
uses: android-actions/setup-android@v2
- name: Build Android
run: ./gradlew assembleDebug
working-directory: android
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: Client-Mod-android
path: android/app/build/outputs/apk/debug/app-debug.apk
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
cc: gcc
cxx: g++
- os: ubuntu-latest
cc: clang
cxx: clang++
- os: windows-2019
cc: cl
cxx: cl
env:
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Install development tools
if: startsWith(matrix.os, 'ubuntu')
run: |
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install cmake build-essential gcc-multilib g++-multilib libsdl2-dev:i386
- name: Build on Linux
if: startsWith(matrix.os, 'ubuntu')
run: |
cmake -B build -S . -DBUILD_DISCORD_RPC=ON -DCMAKE_EXE_LINKER_FLAGS="-Wl,--no-undefined" -DCMAKE_INSTALL_PREFIX="$PWD/dist"
cmake --build build --target all
cmake --build build --target install
- name: Build on Linux with vgui
if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.cc, 'gcc')
run: |
cmake -B build-vgui -S . -DUSE_VGUI=ON -DBUILD_DISCORD_RPC=ON -DCMAKE_EXE_LINKER_FLAGS="-Wl,--no-undefined" -DCMAKE_INSTALL_PREFIX="$PWD/dist-vgui"
cp vgui_support/vgui-dev/lib/vgui.so build-vgui/cl_dll
cmake --build build-vgui --target all
cmake --build build-vgui --target install
- name: Add msbuild to PATH
if: startsWith(matrix.os, 'windows')
uses: microsoft/[email protected]
- name: Build on Windows
if: startsWith(matrix.os, 'windows')
run: |
cmake -G "Visual Studio 16 2019" -A Win32 -B build -DBUILD_DISCORD_RPC=ON -DCMAKE_INSTALL_PREFIX="dist"
msbuild -verbosity:normal /property:Configuration=Release build/INSTALL.vcxproj
- name: Build on Windows with vgui
if: startsWith(matrix.os, 'windows')
run: |
cmake -G "Visual Studio 16 2019" -A Win32 -B build -DUSE_VGUI=ON -DBUILD_DISCORD_RPC=ON -DCMAKE_INSTALL_PREFIX="dist-vgui"
msbuild -verbosity:normal /property:Configuration=Release build/INSTALL.vcxproj
- name: Extract branch name
shell: bash
run: echo "branch=$(echo ${GITHUB_REF#refs/heads/} | tr '/' '_')" >> $GITHUB_OUTPUT
id: extract_branch
- name: Extract gamedir
shell: bash
run: echo "gamedir=$(grep build/CMakeCache.txt -Ee 'GAMEDIR:STRING=[a-z]+' | cut -d '=' -f 2)" >> $GITHUB_OUTPUT
id: extract_gamedir
- name: Upload linux artifact
if: startsWith(matrix.os, 'ubuntu') && matrix.cc == 'gcc'
uses: actions/upload-artifact@v3
with:
name: Client-Mod-linux
path: dist/${{ steps.extract_gamedir.outputs.gamedir }}
- name: Upload linux artifact with vgui
if: startsWith(matrix.os, 'ubuntu') && matrix.cc == 'gcc'
uses: actions/upload-artifact@v3
with:
name: Client-Mod-linux-vgui
path: dist-vgui/${{ steps.extract_gamedir.outputs.gamedir }}
- name: Upload windows artifact
if: startsWith(matrix.os, 'windows')
uses: actions/upload-artifact@v3
with:
name: Client-Mod-windows
path: dist/${{ steps.extract_gamedir.outputs.gamedir }}
- name: Upload windows artifact with vgui
if: startsWith(matrix.os, 'windows')
uses: actions/upload-artifact@v3
with:
name: Client-Mod-windows-vgui
path: dist-vgui/${{ steps.extract_gamedir.outputs.gamedir }}
release:
name: Release
runs-on: ubuntu-latest
needs: [android, build]
steps:
- name: Fetch artifacts
uses: actions/[email protected]
with:
path: artifacts
- name: Remove old release
uses: dev-drprasad/[email protected]
with:
tag_name: continuous
delete_release: true
github_token: ${{ secrets.GITHUB_TOKEN }}
repo: Elinsrc/Client-Mod
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Repackage binaries
run: |
cd artifacts/
zip -j Client-Mod-android.zip Client-Mod-android/app-debug.apk
zip -j Client-Mod-linux.zip Client-Mod-linux/cl_dlls/client.so
zip -j Client-Mod-linux-vgui.zip Client-Mod-linux-vgui/cl_dlls/client.so
zip -j Client-Mod-windows.zip Client-Mod-windows/cl_dlls/client.dll
zip -j Client-Mod-windows-vgui.zip Client-Mod-windows-vgui/cl_dlls/client.dll
ls -R .
cd ../
sleep 60s
- name: Upload new release
uses: svenstaro/upload-release-action@v2
with:
repo_name: Elinsrc/Client-Mod
repo_token: ${{ secrets.GITHUB_TOKEN }}
file_glob: true
file: artifacts/*.zip
tag: continuous
overwrite: true
prerelease: true
release_name: Client-Mod continuous build