-
Notifications
You must be signed in to change notification settings - Fork 212
260 lines (220 loc) · 7.93 KB
/
cmake-and-release.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
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
name: Release Multi Platform
on:
push:
tags:
- "v*"
workflow_dispatch:
jobs:
build-linux-clang:
name: Linux (Clang)
runs-on: ubuntu-latest
timeout-minutes: 15
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt update
sudo apt-get install mesa-utils libglu1-mesa-dev freeglut3-dev mesa-common-dev libglfw3-dev
- name: Configure
run: cmake -B ${{github.workspace}}/build -S ${{github.workspace}}/src -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
- name: Create zip
working-directory: ${{github.workspace}}/output
run: zip -r gpupixel_linux_x86_64.zip .
- name: Upload Linux Artifact
uses: actions/upload-artifact@v4
with:
name: gpupixel_linux_x86_64
path: ${{github.workspace}}/output/gpupixel_linux_x86_64.zip
build-macos-clang:
name: macOS (Universal)
runs-on: macos-latest
timeout-minutes: 15
env:
BUILD_TYPE: Release
CMAKE_OSX_ARCHITECTURES: x86_64;arm64
steps:
- uses: actions/checkout@v4
- name: Configure
run: cmake -G Xcode -DCMAKE_TOOLCHAIN_FILE=${{github.workspace}}/toolchain/ios.toolchain.cmake -DPLATFORM=MAC_UNIVERSAL -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -S ${{ github.workspace }}/src
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
- name: Create zip
working-directory: ${{github.workspace}}/output
run: zip -r gpupixel_mac_Universal.zip .
- name: Upload Mac Artifact
uses: actions/upload-artifact@v4
with:
name: gpupixel_mac_Universal
path: ${{github.workspace}}/output/gpupixel_mac_Universal.zip
build-ios-clang:
name: iOS (Arm64)
runs-on: macos-latest
timeout-minutes: 15
env:
BUILD_TYPE: Release
CMAKE_OSX_ARCHITECTURES: x86_64;arm64
steps:
- uses: actions/checkout@v4
- name: Configure
run: cmake -G Xcode -DCMAKE_TOOLCHAIN_FILE=${{github.workspace}}/toolchain/ios.toolchain.cmake -DPLATFORM=OS64 -B ${{github.workspace}}/build -S ${{github.workspace}}/src -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
- name: Create zip
working-directory: ${{github.workspace}}/output
run: zip -r gpupixel_ios_arm64.zip .
- name: Upload iOS Artifact
uses: actions/upload-artifact@v4
with:
name: gpupixel_ios_arm64
path: ${{github.workspace}}/output/gpupixel_ios_arm64.zip
build-windows-mingw:
name: Windows (MSYS2)
runs-on: windows-latest
timeout-minutes: 15
env:
BUILD_TYPE: Release
steps:
- uses: actions/checkout@v4
- name: Set up MinGW
uses: msys2/setup-msys2@v2
- name: Configure
run: cmake -G "MinGW Makefiles" -B ${{github.workspace}}/build -S ${{github.workspace}}/src -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
- name: Build Win shared x64 library
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
- name: Create zip
run: Compress-Archive -Path ${{github.workspace}}/output/* -Destination gpupixel_windows_x86_64.zip
- name: Upload Win Artifact
uses: actions/upload-artifact@v4
with:
name: gpupixel_windows_x86_64
path: ./gpupixel_windows_x86_64.zip
build-android-gradle:
name: Android (Arm64-v8a & Armeabi-v7a)
runs-on: ubuntu-latest
timeout-minutes: 15
env:
BUILD_TYPE: Release
steps:
- uses: actions/checkout@v4
- name: set up JDK 11
uses: actions/setup-java@v3
with:
java-version: "11"
distribution: "temurin"
cache: gradle
- name: Grant execute permission for gradlew
working-directory: src/android/java
run: chmod +x gradlew
- name: Build with Gradle
working-directory: src/android/java
run: ./gradlew :gpupixel:assembleRelease
- name: Create zip
working-directory: ${{github.workspace}}/output
run: |
cp -r ${{github.workspace}}/src/android/java/gpupixel/build/outputs/aar ${{github.workspace}}/output/library/android
zip -r gpupixel_android.zip .
- name: Upload Android Artifact
uses: actions/upload-artifact@v4
with:
name: gpupixel_android
path: ${{github.workspace}}/output/gpupixel_android.zip
# Deployment job
deploy:
needs:
[
build-linux-clang,
build-macos-clang,
build-ios-clang,
build-windows-mingw,
build-android-gradle,
]
runs-on: ubuntu-latest
name: Deploy
steps:
- uses: actions/checkout@v4
- name: Download Linux Artifact
uses: actions/download-artifact@v4
with:
name: gpupixel_linux_x86_64
path: ./
- name: Download Mac Artifact
uses: actions/download-artifact@v4
with:
name: gpupixel_mac_Universal
path: ./
- name: Download iOS Artifact
uses: actions/download-artifact@v4
with:
name: gpupixel_ios_arm64
path: ./
- name: Download Win Artifact
uses: actions/download-artifact@v4
with:
name: gpupixel_windows_x86_64
path: ./
- name: Download Android Artifact
uses: actions/download-artifact@v4
with:
name: gpupixel_android
path: ./
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
body_path: ${{ github.workspace }}/CHANGELOG.md
draft: false
prerelease: false
- name: Upload Linux library
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./gpupixel_linux_x86_64.zip
asset_name: gpupixel_linux_x86_64.zip
asset_content_type: application/gzip
- name: Upload Mac library
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./gpupixel_mac_Universal.zip
asset_name: gpupixel_mac_Universal.zip
asset_content_type: application/gzip
- name: Upload iOS library
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./gpupixel_ios_arm64.zip
asset_name: gpupixel_ios_arm64.zip
asset_content_type: application/gzip
- name: Upload Win library
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./gpupixel_windows_x86_64.zip
asset_name: gpupixel_windows_x86_64.zip
asset_content_type: application/gzip
- name: Upload Android library
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./gpupixel_android.zip
asset_name: gpupixel_android.zip
asset_content_type: application/gzip