This repository has been archived by the owner on Jan 29, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
202 lines (178 loc) · 7.27 KB
/
build.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
name: Build Launcher
on:
pull_request:
push:
branches:
- "starters"
workflow_dispatch:
jobs:
build-extension:
name: Build GDExtension
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- build: macos
os: macos-latest
target: aarch64-apple-darwin
lib_name: libcusf_launcher_crypto.dylib
- build: windows
os: windows-latest
target: x86_64-pc-windows-msvc
lib_name: cusf_launcher_crypto.dll
- build: linux
os: ubuntu-latest
target: x86_64-unknown-linux-gnu
lib_name: libcusf_launcher_crypto.so
steps:
- uses: actions/checkout@v3
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install Linux dependencies
if: matrix.build == 'linux'
run: |
sudo apt-get update
sudo apt-get install -y build-essential pkg-config libssl-dev
- name: Install Windows build tools
if: matrix.build == 'windows'
uses: ilammy/msvc-dev-cmd@v1
- name: Create extension directory
shell: bash
run: mkdir -p cusf_launcher/addons/cusf_launcher_crypto/bin
- name: Build GDExtension library (Windows)
if: matrix.build == 'windows'
shell: cmd
run: |
cd cusf_launcher_crypto
set PATH=%PATH:C:\Program Files\Git\usr\bin;=%
set PATH=%PATH:C:\Program Files\Git\bin;=%
cargo build --release --target ${{ matrix.target }}
copy "target\${{ matrix.target }}\release\${{ matrix.lib_name }}" "..\cusf_launcher\addons\cusf_launcher_crypto\bin\"
- name: Build GDExtension library (Unix)
if: matrix.build != 'windows'
shell: bash
run: |
cd cusf_launcher_crypto
cargo build --release --target ${{ matrix.target }}
cp target/${{ matrix.target }}/release/${{ matrix.lib_name }} ../cusf_launcher/addons/cusf_launcher_crypto/bin/
- name: Set permissions (Unix)
if: matrix.build != 'windows'
shell: bash
run: chmod +x cusf_launcher/addons/cusf_launcher_crypto/bin/*
- name: Cache GDExtension
uses: actions/cache@v3
with:
path: cusf_launcher/addons/cusf_launcher_crypto/bin
key: gdextension-${{ matrix.build }}-${{ github.sha }}
build:
name: Build Godot Project
needs: build-extension
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- build: linux
os: ubuntu-latest
target-bin: 'cusf_launcher.x86_64'
- build: macos
os: macos-latest
target-bin: 'cusf_launcher.dmg'
- build: windows
os: windows-latest
target-bin: 'cusf_launcher.exe'
steps:
- uses: actions/checkout@v3
- uses: chickensoft-games/setup-godot@v1
with:
version: 4.3.0
use-dotnet: false
include-templates: true
- name: Restore GDExtension
uses: actions/cache@v3
with:
path: cusf_launcher/addons/cusf_launcher_crypto/bin
key: gdextension-${{ matrix.build }}-${{ github.sha }}
- name: Verify Setup (Windows)
if: matrix.build == 'windows'
shell: pwsh
run: |
& "C:\Users\runneradmin\godot\Godot_v4.3-stable_win64.exe" --version
- name: Verify Setup (Unix)
if: matrix.build != 'windows'
run: godot --version
- name: Import certificate to Keychain
if: ${{ matrix.build == 'macos' }}
run: |
echo "${{ secrets.MACOS_CERTIFICATE }}" | base64 --decode > certificate.p12
KEYCHAIN_PASSWORD=$(uuidgen)
security create-keychain -p "$KEYCHAIN_PASSWORD" build.keychain
security default-keychain -s build.keychain
security unlock-keychain -p "$KEYCHAIN_PASSWORD" build.keychain
security import ./certificate.p12 -k ~/Library/Keychains/build.keychain -P ${{ secrets.MACOS_CERTIFICATE_PASSWORD }} -T /usr/bin/codesign
security set-key-partition-list -S apple-tool:,apple: -s -k "$KEYCHAIN_PASSWORD" ~/Library/Keychains/build.keychain
env:
MACOS_CERTIFICATE_PASSWORD: ${{ secrets.MACOS_CERTIFICATE_PASSWORD }}
- name: Setup notarization credentials
if: ${{ matrix.build == 'macos' }}
working-directory: cusf_launcher
run: |
echo ${{ secrets.GODOT_MACOS_NOTARIZATION_API_KEY }} | base64 --decode > notarization_api_key.p8
# MUST be run before build
- name: Initialize godot cache (Windows)
if: matrix.build == 'windows'
shell: pwsh
run: |
$godotPath = "C:/Users/runneradmin/godot/Godot_v4.3-stable_win64.exe"
Write-Host "Checking Godot path: $godotPath"
if (Test-Path $godotPath) {
Write-Host "Godot executable found"
python3 .github/scripts/godot_ci_cache.py --godot "$godotPath"
} else {
Write-Host "Godot not found at $godotPath"
Write-Host "Contents of godot directory:"
Get-ChildItem "C:/Users/runneradmin/godot" -Recurse
exit 1
}
- name: Initialize godot cache (Unix)
if: matrix.build != 'windows'
run: python3 .github/scripts/godot_ci_cache.py
- name: Export build (Windows)
if: matrix.build == 'windows'
shell: pwsh
run: |
$godotPath = "C:/Users/runneradmin/godot/Godot_v4.3-stable_win64.exe"
$name = "Windows"
# Create build directory
New-Item -ItemType Directory -Force -Path "cusf_launcher/build/windows"
# Run the export
& $godotPath --path "./cusf_launcher/" --headless --export-release "$name" --verbose 2>&1 | Tee-Object -FilePath build.log
- name: Export build (Unix)
if: matrix.build != 'windows'
run: |
name="${{fromJSON('{"windows": "Windows", "macos": "Mac", "linux": "Linux"}')[matrix.build] }}"
# Create build directory
mkdir -p cusf_launcher/build/${{ matrix.build }}
# Run the export
godot --path "./cusf_launcher/" --headless --export-release "$name" "${{ matrix.target-bin }}" --verbose 2>&1 | tee build.log
env:
GODOT_MACOS_NOTARIZATION_API_KEY_ID: ${{ secrets.GODOT_MACOS_NOTARIZATION_API_KEY_ID }}
GODOT_MACOS_NOTARIZATION_API_KEY: ./notarization_api_key.p8
GODOT_MACOS_NOTARIZATION_API_UUID: ${{ secrets.GODOT_MACOS_NOTARIZATION_API_UUID }}
- name: Upload build
uses: actions/upload-artifact@v4
with:
name: cusf_launcher_${{ matrix.build }}
if-no-files-found: error
path: cusf_launcher/build/${{ matrix.build }}/${{ matrix.target-bin }}
- name: Wait for notarization to finish
if: ${{ matrix.build == 'macos' }}
run: |
request_id=$(grep 'Notarization request UUID' build.log | rev | cut -d ' ' -f 1 | rev | tr -d '"')
xcrun notarytool wait $request_id \
--issuer ${{ secrets.GODOT_MACOS_NOTARIZATION_API_UUID }} \
--key-id ${{ secrets.GODOT_MACOS_NOTARIZATION_API_KEY_ID }} \
--key ./cusf_launcher/notarization_api_key.p8