forked from OrfeasZ/ZHMTools
-
Notifications
You must be signed in to change notification settings - Fork 0
231 lines (198 loc) · 6.37 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
name: Build
on:
push:
branches:
- master
tags:
- v*
pull_request:
types: [ opened, synchronize, reopened ]
jobs:
build_windows:
name: Build (Windows)
runs-on: [ windows-latest ]
steps:
- name: Get latest CMake and ninja
uses: lukka/get-cmake@latest
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup VS environment
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64
- name: Generate projects
run: |
mkdir _build
cd _build
cmake -G Ninja `
-DCMAKE_BUILD_TYPE=RelWithDebInfo `
-DCMAKE_CXX_COMPILER=cl `
-DCMAKE_C_COMPILER=cl `
..
- name: Build
run: |
cmake --build _build -j2
- name: Copy ResourceTool artifacts
run: |
cd _build
mkdir _resourcetool
Copy-Item ResourceTool.exe -Destination _resourcetool/
robocopy ./ ./_resourcetool ResourceLib*.dll ResourceLib*.pdb; if ($lastexitcode -lt 8) { $global:LASTEXITCODE = $null }
Copy-Item ../LICENSE -Destination _resourcetool/
- name: Copy CodeGen artifacts
run: |
cd _build
mkdir _codegen
Copy-Item CodeGen.exe -Destination _codegen/
Copy-Item CodeGen.pdb -Destination _codegen/
Copy-Item CodeGenLib.dll -Destination _codegen/
Copy-Item CodeGenLib.pdb -Destination _codegen/
Copy-Item PropertyBundler.exe -Destination _codegen/
Copy-Item PropertyBundler.pdb -Destination _codegen/
Copy-Item ../LICENSE -Destination _codegen/
- name: Copy ResourceLib artifacts
run: |
cd _build
mkdir _resourcelib
mkdir _resourcelib/Include
robocopy ./ ./_resourcelib ResourceLib*.dll ResourceLib*.pdb ResourceLib*.lib; if ($lastexitcode -lt 8) { $global:LASTEXITCODE = $null }
Copy-Item ../Libraries/ResourceLib/Include/* -Destination _resourcelib/Include/
Copy-Item ../Libraries/ResourceLib/ResourceLib.cs -Destination _resourcelib/
Copy-Item ../LICENSE -Destination _resourcelib/
- name: Copy NavTool artifacts
run: |
cd _build
mkdir _navtool
Copy-Item NavTool.exe -Destination _navtool/
Copy-Item NavTool.pdb -Destination _navtool/
Copy-Item NavWeakness.dll -Destination _navtool/
Copy-Item NavWeakness.lib -Destination _navtool/
Copy-Item NavWeakness.pdb -Destination _navtool/
Copy-Item ../LICENSE -Destination _navtool/
- name: Archive ResourceTool
uses: actions/upload-artifact@v4
with:
name: ResourceTool-win-x64
path: |
_build/_resourcetool/*
- name: Archive CodeGen
uses: actions/upload-artifact@v4
with:
name: CodeGen-win-x64
path: |
_build/_codegen/*
- name: Archive ResourceLib
uses: actions/upload-artifact@v4
with:
name: ResourceLib-win-x64
path: |
_build/_resourcelib/*
- name: Archive NavWeakness
uses: actions/upload-artifact@v2
with:
name: NavWeakness-win-x64
path: |
_build/_navweakness/*
- name: Archive NavTool
uses: actions/upload-artifact@v2
with:
name: NavTool-win-x64
path: |
_build/_navtool/*
build_linux:
name: Build (Linux)
runs-on: [ ubuntu-22.04 ]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Clang
uses: egor-tensin/setup-clang@v1
with:
version: 17
platform: x64
- name: Generate projects
run: |
mkdir _build
cd _build
cmake -G "Unix Makefiles" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_COMPILER=clang++-17 \
-DCMAKE_C_COMPILER=clang-17 \
..
- name: Build
run: |
cmake --build _build -j2
- name: Copy resource lib artifacts
run: |
cd _build
mkdir _resourcelib
cp -r ../Libraries/ResourceLib/Include _resourcelib/
cp ../Libraries/ResourceLib/ResourceLib.cs _resourcelib/
cp ResourceLib*.so _resourcelib/
cp ../LICENSE _resourcelib/
- name: Copy resource tool artifacts
run: |
cd _build
mkdir _resourcetool
cp ResourceTool _resourcetool/
cp ResourceLib*.so _resourcetool/
cp ../LICENSE _resourcetool/
- name: Archive resource tool
uses: actions/upload-artifact@v4
with:
name: ResourceTool-linux-x64
path: |
_build/_resourcetool/*
- name: Archive resource lib
uses: actions/upload-artifact@v4
with:
name: ResourceLib-linux-x64
path: |
_build/_resourcelib/*
create_release:
name: Create release
needs: [build_windows, build_linux]
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create.outputs.upload_url }}
steps:
- name: Create release
id: create
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: false
prerelease: startsWith(github.ref, 'refs/tags/v0.')
upload_release:
name: Upload release artifacts
needs: create_release
runs-on: ubuntu-latest
strategy:
matrix:
artifact: [ ResourceTool-win-x64, ResourceTool-linux-x64, CodeGen-win-x64, ResourceLib-win-x64, ResourceLib-linux-x64 ]
steps:
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: ${{ matrix.artifact }}
path: ${{ matrix.artifact }}
- name: Archive artifact files
run: |
cd ${{ matrix.artifact }}
zip -r ${{ matrix.artifact }}.zip *
- name: Upload release assets
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: ${{ matrix.artifact }}/${{ matrix.artifact }}.zip
asset_name: ${{ matrix.artifact }}.zip
asset_content_type: application/zip