-
Notifications
You must be signed in to change notification settings - Fork 3
209 lines (184 loc) · 6.16 KB
/
build_all.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
name: Build
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
OCULUS_VERSION: 57
GODOT_ENGINE_VERSION: "4.1.2"
GODOT_ENGINE_STAGE: "stable"
INTEGRATION_VERSION: "v1.3.1-beta"
jobs:
lint:
name: 🧹 Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run clang-format style check
uses: jidicula/[email protected]
with:
clang-format-version: '14'
check-path: 'src'
exclude-regex: 'include'
- name: Cancelling parallel jobs
if: ${{ failure() }}
uses: andymckay/[email protected]
build-all:
runs-on: ${{ matrix.os }}
name: ${{ matrix.name }}
strategy:
fail-fast: false
matrix:
include:
- name: Windows
os: "windows-latest"
api-platform: windows
scons-platform: windows
artifact-name: windows
- name: macOS
os: "macos-11"
api-platform: mac
scons-platform: macos
artifact-name: macos
- name: Linux
os: "ubuntu-20.04"
api-platform: linux
scons-platform: linux
artifact-name: linux
- name: Android
os: "ubuntu-20.04"
api-platform: android
scons-platform: android
flags: arch=arm64v8
artifact-name: android-lib
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: recursive
- name: Set godot-cpp commit hash env
shell: bash
run: |
cd godot-cpp
GODOT_CPP_COMMIT_HASH=$(git rev-parse HEAD)
echo "GODOT_CPP_COMMIT_HASH=$GODOT_CPP_COMMIT_HASH" >> $GITHUB_ENV
cd ..
- name: godot-cpp library cache
id: cache-godot-lib
uses: actions/cache@v3
env:
cache-name: cache-godot-lib
with:
path: godot-cpp/bin
key: ${{ matrix.api-platform }}-build-${{ env.cache-name }}-${{ env.GODOT_CPP_COMMIT_HASH }}
- name: Set up Python 3.x
uses: actions/setup-python@v4
with:
python-version: "3.x"
architecture: "x64"
- name: Set up dependencies (Python, SCons)
run: python -m pip install scons
- name: Compile Debug library
shell: bash
run: |
mkdir -p godot-cpp/bin
scons platform=${{ matrix.scons-platform }} target=template_debug generate_bindings=yes -j6 ${{ matrix.flags }} ${{ steps.cache-godot-lib.outputs.cache-hit == 'true' && 'build_library=no' || ''}}
- name: Compile Release library
shell: bash
run: |
scons platform=${{ matrix.scons-platform }} target=template_release generate_bindings=yes -j6 ${{ matrix.flags }} ${{ steps.cache-godot-lib.outputs.cache-hit == 'true' && 'build_library=no' || ''}}
- name: Upload generated addon libs
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.artifact-name }}
path: demo/addons/godot_oculus_platform
android-plugin:
runs-on: "ubuntu-20.04"
name: Android Plugin
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up JDK 11 for x64
uses: actions/setup-java@v3
with:
java-version: "11"
distribution: "adopt"
architecture: x64
- name: Change wrapper permissions
run: |
cd tools/godotoculusplatform-android-plugin/
chmod +x ./gradlew
cd ../../
- name: Build Android plugin
run: |
cd tools/godotoculusplatform-android-plugin/
./gradlew build
cd ../../
mkdir -p demo/android/plugins/godotoculusplatform
cp tools/godotoculusplatform-android-plugin/godotoculusplatform-android-plugin/build/outputs/aar/godotoculusplatform-android-plugin-release.aar demo/android/plugins/godotoculusplatform
- name: Upload Android Plugin
uses: actions/upload-artifact@v3
with:
name: android-plugin
path: demo/android
upload-addon:
runs-on: "ubuntu-20.04"
needs: [build-all, android-plugin]
name: Addon
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Download all libs
uses: actions/download-artifact@v3
- name: Assemble all artifacts
run: |
ls
shopt -s dotglob
if [ ! -d "addons/godot_oculus_platform" ]; then
mkdir -p addons/godot_oculus_platform
cp ./LICENSE addons/godot_oculus_platform
fi
if [ -d windows ]; then
cp -r windows/* addons/godot_oculus_platform/
rm -r windows
fi
if [ -d macos ]; then
cp -r macos/* addons/godot_oculus_platform/
rm -r macos
fi
if [ -d linux ]; then
cp -r linux/* addons/godot_oculus_platform/
rm -r linux
fi
if [ -d android-lib ]; then
cp -r android-lib/* addons/godot_oculus_platform/
rm -r android-lib
fi
if [ ! -d "android/plugins/godotoculusplatform" ]; then
mkdir -p android/plugins/godotoculusplatform
fi
if [ -d android-plugin ]; then
mv android-plugin/plugins/godotoculusplatform/godotoculusplatform-android-plugin-release.aar android/plugins/godotoculusplatform/
rm -r android-plugin
cp demo/android/plugins/godotoculusplatform-android-plugin.gdap android/plugins
fi
- name: Clean up addon
run: |
rm -r ./godot-cpp
rm -r ./src
rm -r ./tools
rm -r ./demo
rm ./SConstruct
rm ./LICENSE
rm ./README.md
rm .gitignore
rm .gitmodules
rm .clang-format
rm -r ./.git
rm -r ./.github
- name: Upload final artifact
uses: actions/upload-artifact@v3
with:
name: GodotOculusPlatform-${{ env.INTEGRATION_VERSION }}_Godot-${{ env.GODOT_ENGINE_VERSION }}-${{ env.GODOT_ENGINE_STAGE }}_SDK-${{ env.OCULUS_VERSION }}
path: ./