builds godot
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
name: Reusable build workflow

on:
  workflow_call:
    inputs:
      ref:
        type: string
        required: true
      flags:
        type: string
        default: ""
        required: false
      modules-path:
        type: string
        required: true
      name:
        type: string
        required: true
      build-name:
        type: string
        required: true
      make-release:
        type: string
        default: "yes"
        required: true

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}-${{ inputs.ref }}
  cancel-in-progress: true

env:
  BUILD_NAME: ${{ inputs.build-name }}
  ref: ${{ inputs.ref }}
  flags: ${{ inputs.flags }}
  modules: ${{ inputs.modules-path }}

jobs:
  linux:
    name: Linux temps
    runs-on: ubuntu-20.04
    strategy:
      matrix:
        target: [release, release_debug]
        bits: [64]
    steps:
      - name: Compilation
        uses: bend-n/godot-builds/.github/actions/build-godot@main
        with:
          target: ${{ matrix.target }}
          flags: bits=${{ matrix.bits }} ${{ env.flags }}
          platform: linuxbsd

      - name: Upload artifact
        uses: bend-n/godot-builds/.github/actions/upload-artifact@main
        with:
          path: godot/bin/*.64

  windows:
    strategy:
      matrix:
        target: [release, release_debug]
        bits: [64]
    name: Win temps
    runs-on: windows-latest
    steps:
      - name: Compilation
        uses: bend-n/godot-builds/.github/actions/build-godot@main
        with:
          target: ${{ matrix.target }}
          flags: bits=${{ matrix.bits }} ${{ env.flags }}
          platform: windows

      - name: Upload artifact
        uses: bend-n/godot-builds/.github/actions/upload-artifact@main
        with:
          path: godot/bin/*.exe

  android:
    name: Android temps
    runs-on: ubuntu-20.04
    strategy:
      matrix:
        target: [release, release_debug]
    steps:
      - name: Set up Java 17
        uses: actions/setup-java@v3
        with:
          java-version: 17
          distribution: temurin

      - name: Compilation (armv7)
        uses: bend-n/godot-builds/.github/actions/build-godot@main
        with:
          target: ${{ matrix.target }}
          flags: android_arch=armv7 ${{ env.flags }}
          platform: android

      - name: Compilation (arm64v8)
        uses: bend-n/godot-builds/.github/actions/build-godot@main
        with:
          target: ${{ matrix.target }}
          flags: android_arch=arm64v8 ${{ env.flags }}
          platform: android

      - name: Generate Godot templates
        run: |
          cd godot
          (cd platform/android/java && ./gradlew generateGodotTemplates)

      - name: Upload artifact
        uses: bend-n/godot-builds/.github/actions/upload-artifact@main
        with:
          path: godot/bin/*.apk

  macos:
    strategy:
      matrix:
        target: [release, release_debug]

    name: macOS temps
    runs-on: macos-latest
    steps:
      - name: Install MoltenVK
        run: curl https://raw.githubusercontent.com/godotengine/godot/master/misc/scripts/install_vulkan_sdk_macos.sh -s | sh

      - name: Compilation(x86_64)
        uses: bend-n/godot-builds/.github/actions/build-godot@main
        with:
          flags: arch=x86_64 ${{ env.flags }}
          target: ${{ matrix.target }}
          platform: macos

      - name: Compilation(arm64)
        uses: bend-n/godot-builds/.github/actions/build-godot@main
        with:
          flags: arch=arm64 ${{ env.flags }}
          target: ${{ matrix.target }}
          platform: macos

      - name: Create universal
        run: |
          [[ "${{ matrix.target }}" == *"release_debug"* ]] && target='.debug'
          cd godot
          intel=bin/godot.osx.*.x86_64
          arm=bin/godot.osx.*.arm64
          lipo -create $intel $arm -output "bin/godot.osx.opt$target.universal"
          strip "bin/godot.osx.opt$target.universal"

      - name: Upload artifact
        uses: bend-n/godot-builds/.github/actions/upload-artifact@main
        with:
          path: godot/bin/*.universal

  web:
    strategy:
      matrix:
        target: [release]
        flags: [gdnative_enabled=yes, threads_enabled=yes, ""]

    name: JS temps
    runs-on: ubuntu-20.04
    steps:
      - name: Set up Emscripten 3.1.18
        uses: mymindstorm/setup-emsdk@v12
        with:
          version: 3.1.18

      - name: Verify Emscripten setup
        run: emcc -v

      - name: Compilation
        uses: bend-n/godot-builds/.github/actions/build-godot@main
        with:
          target: ${{ matrix.target }}
          flags: ${{ env.flags }} ${{ matrix.flags }}
          platform: web

      - name: Upload artifact
        uses: bend-n/godot-builds/.github/actions/upload-artifact@main
        with:
          path: godot/bin/*.zip

  templates:
    needs: [web, macos, windows, linux, android]
    name: Bundle all templates
    runs-on: ubuntu-20.04
    env:
      tmps: "templates"
    steps:
      - name: Download all artifacts
        uses: actions/download-artifact@v3

      - name: List all downloaded files
        run: ls -R

      - name: Getdot
        uses: actions/checkout@v3
        with:
          repository: godotengine/godot
          ref: ${{ inputs.ref }}
          path: godot-repo

      - name: Prepare files
        run: |
          rel="template_release"
          bug="template_debug"
          mkdir -vp "$tmps"
          echo "Preparing linux"
          linux="godot.x11.opt"
          mv "linux/$linux.64" "$tmps/linux_x11_debug.x86_64"
          mv "linux/$linux.debug.64" "$tmps/linux_x11_release.x86_64"

          echo "Preparing windows"
          windows="godot.windows.opt"
          # mv "windows/$windows.debug.64.exe" "$tmps/windows_debug_x86_64.exe"
          mv "windows/$windows.64.exe" "$tmps/windows_release_x86_64.exe"

          echo "Preparing android"
          # mv "android/android_debug.apk" "$tmps/android_debug.apk"
          mv "android/android_release.apk" "$tmps/android_release.apk"

          echo "Preparing macos"
          mac="godot.osx.opt"
          cp -r "godot-repo/misc/dist/osx_template.app" "."
          mkdir -p "osx_template.app/Contents/MacOS"
          cp "macos/$mac.universal" "osx_template.app/Contents/MacOS/godot_osx_release.64"
          # cp "macos/$mac.debug.universal" "osx_template.app/Contents/MacOS/godot_osx_debug.64"
          chmod +x osx_template.app/Contents/MacOS/*.64
          zip -q -9 -r "$tmps/osz.zip" "osx_template.app"

          echo "Preparing web"
          web="godot.javascript.opt"
          mv "web/$web.zip" "$tmps/webassembly_release.zip"
          mv "web/$web.gdnative.zip" "$tmps/webassembly_gdnative_release.zip"

      - name: Prepare bundle
        run: cd "${tmps}" && zip -qr9 templates.tpz ./*

      - name: Upload artifact
        uses: bend-n/godot-builds/.github/actions/upload-artifact@main
        with:
          path: ${{ env.tmps }}/templates.tpz

  editor:
    name: Linux editor
    runs-on: ubuntu-20.04
    steps:
      - name: Compilation
        uses: bend-n/godot-builds/.github/actions/build-godot@main
        with:
          platform: linuxbsd
          target: release

      - name: Upload artifact
        uses: bend-n/godot-builds/.github/actions/upload-artifact@main
        with:
          name: linuxbsd-editor-release
          path: godot/bin/*.64

  image:
    if: inputs.make-release == 'yes'
    permissions: write-all
    name: Docker image
    runs-on: ubuntu-latest
    needs: [editor, templates]
    steps:
      - uses: bend-n/godot-builds/.github/actions/build-upload-image@main
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          name: ${{ inputs.name }}

  release:
    if: inputs.make-release == 'yes'
    name: Create/update a release
    runs-on: ubuntu-latest
    needs: [editor, templates]
    steps:
      - uses: bend-n/godot-builds/.github/actions/release@main
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          name: ${{ inputs.name }}