forked from wootguy/bspguy
-
Notifications
You must be signed in to change notification settings - Fork 15
217 lines (191 loc) · 7.63 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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
---
name: C/C++ CI
on:
- push
- pull_request
jobs:
get_time_build:
name: TAG NAME
runs-on: ubuntu-latest
outputs:
release_tag: ${{ steps.tag.outputs.release_tag }}
steps:
- name: Generate nightly release tag
id: tag
run: >
echo "release_tag=NightBuild_$(date +"%Y.%m.%d_%H-%M")" >> $GITHUB_OUTPUT
linux_build:
name: Linux
needs: get_time_build
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
outputs:
release_tag: ${{ steps.tag.outputs.release_tag }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup cmake
uses: jwlawson/actions-setup-cmake@v1
with:
cmake-version: latest
- name: Download and install dependencies
run: >
sudo apt update
sudo apt install libxrandr-dev libxkbcommon-dev libxinerama-dev libxcursor-dev libxi-dev libglfw3-dev libglew-dev libxxf86vm-dev libfmt-dev --allow-unauthenticated --fix-missing
- name: Build release
run: |
mkdir build; cd build
cmake .. -DCMAKE_BUILD_TYPE=RELEASE
make
- name: Create Linux release archive
run: |
mkdir -p build/linux_release
cp build/bspguy build/linux_release/
cp -r resources/. build/linux_release/
cd build && zip -r newbspguy_ubuntu_release.zip linux_release/
- name: Publish nightly binaries for linux
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ needs.get_time_build.outputs.release_tag }}
files: |
build/newbspguy_ubuntu_release.zip
window_build:
name: Windows
needs: get_time_build
runs-on: windows-latest
env:
solution: vs-project/bspguy.sln
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: true
- uses: microsoft/setup-msbuild@v2
- name: Install Windows XP Support for Visual Studio
run: |
Set-Location "C:\Program Files (x86)\Microsoft Visual Studio\Installer\"
$InstallPath = "C:\Program Files\Microsoft Visual Studio\2022\Enterprise"
$componentsToAdd = @(
"Microsoft.VisualStudio.Component.WinXP"
)
[string]$workloadArgs = $componentsToAdd | ForEach-Object {" --add " + $_}
$Arguments = ('/c', "vs_installer.exe", 'modify', '--installPath', "`"$InstallPath`"",$workloadArgs, '--quiet', '--norestart', '--nocache')
$process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru -WindowStyle Hidden
if ($process.ExitCode -eq 0)
{
Write-Host "components have been successfully added"
Get-ChildItem C:\ProgramData\Microsoft\VisualStudio\Packages\Microsoft.Windows.XPSupport.*
}
else
{
Write-Host "components were not installed"
exit 1
}
- name: Set up Visual Studio shell
uses: egor-tensin/vs-shell@v2
- name: Build release
run: |
msbuild ${{ env.solution }} -m /p:Configuration=Release /p:Platform=x64
- name: Create Windows release archive
run: >
mkdir -p build\win64_release
cp vs-project\Release\bspguy.exe build\win64_release\
xcopy /I /E /Y "resources\*" "build\win64_release\"
Compress-Archive -Path "build\win64_release\*" -DestinationPath "build\newbspguy_win7_x64_release.zip"
- name: Publish nightly release binaries for windows 7+
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ needs.get_time_build.outputs.release_tag }}
files: |
build/newbspguy_win7_x64_release.zip
- name: Set up Visual Studio shell
uses: egor-tensin/vs-shell@v2
with:
arch: Win32
- name: Build XP
run: |
msbuild ${{ env.solution }} -m /p:Configuration=ReleaseXPx86 /p:Platform=Win32
- name: Create Windows release WinXP archive
run: >
mkdir -p build\win32_release
cp vs-project\Release\bspguy.exe build\win32_release\
xcopy /I /E /Y "resources\*" "build\win32_release\"
Compress-Archive -Path "build\win32_release\*" -DestinationPath "build\newbspguy_winxp_x86_release.zip"
- name: Publish nightly release binaries for windows XP 32bit
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ needs.get_time_build.outputs.release_tag }}
files: |
build/newbspguy_winxp_x86_release.zip
- name: Set up Visual Studio shell
uses: egor-tensin/vs-shell@v2
- name: Clean build directory
run: |
msbuild ${{ env.solution }} /t:Clean /p:Configuration=Debug /p:Platform=x64\
msbuild ${{ env.solution }} /t:Clean /p:Configuration=DebugGithub /p:Platform=x64
- name: Build Debug
run: |
msbuild ${{ env.solution }} -m /p:Configuration=DebugGithub /p:Platform=x64
- name: Create Windows debug archive
run: >
mkdir -p build\win64_debug
cp vs-project\Release\bspguy_debug.exe build\win64_debug\
xcopy /I /E /Y "resources\*" "build\win64_debug\"
Compress-Archive -Path "build\win64_debug\*" -DestinationPath "build\newbspguy_win7_x64_dbg.zip"
- name: Publish nightly debug binaries for windows 7+
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ needs.get_time_build.outputs.release_tag }}
files: |
build/newbspguy_win7_x64_dbg.zip
window_build_gcc:
name: Windows GCC
needs: get_time_build
runs-on: windows-latest
defaults:
run:
shell: msys2 {0}
env:
MINGW64_PREFIX: "C:/msys64/mingw64"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup MinGW GCC
uses: msys2/setup-msys2@v2
with:
release: false
msystem: mingw64
path-type: inherit
update: true
cache: false
location: C:/
pacboy: cc:p cmake:p ninja:p lld:p
install: >-
mingw-w64-x86_64-binutils
- name: Build app for release
run: |
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -G "MinGW Makefiles"
mingw32-make
- name: Create Windows release archive
shell: pwsh
run: >
mkdir -p build\win64_gcc_release
cp build\bspguy.exe build\win64_gcc_release\
cp ${{env.MINGW64_PREFIX}}\bin\libgcc_s_seh-1.dll build\win64_gcc_release\
cp ${{env.MINGW64_PREFIX}}\bin\libwinpthread-1.dll build\win64_gcc_release\
cp ${{env.MINGW64_PREFIX}}\bin\libstdc++-6.dll build\win64_gcc_release\
cp glew\bin\Release\x64\glew32.dll build\win64_gcc_release\
xcopy /I /E /Y "resources\*" "build\win64_gcc_release\"
Compress-Archive -Path "build\win64_gcc_release\*" -DestinationPath "build\newbspguy_win7_x64_gcc_release.zip"
- name: Publish nightly release binaries for windows 7+ GCC
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ needs.get_time_build.outputs.release_tag }}
files: |
build/newbspguy_win7_x64_gcc_release.zip