-
Notifications
You must be signed in to change notification settings - Fork 297
107 lines (106 loc) · 4.96 KB
/
buildAndroid.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
name: Build Android
on:
workflow_call:
inputs:
runner-label:
required: true
type: string
unreal-engine-version:
required: true
type: string
unreal-engine-zip:
required: true
type: string
unreal-program-name:
required: true
type: string
upload-package-base-name:
required: true
type: string
extra-choco-packages:
required: false
type: string
default: ''
android-ndk-version:
required: true
type: string
jobs:
build:
runs-on: ${{ inputs.runner-label }}
steps:
- name: Install Ninja and wget
run: |
choco install -y ninja wget
- name: Install Android NDK
run: |
wget https://dl.google.com/android/repository/android-ndk-${{ inputs.android-ndk-version }}-windows.zip
7z x android-ndk-${{ inputs.android-ndk-version }}-windows.zip -oc:\
del android-ndk-${{ inputs.android-ndk-version }}-windows.zip
echo "ANDROID_NDK_ROOT=c:/android-ndk-${{ inputs.android-ndk-version }}" >> $ENV:GITHUB_ENV
echo "NDKROOT=c:/android-ndk-${{ inputs.android-ndk-version }}" >> $ENV:GITHUB_ENV
- name: Check out repository code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Configure vcpkg caching
uses: ./.github/actions/vcpkg-cache
with:
id: ${{ inputs.upload-package-base-name }}
- name: Set environment variables
run: |
$env:CESIUM_UNREAL_VERSION=$env:GITHUB_REF_NAME
$env:BUILD_CESIUM_UNREAL_PACKAGE_NAME="${{ inputs.upload-package-base-name }}-${env:CESIUM_UNREAL_VERSION}"
# Make these available to subsequent steps
echo "CESIUM_UNREAL_VERSION=${ENV:CESIUM_UNREAL_VERSION}" >> $ENV:GITHUB_ENV
echo "BUILD_CESIUM_UNREAL_PACKAGE_NAME=${ENV:BUILD_CESIUM_UNREAL_PACKAGE_NAME}" >> $ENV:GITHUB_ENV
- name: Install nasm
uses: ilammy/[email protected]
- name: Install Unreal Engine
uses: ./.github/actions/install-unreal-windows
with:
unreal-engine-zip: ${{ inputs.unreal-engine-zip }}
unreal-program-name: ${{ inputs.unreal-program-name }}
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Build cesium-native
run: |
# CMake gets confused by the Windows backslashes
$env:ANDROID_NDK_ROOT=$env:ANDROID_NDK_ROOT.replace('\', '/')
$env:ANDROID_NDK_HOME=$env:ANDROID_NDK_ROOT
$env:UNREAL_ENGINE_ROOT="D:/Program Files/Epic Games/${{ inputs.unreal-program-name }}"
$env:CESIUM_VCPKG_RELEASE_ONLY="TRUE"
cd extern
cmake -B build-android -S . -G Ninja -DCMAKE_TOOLCHAIN_FILE="unreal-android-toolchain.cmake" -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_BUILD_TYPE=Release
cmake --build build-android --config Release --target install -j8
cd ..
rm -r -fo extern
- name: Overwrite plugin engine version
run: |
((Get-Content -path CesiumForUnreal.uplugin -Raw) -replace '"EngineVersion": "5.2.0"','"EngineVersion": "${{ inputs.unreal-engine-version }}"') | Set-Content -Path CesiumForUnreal.uplugin
- name: Customize BuildConfiguration.xml
run: |
mkdir -p "$env:USERPROFILE\AppData\Roaming\Unreal Engine\UnrealBuildTool"
# - We limit parallel actions because our builds use a lot more memory than UBT thinks they will.
# - We set the source code control Provider to None so UBT includes all files in the unity build.
Set-Content -Path "$env:USERPROFILE\AppData\Roaming\Unreal Engine\UnrealBuildTool\BuildConfiguration.xml" -Value '<?xml version="1.0" encoding="utf-8" ?>
<Configuration xmlns="https://www.unrealengine.com/BuildConfiguration">
<BuildConfiguration>
<MaxParallelActions>2</MaxParallelActions>
</BuildConfiguration>
<SourceFileWorkingSet><Provider>None</Provider></SourceFileWorkingSet>
</Configuration>'
- name: Build plugin
run: |
$env:NDKROOT=$env:ANDROID_NDK_ROOT
cd "D:/Program Files/Epic Games/${{ inputs.unreal-program-name }}/Engine/Build/BatchFiles"
./RunUAT.bat BuildPlugin -Plugin="$ENV:GITHUB_WORKSPACE/CesiumForUnreal.uplugin" -Package="$ENV:GITHUB_WORKSPACE/packages/CesiumForUnreal" -CreateSubFolder -TargetPlatforms=Android -NoHostPlatform
- name: Print log
if: ${{ failure() }}
run: |
cat "C:\Users\runneradmin\AppData\Roaming\Unreal Engine\AutomationTool\Logs\D+Program+Files+Epic+Games+${{ inputs.unreal-program-name }}\UBT-UnrealGame-Android-Development.txt"
- name: Publish plugin package artifact
if: ${{ success() }}
uses: actions/upload-artifact@v4
with:
name: ${{ env.BUILD_CESIUM_UNREAL_PACKAGE_NAME}}
path: packages