forked from NeotokyoRebuild/neo
-
Notifications
You must be signed in to change notification settings - Fork 0
245 lines (195 loc) · 7.37 KB
/
cibuild.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
244
245
name: Build
on:
push:
pull_request:
workflow_dispatch:
release:
types: [published]
jobs:
build:
name: ${{ matrix.platform.display_name }} ${{ matrix.preset_build_type.display_name }}
runs-on: ${{ matrix.platform.os }}
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
platform:
- { display_name: 'Linux Native Libraries', os: ubuntu-latest, preset_os: linux }
- { display_name: 'Windows Native Libraries', os: windows-latest, preset_os: windows }
preset_build_type:
- { display_name: 'Debug', name: debug }
- { display_name: 'Release', name: release }
steps:
- uses: actions/checkout@v4
- name: Set reusable strings
run: |
preset_name="${{ matrix.platform.preset_os }}-${{ matrix.preset_build_type.name }}"
workspace_dir="${{ github.workspace }}"
source_dir=${workspace_dir//\\//}/mp/src
build_dir=${workspace_dir//\\//}/mp/src/build/$preset_name
install_dir=$build_dir/install
echo "source_dir=$source_dir" >> "$GITHUB_ENV"
echo "build_dir=$build_dir" >> "$GITHUB_ENV"
echo "install_dir=$install_dir" >> "$GITHUB_ENV"
echo "preset_name=$preset_name" >> "$GITHUB_ENV"
- name: Install packages
if: ${{ matrix.platform.os == 'ubuntu-latest' }}
run: |
sudo apt update
sudo apt install gcc-multilib g++-multilib ninja-build -y
- name: Install packages
if: ${{ matrix.platform.os == 'windows-latest' }}
run: choco install -y ninja
- uses: ilammy/msvc-dev-cmd@v1
if: ${{ matrix.platform.os == 'windows-latest' }}
with:
arch: x86
- name: Print PATH
if: ${{ matrix.platform.os == 'windows-latest' }}
run: |
echo "PATH: $PATH"
- name: Git fetch tags
run: git fetch origin --tags
# Libraries
- name: CMake configure libraries build
working-directory: ${{ env.source_dir }}
run: >
cmake
--preset ${{ env.preset_name }}
-DCMAKE_INSTALL_PREFIX=${{ env.install_dir }}
-DNEO_CI_BUILD=ON
-DNEO_USE_CCACHE=OFF
-DNEO_COPY_LIBRARIES=OFF
-DNEO_USE_SEPARATE_BUILD_INFO=ON
-DNEO_INSTALL_LIBRARIES=ON
-DNEO_INSTALL_RESOURCES=OFF
- name: CMake libraries build
working-directory: ${{ env.source_dir }}
run: cmake --build --preset ${{ env.preset_name }} --parallel --verbose
- name: Install libraries
run: cmake --install ${{ env.build_dir }}
# Dedicated library
- name: CMake reconfigure dedicated library build
working-directory: ${{ env.source_dir }}
run: >
cmake
--preset ${{ env.preset_name }}
-DNEO_DEDICATED=ON
- name: CMake dedicated library build
working-directory: ${{ env.source_dir }}
run: cmake --build --preset ${{ env.preset_name }} --parallel --verbose
- name: Install dedicated library
run: cmake --install ${{ env.build_dir }}
# Artifacts
- name: Get artifact names
working-directory: ${{ env.install_dir }}
run: |
echo "libraries=$(find . -regex '\.\/neo-\w*-\w*-libraries-\w*-\w*' -printf '%f')" >> "$GITHUB_ENV"
echo "libraries_debuginfo=$(find . -regex '\.\/neo-\w*-\w*-libraries-debuginfo-\w*-\w*' -printf '%f')" >> "$GITHUB_ENV"
echo "dedicated=$(find . -regex '\.\/neo-\w*-\w*-dedicated-\w*-\w*' -printf '%f')" >> "$GITHUB_ENV"
echo "dedicated_debuginfo=$(find . -regex '\.\/neo-\w*-\w*-dedicated-debuginfo-\w*-\w*' -printf '%f')" >> "$GITHUB_ENV"
- name: Upload libraries
uses: actions/upload-artifact@v4
with:
name: ${{ env.libraries }}
path: ${{ env.install_dir }}/${{ env.libraries }}
- name: Upload libraries debug information
uses: actions/upload-artifact@v4
with:
name: ${{ env.libraries_debuginfo }}
path: ${{ env.install_dir }}/${{ env.libraries_debuginfo }}
- name: Upload dedicated library
uses: actions/upload-artifact@v4
with:
name: ${{ env.dedicated }}
path: ${{ env.install_dir }}/${{ env.dedicated }}
- name: Upload dedicated library debug information
uses: actions/upload-artifact@v4
with:
name: ${{ env.dedicated_debuginfo }}
path: ${{ env.install_dir }}/${{ env.dedicated_debuginfo }}
pack-resources:
name: Windows Native Resources
runs-on: windows-latest
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
- name: Set reusable strings
run: |
workspace_dir="${{ github.workspace }}"
source_dir=${workspace_dir//\\//}/mp/src
build_dir=${workspace_dir//\\//}/mp/src/build/windows-release
install_dir=$build_dir/install
echo "source_dir=$source_dir" >> "$GITHUB_ENV"
echo "build_dir=$build_dir" >> "$GITHUB_ENV"
echo "install_dir=$install_dir" >> "$GITHUB_ENV"
- name: Install packages
run: choco install -y ninja
- uses: ilammy/msvc-dev-cmd@v1
with:
arch: x86
# Resources
- name: CMake configure resources build
working-directory: ${{ env.source_dir }}
run: >
cmake
--preset windows-release
-DCMAKE_INSTALL_PREFIX=${{ env.install_dir }}
-DNEO_USE_CCACHE=OFF
-DNEO_COPY_LIBRARIES=OFF
-DNEO_INSTALL_LIBRARIES=OFF
-DNEO_INSTALL_RESOURCES=ON
- name: Install resources
run: cmake --install ${{ env.build_dir }}
- name: Get artifact name
working-directory: ${{ env.install_dir }}
run: echo "resources=$(echo neo-*-*-resources)" >> "$GITHUB_ENV"
- name: Upload resources
uses: actions/upload-artifact@v4
with:
name: ${{ env.resources }}
path: ${{ env.install_dir }}/${{ env.resources }}
upload-latest-build:
name: Upload Latest Build
needs: [build, pack-resources]
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
permissions:
contents: write
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
- name: Packing artifacts
run: 'parallel 7z a -tzip -mx=9 "{}.zip" "./{}/*" ::: neo-*'
- name: Create & upload latest build
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO_INFO: ${{ github.repository }}
run: |
# Delete old "latest" (delete step always returns true so that even if there's no release, it still uploads)
gh release delete latest --cleanup-tag --yes --repo "$REPO_INFO" || true
# Create new "latest"
gh release create latest neo-*.zip --prerelease --title "Latest Master Build" --repo "$REPO_INFO"
upload-release:
name: Upload Release
needs: [build, pack-resources]
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
permissions:
contents: write
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
- name: Deleting every debug artifact
run: 'rm -r *-Debug'
- name: Packing artifacts
run: 'parallel 7z a -tzip -mx=9 "{= s/neo-(.*)/neo-$GITHUB_REF_NAME-\1.zip/ =}" "./{}/*" ::: neo-*'
- name: Upload assets to a release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO_INFO: ${{ github.repository }}
run: 'gh release upload "$GITHUB_REF_NAME" neo-*.zip --clobber --repo "$REPO_INFO"'