-
Notifications
You must be signed in to change notification settings - Fork 10
184 lines (157 loc) · 5.79 KB
/
build.yml
File metadata and controls
184 lines (157 loc) · 5.79 KB
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
# Adapted from https://github.com/nathanfranke/gdextension/blob/main/.github/workflows/build.yml
name: Builds
on:
workflow_dispatch:
inputs:
git-ref:
description: A commit, branch or tag to build.
type: string
required: true
workflow_call:
inputs:
git-ref:
description: A commit, branch or tag to build.
type: string
required: true
jobs:
build:
runs-on: ${{ matrix.runner }}
name: ${{ matrix.platform }} ${{ matrix.target }} ${{ matrix.arch }} ${{ matrix.optimize }} ${{ matrix.scons_args }}
env:
BUILD_ID: ${{ matrix.platform }}-${{ matrix.target }}-${{ matrix.arch }}-${{ matrix.optimize }}${{ matrix.scons_args && '-' || ''}}${{ matrix.scons_args }}
EM_VERSION: 3.1.64
EM_CACHE_FOLDER: "emsdk-cache"
SCONS_CACHE: .scons-cache
CACHE_VERSION: 1 # Invalidate cache by increasing this number
strategy:
fail-fast: false
matrix:
target: [ template_debug, template_release ]
identifier: [ windows, linux, macos, android, android_arm64, web_threads, web_nothreads ]
include:
# Defaults
- runner: ubuntu-22.04
- optimize: speed
- arch: x86_64
- scons_args:
# Debug build settings
- target: template_debug
optimize: speed_trace
# Map identifiers to platforms + special settings
- identifier: windows
platform: windows
- identifier: macos
platform: macos
runner: macos-latest
arch: universal
- identifier: linux
platform: linux
- identifier: android
platform: android
- identifier: android_arm64
platform: android
arch: arm64
- identifier: web_threads
platform: web
arch: wasm32
scons_args: threads=yes
- identifier: web_nothreads
platform: web
arch: wasm32
scons_args: threads=no
steps:
- name: Check settings
if: ${{ matrix.platform == '' || matrix.target == '' || matrix.runner == '' || matrix.optimize == '' || matrix.arch == ''}}
run: |
echo "One of the matrix values is not set."
exit 1
- name: (Windows) Install mingw64
if: ${{ matrix.platform == 'windows' }}
shell: sh
run: |
sudo apt-get install mingw-w64
sudo update-alternatives --set x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-posix
sudo update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix
- name: (Android) Install JDK 17
if: ${{ matrix.platform == 'android' }}
uses: actions/setup-java@v3
with:
java-version: 17
distribution: temurin
- name: (Android) Install Android SDK
if: ${{ matrix.platform == 'android' }}
uses: android-actions/setup-android@v3
# From Godot docs, might not be necessary.
#- name: (Android) Install Android Tools
# if: ${{ matrix.platform == 'android' }}
# shell: sh
# run: |
# "$ANDROID_SDK_ROOT"/cmdline-tools/latest/bin/sdkmanager --sdk_root="$ANDROID_SDK_ROOT" "platform-tools" "build-tools;30.0.3" "platforms;android-29" "cmdline-tools;latest" "cmake;3.10.2.4988404"
- name: (Android) Install NDK r23c
if: ${{ matrix.platform == 'android' }}
uses: nttld/setup-ndk@v1
with:
ndk-version: r23c
link-to-sdk: true
- name: (Web) Set up Emscripten cache
if: ${{ matrix.platform == 'web' }}
uses: actions/cache@v4
with:
path: ${{env.EM_CACHE_FOLDER}}
key: ${{env.EM_VERSION}}-${{ env.BUILD_ID }}-${{ env.CACHE_VERSION }}
- name: (Web) Set up Emscripten
if: ${{ matrix.platform == 'web' }}
uses: mymindstorm/setup-emsdk@v14
with:
version: ${{env.EM_VERSION}}
actions-cache-folder: ${{env.EM_CACHE_FOLDER}}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Set up SCons
shell: bash
run: |
python -c "import sys; print(sys.version)"
python -m pip install scons==4.7.0
scons --version
- name: Checkout project
uses: actions/checkout@v4
with:
submodules: recursive
ref: ${{ inputs.git-ref }}
- name: Scons Cache
id: scons-cache
uses: actions/cache@v4
with:
path: ${{ env.SCONS_CACHE }}
key: ${{ env.BUILD_ID }}-${{ env.CACHE_VERSION }}
- name: Compile extension
shell: sh
run: |
scons -j2 target=${{ matrix.target }} platform=${{ matrix.platform }} arch=${{ matrix.arch }} optimize=${{ matrix.optimize }} lto=full ${{ matrix.scons_args }}
ls -l demo/addons/ropesim/bin/
- name: Prepare files for publish
shell: sh
run: |
cp -rn '${{ github.workspace }}/'*.md '${{ github.workspace }}/docs' '${{ github.workspace }}/LICENSE' '${{ github.workspace }}/demo/addons/ropesim/'
rm -rf '${{ github.workspace }}/demo/addons/diagnosticlist'
rm '${{ github.workspace }}/demo/project.godot'
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: build-${{ env.BUILD_ID }}
path: |
${{ github.workspace }}/demo/
merge:
runs-on: ubuntu-latest
needs: build
steps:
- name: Git describe
id: ghd
uses: proudust/gh-describe@v2
- name: Merge Artifacts
uses: actions/upload-artifact/merge@v4
with:
name: ${{ github.event.repository.name }}-${{ steps.ghd.outputs.describe }}
pattern: build-*