-
Notifications
You must be signed in to change notification settings - Fork 1
301 lines (259 loc) · 10.3 KB
/
ci-builds.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
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
name: Hop
on:
push:
branches: [ "main" ]
tags: 'v*'
paths-ignore:
- 'doc/**'
- '.github/**'
pull_request:
workflow_dispatch:
jobs:
linuxXlinux:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y build-essential xorg-dev mesa-common-dev libx11-dev libxrandr-dev libgl1-mesa-dev libglu1-mesa-dev libfreetype6-dev libopenal-dev libsndfile1-dev libudev-dev libxinerama-dev libxcursor-dev
- name: linux-linux
run: |
./dependencies.sh && ./build.sh -t -d -r
mkdir linuxbuild
cp build/libHop.a linuxbuild/
cp -r include linuxbuild/
cd linuxbuild && zip -r ../linuxbuild.zip * && cd ..
mkdir demos && mkdir demos/sfml && mkdir demos/standalone
cp build/sfmlPerlinWorld demos/sfml
cp tile.hmap demos/sfml/
cp config.lua demos/sfml
cp build/perlinWorld demos/standalone
cp tile.hmap demos/standalone
cp config.lua demos/standalone
cd demos && zip -r ../demos.zip * && cd ..
- name: Tests
working-directory: ${{github.workspace}}/build
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest
- name: buildArtifact
uses: actions/upload-artifact@v3
with:
name: linuxbuild
path: linuxbuild.zip
- name: demoArtifact
uses: actions/upload-artifact@v3
with:
name: demoLinux
path: demos.zip
linuxXwindows:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y xorg-dev build-essential mesa-common-dev libx11-dev libxrandr-dev libgl1-mesa-dev libglu1-mesa-dev libfreetype6-dev libopenal-dev libsndfile1-dev libudev-dev g++-mingw-w64-x86-64-posix gcc-mingw-w64-x86-64-posix libxinerama-dev libxcursor-dev
- name: linux-X-windows
run: |
./dependencies.sh -w && ./build.sh -w -d -r
mkdir windowsbuild
cp build/libHop.a windowsbuild/
cp -r include windowsbuild/
cd windowsbuild && zip -r ../windowsbuild.zip * && cd ..
mkdir demos && mkdir demos/sfml && mkdir demos/standalone
cp build/sfmlPerlinWorld.exe demos/sfml
cp tile.hmap demos/sfml/
cp build/perlinWorld.exe demos/standalone
cp tile.hmap demos/standalone
cp -r build/*.dll demos/sfml
cd demos && zip -r ../demos.zip * && cd ..
- name: buildArtifact
uses: actions/upload-artifact@v3
with:
name: windowsbuild
path: windowsbuild.zip
- name: demoArtifact
uses: actions/upload-artifact@v3
with:
name: demoWindows
path: demos.zip
linuxRun:
needs: linuxXlinux
runs-on: ubuntu-20.04
steps:
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y xvfb x11-apps imagemagick
- name: get linux demos
uses: actions/download-artifact@v3
with:
name: demoLinux
- name: launch and screenshot
run: |
unzip demos.zip
cd sfml
chmod +x sfmlPerlinWorld
export DISPLAY=:99
sudo Xvfb :99 -screen 0 800x600x24 &
sleep 5
MESA_GL_VERSION_OVERRIDE=3.3 ./sfmlPerlinWorld &
export PID=$!
sleep 10
xwd -root -silent | convert xwd:- png:screenshot.png
sleep 5 && kill $PID
MESA_GL_VERSION_OVERRIDE=3.3 ./sfmlPerlinWorld map &
export PID=$!
sleep 10
xwd -root -silent | convert xwd:- png:screenshot-map.png
sleep 5 && kill $PID
cd ../standalone
chmod +x perlinWorld
export DISPLAY=:99
sudo Xvfb :99 -screen 0 800x600x24 &
sleep 5
MESA_GL_VERSION_OVERRIDE=3.3 ./perlinWorld &
export PID=$!
sleep 10
xwd -root -silent | convert xwd:- png:screenshot.png
sleep 5 && kill $PID
MESA_GL_VERSION_OVERRIDE=3.3 ./perlinWorld map &
export PID=$!
sleep 10
xwd -root -silent | convert xwd:- png:screenshot-map.png
sleep 5 && kill $PID
- name: upload artifact
uses: actions/upload-artifact@v3
with:
name: screenshot-standalone
path: standalone/screenshot.png
- name: upload artifact
uses: actions/upload-artifact@v3
with:
name: screenshot-map-standalone
path: standalone/screenshot-map.png
- name: upload artifact
uses: actions/upload-artifact@v3
with:
name: screenshot-sfml
path: sfml/screenshot.png
- name: upload artifact
uses: actions/upload-artifact@v3
with:
name: screenshot-map-sfml
path: sfml/screenshot-map.png
linuxXandroid:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: |
sudo apt-get update && sudo apt-get install -y build-essential mesa-common-dev libx11-dev libxrandr-dev libgl1-mesa-dev libglu1-mesa-dev libfreetype6-dev libopenal-dev libsndfile1-dev libudev-dev
wget https://dl.google.com/android/repository/android-ndk-r25c-linux.zip
unzip android-ndk-r25c-linux.zip
wget https://dl.google.com/android/repository/commandlinetools-linux-9477386_latest.zip
unzip commandlinetools-linux-9477386_latest.zip
export ANDROID_SDK_ROOT=~/
mv cmdline-tools latest
mkdir cmdline-tools
mv latest cmdline-tools
yes | ./cmdline-tools/latest/bin/sdkmanager --licenses
./cmdline-tools/latest/bin/sdkmanager --install "system-images;android-33;google_apis;x86_64"
./cmdline-tools/latest/bin/sdkmanager "platform-tools" "platforms;android-33"
echo no | ./cmdline-tools/latest/bin/avdmanager create avd --name android33 --package "system-images;android-33;google_apis;x86_64"
- name: linux-android-hop
run: |
./build.sh -r --android android-ndk-r25c
mkdir androidbuild
cp build/libHop* androidbuild/
cp -r include androidbuild/
cd androidbuild && zip -r ../androidbuild.zip * && cd ..
- name: buildArtifact
uses: actions/upload-artifact@v3
with:
name: androidbuild
path: androidbuild.zip
- name: linux-android-demo
run: |
cp -r build/*.a demo/android/perlinWorld/app/src/main/cpp/include/
cp -r include/* demo/android/perlinWorld/app/src/main/cpp/include/
cd demo/android/perlinWorld
./gradlew assembleDebug
cd ~/
# emulator not being created in setup
# get em next time..
# - name: linux-android-run
# run: |
# echo $(ls .android/avd)
# export DISPLAY=:99
# sudo Xvfb :99 -screen 0 800x600x24 &
# sleep 5
# export ANDROID_SDK_ROOT=~/ && ./emulator/emulator -avd android33 &
# export PID=$!
# sleep 10
# export ANDROID_SDK_ROOT=~/ && ./platform-tools/adb install demo/android/perlinWorld/app/release/app-release.aab
# xwd -root -silent | convert xwd:- png:screenshot-android.png
# sleep 5 && kill $PID
- name: demoAndroid
uses: actions/upload-artifact@v3
with:
name: demoAndroid
path: demo/android/perlinWorld/app/release/*.aab
# - name: upload artifact
# uses: actions/upload-artifact@v3
# with:
# name: screenshot-android
# path: screenshot-android.png
release:
needs: [linuxXlinux, linuxXwindows, linuxXandroid]
if: github.ref_type == 'tag'
runs-on: ubuntu-20.04
steps:
- name: get linux build
uses: actions/download-artifact@v3
with:
name: linuxbuild
- name: get windows build
uses: actions/download-artifact@v3
with:
name: windowsbuild
- name: get android build
uses: actions/download-artifact@v3
with:
name: androidbuild
- name: create release
id: createRelease
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
draft: true
prerelease: false
release_name: "release-${{ github.ref_name }}"
tag_name: ${{ github.ref }}
- name: upload linux release artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.createRelease.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: linuxbuild.zip
asset_name: linux
asset_content_type: application/zip
retention-days: 30
- name: upload windows release artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.createRelease.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: windowsbuild.zip
asset_name: windows
asset_content_type: application/zip
retention-days: 30
- name: upload android release artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.createRelease.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: androidbuild.zip
asset_name: android
asset_content_type: application/zip
retention-days: 30