-
-
Notifications
You must be signed in to change notification settings - Fork 22
/
action.yml
146 lines (134 loc) · 5.11 KB
/
action.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
name: Build GDExtension
description: Build GDExtension library
inputs:
platform:
description: Target platform (linux|macos|windows|android|ios|web)
required: true
target:
description: Compilation target (editor|template_release|template_debug)
required: true
default: "release"
arch:
description: Arch (universal|x86_32|x86_64|arm32|arm64|rv64|ppc32|ppc64|wasm32)
required: true
default: ""
artifact:
description: Artifact name. This name will be used for caching.
required: true
default: "bin"
additional:
description: Any additional arguments
default: ""
additional_enabled_dd3d:
description: Use force_enabled_dd3d if possible
default: "true"
output_libs_path:
description: Path to compiled libraries
required: true
default: "bin"
use_cache:
description: Use cache
default: "true"
token:
description: Secrets token
telemetry_version:
description: Telemetry version
default: b8386398c134f3c7503139e84f952d62207e54ae
runs:
using: composite
steps:
- name: Get godot-cpp SHA
shell: bash
id: get_godot_cpp_sha
run: |
echo "sha=$(git rev-parse @:./godot-cpp)" >> $GITHUB_OUTPUT
- name: Checkout telemetry repo
uses: actions/checkout@v4
id: checkout_tele_repo
if: ${{env.PRODUCTION_BUILD == 'true' && contains(fromJSON('["template_debug", "editor"]'), inputs.target) && contains(fromJSON('["linux", "macos", "windows"]'), inputs.platform)}}
continue-on-error: true
with:
repository: ${{github.repository_owner}}/my_telemetry_modules
token: ${{inputs.token}}
ref: ${{inputs.telemetry_version}}
path: src/editor/my_telemetry_modules
- name: Restore .scons_cache directory
if: inputs.use_cache != 'false'
id: restore_scons_cache
uses: actions/cache/restore@v4
with:
path: ${{env.SCONS_CACHE}}
key: ${{github.job}}-${{inputs.artifact}}-${{steps.get_godot_cpp_sha.outputs.sha}}-${{github.ref}}-${{github.sha}}
restore-keys: |
${{github.job}}-${{inputs.artifact}}-${{steps.get_godot_cpp_sha.outputs.sha}}-${{github.ref}}
${{github.job}}-${{inputs.artifact}}-${{steps.get_godot_cpp_sha.outputs.sha}}
- name: Set up Python 3.x
uses: actions/setup-python@v5
with:
python-version: "3.x"
architecture: "x64"
- name: Configuring Python packages
shell: bash
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
python -m pip install pywin32
fi
python -m pip install scons
python --version
scons --version
- name: Linux dependencies
shell: bash
if: (runner.os == 'Linux') && (inputs.platform == 'linux')
run: |
sudo apt update
if [[ "${{inputs.arch}}" == *"32" ]];then
sudo apt install gcc-multilib g++-multilib
fi
- name: Compilation
shell: bash
run: |
echo "::group::🛠️ GDExtesion Compilation 🛠️"
scons apply_patches
telemetry_args=""
if [[ "${{env.PRODUCTION_BUILD}}" == "true" && " template_debug editor " == *" ${{inputs.target}} "* && " linux macos windows " == *" ${{inputs.platform}} "* && "${{steps.checkout_tele_repo.conclusion}}" == "success" ]]; then
telemetry_args="telemetry_enabled=yes"
fi
scons_params="platform=${{inputs.platform}} arch=${{inputs.arch}} target=${{inputs.target}} addon_output_dir=${{inputs.output_libs_path}} ${{inputs.additional}}"
scons $scons_params $telemetry_args
if [ "${{inputs.target}}" == "template_release" ] && [ "${{inputs.additional_enabled_dd3d}}" == "true" ]; then
scons $scons_params force_enabled_dd3d=yes
fi
echo "::endgroup::"
- name: Prepare artifact Unix
if: runner.os != 'Windows' && inputs.platform != 'android' && inputs.platform != 'web'
shell: bash
run: |
if [ "${{inputs.platform}}" == 'ios' ] || [ "${{inputs.platform}}" == 'macos' ]; then
found_files=$(find -L ${{inputs.output_libs_path}} -type f -iname "*.dylib")
echo "Found files: $found_files"
while IFS= read -r file; do
echo "Strip '$file'"
strip -u "$file"
done <<< "$found_files"
else
found_files=$(find -L ${{inputs.output_libs_path}} -type f -exec file {} + | grep "ELF" | cut -d: -f1)
echo "Found files: $found_files"
strip $found_files
fi
- name: Prepare artifact Windows
if: runner.os == 'Windows'
shell: powershell
run: |
Remove-Item ${{inputs.output_libs_path}}/* -Recurse -Include *.exp,*.lib,*.pdb -Force
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: ${{inputs.artifact}}
retention-days: 7
path: ${{inputs.output_libs_path}}/*
- name: Save .scons_cache directory
if: inputs.use_cache != 'false'
uses: actions/cache/save@v4
with:
path: ${{env.SCONS_CACHE}}
key: ${{github.job}}-${{inputs.artifact}}-${{steps.get_godot_cpp_sha.outputs.sha}}-${{github.ref}}-${{github.sha}}