Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Commit

Permalink
Implement CI for MacOS/iOS export
Browse files Browse the repository at this point in the history
  • Loading branch information
dorianpercic committed May 15, 2024
1 parent 5d416f2 commit 5f1428e
Show file tree
Hide file tree
Showing 53 changed files with 134 additions and 121 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/linux_export.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ jobs:
- name: Godot Export
run: |
set -x
mkdir godot/.godot
touch godot/.godot/extension_list.cfg
echo "res://rust.gdextension" >> godot/.godot/extension_list.cfg
just linux-release
Expand Down Expand Up @@ -84,9 +85,9 @@ jobs:
- name: Godot Export
run: |
set -x
godot --headless -q -e --quit
touch godot/.godot/extension_list.cfg
echo "res://rust.gdextension" >> godot/.godot/extension_list.cfg
godot --headless -q -e --quit
echo "export/android/java_sdk_path = \"$(dirname $(dirname $(which java)))\"" >> ~/.config/godot/editor_settings-4.tres
echo "export/android/android_sdk_path = \"$(pwd)/dependencies/android-sdk/\"" >> ~/.config/godot/editor_settings-4.tres
export GODOT_ANDROID_KEYSTORE_RELEASE_PATH="$PWD/secrets/debug.keystore"
Expand Down
122 changes: 122 additions & 0 deletions .github/workflows/macos_export.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
name: MacOS Export

on: [push]

env:
CARGO_TERM_COLOR: always
RUSTFLAGS: -Dwarnings
CARGO_INCREMENTAL: 0
PROJECT_NAME: Godot Spike
WORKING_DIRECTORY: godot
IOS_APPLE_ID_USERNAME: ${{ secrets.IOS_APPLE_ID_USERNAME }}
IOS_APPLE_ID_PASSWORD: ${{ secrets.IOS_APPLE_ID_PASSWORD }}

BUILD_CERTIFICATE_BASE64: ${{ secrets.IOS_BUILD_CERTIFICATE_BASE64 }}
P12_PASSWORD: ${{ secrets.P12_PASSWORD }}
BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.BUILD_PROVISION_PROFILE_BASE64 }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}

jobs:
export-macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
components: rustfmt, clippy
- uses: rui314/setup-mold@v1
- uses: chickensoft-games/setup-godot@v1
name: Setup Godot
with:
version: 4.2.2
include-templates: true
use-dotnet: false
- uses: Swatinem/rust-cache@v2
with:
workspaces: "rust -> target"
cache-all-crates: "true"

- name: Install just
run: cargo install just

- name: just Check
run: just --version

- name: Godot Check
run: |
godot --version
- name: Godot Export
run: |
set -x
mkdir godot/.godot
touch godot/.godot/extension_list.cfg
echo "res://rust.gdextension" >> godot/.godot/extension_list.cfg
just macos-release
export-ios:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v2

- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
components: rustfmt, clippy
- uses: rui314/setup-mold@v1
- uses: chickensoft-games/setup-godot@v1
name: Setup Godot
with:
version: 4.2.2
include-templates: true
use-dotnet: false
- uses: Swatinem/rust-cache@v2
with:
workspaces: "rust -> target"
cache-all-crates: "true"

- name: Install just
run: cargo install just

- name: just Check
run: just --version

- name: Godot Check
run: |
godot --version
- name: Godot Export
run: |
set -x
mkdir godot/.godot
touch godot/.godot/extension_list.cfg
echo "res://rust.gdextension" >> godot/.godot/extension_list.cfg
# create variables
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
# import certificate and provisioning profile from secrets
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH
echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode -o $PP_PATH
# create temporary keychain
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
# import certificate to keychain
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH
# apply provisioning profile
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles
just setup-ios
just ios-debug
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@ secrets/
export/
rust/target/
.godot/
!.godot/imported/
!.godot/global_script_class_cache.cfg
*.vscode/
Empty file added export/macos/.gitkeep
Empty file.
43 changes: 0 additions & 43 deletions godot/.godot/global_script_class_cache.cfg

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

4 changes: 4 additions & 0 deletions godot/rust.gdextension
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,7 @@ android.debug.arm64 = "res://../rust/target/aarch64-linux-android/debug/libgo
android.release.arm64 = "res://../rust/target/aarch64-linux-android/release/libgodot_plugin.so"
windows.debug.x86_64 = "res://../rust/target/x86_64-pc-windows-msvc/debug/godot_plugin.dll"
windows.release.x86_64 = "res://../rust/target/x86_64-pc-windows-msvc/release/godot_plugin.dll"
macos.debug.arm64 = "res://../rust/target/debug/libgodot_plugin.dylib"
macos.release.arm64 = "res://../rust/target/release/libgodot_plugin.dylib"
ios.debug.arm64 = "res://../rust/target/aarch64-apple-ios/debug/libgodot_plugin.dylib"
ios.release.arm64 = "res://../rust/target/aarch64-apple-ios/release/libgodot_plugin.dylib"
12 changes: 6 additions & 6 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,18 @@ windows-release:
[macos]
macos-debug:
{{rustdir}} cargo build
{{rustdir}} cargo build
{{godotdir}} godot --headless --export-debug "macOS" "../export/macos/Godot Spike.dmg"
[macos]
macos-release:
{{rustdir}} cargo build --release
{{godotdir}} godot --headless --export-release "macOS" "../export/macos/Godot Spike.dmg"
{{rustdir}} cargo build
{{rustdir}} cargo build --release
{{godotdir}} godot --headless --export-release "macOS" "../export/macos/Godot Spike.dmg"
[macos]
ios-debug:
# NOTE: can only work on MacOS with xcode
{{rustdir}} cargo build
{{rustdir}} cargo build --target aarch64-apple-ios
{{godotdir}} godot --headless --export-debug "iOS" "../export/ios/Godot Spike.ipa"
Expand All @@ -82,7 +83,6 @@ setup:
just _setup-verify-dependencies _setup-precommit _setup-rust setup-{{os()}}
# -------------------------------------------------
# Execute to verify if all dependencies are installed
_setup-verify-dependencies:
@ {{message}} "Verifying all required programs are installed...\nAll programs need to be in \$PATH!"
rustup --version
Expand All @@ -106,7 +106,7 @@ setup-windows:
rustup target add x86_64-pc-windows-gnu
[macos]
setup-macos:
setup-ios:
@ {{message}} "Installing Rust tools for iOS builds..."
rustup target add aarch64-apple-ios
cargo install cargo-lipo
Expand Down

0 comments on commit 5f1428e

Please sign in to comment.