-
Notifications
You must be signed in to change notification settings - Fork 3
243 lines (212 loc) · 7.02 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
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
name: build
on:
# Run on pushes to tags, the "master" branch, and PR's
push:
tags-ignore:
branches:
- master
paths-ignore:
- '**.md'
- '*.txt'
- '.gitignore'
- 'docs/*'
pull_request:
paths-ignore:
- '**.md'
- '*.txt'
- '.gitignore'
- 'docs/*'
workflow_dispatch:
jobs:
windows-mingw:
name: ${{ matrix.config }} Windows ${{ matrix.arch }}
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
#arch: [arm64, x86, x64]
arch: [x86, x64]
cc: [gcc]
cxx: [g++]
config: [Release]
include:
# - arch: arm64
# platform: ARM64
# suffix: .arm64
- arch: x86
platform: Win32
msystem: MINGW32
prefix: mingw-w64-i686
- arch: x64
platform: Win64
msystem: MINGW64
prefix: mingw-w64-x86_64
- config: Release
rule: install
#- arch: x64
# platform: x64
# suffix: .x86_64
steps:
- uses: msys2/setup-msys2@v2
with:
install: ${{ matrix.prefix }}-binutils ${{ matrix.prefix }}-make ${{ matrix.prefix }}-${{ matrix.cc }} ${{ matrix.prefix }}-ninja
msystem: ${{ matrix.msystem }}
path-type: minimal
release: false
update: false
- name: Configure MinGW for ${{ matrix.arch }} into PATH
shell: bash
run: |
if [ ${{ matrix.arch }} == "x86" ]; then
echo "C:\msys64\mingw32\bin" >> $GITHUB_PATH
else
echo "C:\msys64\mingw64\bin" >> $GITHUB_PATH
fi
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Create Build Directory
working-directory: ${{github.workspace}}/code
run: cmake -E make_directory ${{github.workspace}}/code/bin
- name: Configure CMake (x86)
working-directory: ${{github.workspace}}/code/bin
if: ${{ matrix.arch == 'x86' }}
run: cmake .. -G "Ninja" -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DCMAKE_TOOLCHAIN_FILE=${{github.workspace}}/code/cmake/toolchains/i686-w64-mingw32-github.cmake
- name: Configure CMake (x64)
working-directory: ${{github.workspace}}/code/bin
if: ${{ matrix.arch == 'x64' }}
run: cmake .. -G "Ninja" -DCMAKE_BUILD_TYPE=${{ matrix.config }}
- name: Build
working-directory: ${{github.workspace}}/code/bin
run: cmake --build . --config ${{ matrix.config }} --parallel
- uses: actions/upload-artifact@v2
if: ${{ matrix.config == 'Release' }}
with:
name: windows-${{ matrix.arch }}
path: |
code/bin/*.dll
if-no-files-found: error
retention-days: 5
ubuntu-x86:
name: ${{ matrix.config }} Ubuntu ${{ matrix.arch }}
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
arch: [x86, x86_64]
cc: [gcc]
cxx: [g++]
config: [Release]
include:
- config: Release
rule: install
- arch: x86
- arch: x86_64
steps:
- name: Install tools
run: |
if [ ${{ matrix.arch }} == "x86" ]; then
sudo dpkg --add-architecture i386
sudo apt-get -qq update
sudo apt-get -y install gcc-multilib g++-multilib ninja-build
else
sudo apt-get -qq update
sudo apt-get -y install ninja-build
fi
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Create Build Directory
working-directory: ${{github.workspace}}/code
run: cmake -E make_directory ${{github.workspace}}/code/bin
- name: Configure CMake
working-directory: ${{github.workspace}}/code/bin
run: |
if [ ${{ matrix.arch }} == "x86" ]; then
cmake .. -G "Ninja" -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/linux-i686.cmake
else
cmake .. -G "Ninja" -DCMAKE_BUILD_TYPE=${{ matrix.config }}
fi
- name: Build
working-directory: ${{github.workspace}}/code/bin
run: cmake --build . --config ${{ matrix.config }} --parallel
- uses: actions/upload-artifact@v2
if: matrix.cc == 'gcc' && matrix.config == 'Release'
with:
name: linux-${{ matrix.arch }}
path: |
code/bin/*.so
if-no-files-found: error
retention-days: 5
macos-x86:
name: ${{ matrix.config }} macOS x86_64
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
arch: [x86_64]
cc: [clang]
cxx: [clang++]
config: [Release]
include:
- config: Release
rule: install
steps:
- name: Install tools
run: brew install coreutils ninja
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Create Build Directory
working-directory: ${{github.workspace}}/code
run: cmake -E make_directory ${{github.workspace}}/code/bin
- name: Configure CMake
working-directory: ${{github.workspace}}/code/bin
run: cmake .. -G "Ninja" -DCMAKE_BUILD_TYPE=${{ matrix.config }}
- name: Build
working-directory: ${{github.workspace}}/code/bin
run: cmake --build . --config ${{ matrix.config }} --parallel
- uses: actions/upload-artifact@v2
if: matrix.cc == 'clang' && matrix.config == 'Release'
with:
name: macos-${{ matrix.arch }}
path: |
code/bin/*_mac
if-no-files-found: error
retention-days: 5
create-testing:
if: github.ref == 'refs/heads/master' && github.event_name == 'push' || github.event_name == 'workflow_dispatch'
needs: [windows-mingw, ubuntu-x86, macos-x86]
runs-on: ubuntu-latest
steps:
- name: Download Artifacts
uses: actions/download-artifact@v2
- name: Create binary archives
run: |
mkdir -p etf
mv -t ./etf/ ./linux-x86/*.so
mv -t ./etf/ ./linux-x86_64/*.so
mv -t ./etf/ ./windows-x86/*.dll
mv -t ./etf/ ./windows-x64/*.dll
mv -t ./etf/ ./macos-x86_64/*_mac
cd etf
7z a -r -tzip mp_bin.pk3 ./cgame*.so
7z a -r -tzip mp_bin.pk3 ./ui*.so
7z a -r -tzip mp_bin.pk3 ./cgame*.dll
7z a -r -tzip mp_bin.pk3 ./ui*.dll
7z a -r -tzip mp_bin.pk3 ./cgame_mac
7z a -r -tzip mp_bin.pk3 ./ui_mac
cd ..
7z a -r etf-2.0-all-test-latest.zip ./etf/*.pk3
7z a -r etf-2.0-all-test-latest.zip ./etf/*.so
7z a -r etf-2.0-all-test-latest.zip ./etf/*.dll
7z a -r etf-2.0-all-test-latest.zip ./etf/*_mac
- name: Create latest build
uses: marvinpinto/action-automatic-releases@6273874b61ebc8c71f1a61b2d98e234cf389b303
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
automatic_release_tag: "latest"
prerelease: false
title: Latest Build
files: |
*.zip