-
Notifications
You must be signed in to change notification settings - Fork 1
164 lines (144 loc) · 7.56 KB
/
Copy pathil2cpp.yml
File metadata and controls
164 lines (144 loc) · 7.56 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
name: Unity IL2CPP Build
on:
push:
branches: [master]
pull_request:
branches: [master]
release:
types: [published]
jobs:
build:
name: Build (Unity ${{ matrix.unity }} / ${{ matrix.target }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# - unity: "2019.4.28f1"
# target: "StandaloneWindows64"
# os: "windows-latest"
# - unity: "2019.4.28f1"
# target: "StandaloneLinux64"
# os: "ubuntu-latest"
# - unity: "2019.4.28f1"
# target: "Android"
# os: "ubuntu-latest"
- unity: "2022.3.33f1"
target: "StandaloneWindows64"
os: "windows-latest"
- unity: "2022.3.33f1"
target: "StandaloneLinux64"
os: "ubuntu-latest"
- unity: "2022.3.33f1"
target: "Android"
os: "ubuntu-latest"
- unity: "6000.0.40f1"
target: "StandaloneWindows64"
os: "windows-latest"
- unity: "6000.0.40f1"
target: "StandaloneLinux64"
os: "ubuntu-latest"
- unity: "6000.0.40f1"
target: "Android"
os: "ubuntu-latest"
- unity: "6000.3.21f1"
target: "StandaloneWindows64"
os: "windows-latest"
- unity: "6000.3.21f1"
target: "StandaloneLinux64"
os: "ubuntu-latest"
- unity: "6000.3.21f1"
target: "Android"
os: "ubuntu-latest"
steps:
- name: Checkout
uses: actions/checkout@v4
# - name: Cache Library
# uses: actions/cache@v4
# with:
# path: Library
# key: ${{ runner.os }}-unity-${{ matrix.unity }}-${{ matrix.target }}-library-${{ hashFiles('**/Packages/manifest.json') }}
- name: Setup Unity
uses: game-ci/unity-builder@v4
with:
unityVersion: ${{ matrix.unity }}
targetPlatform: ${{ matrix.target }}
buildsPath: build
androidSymbolType: ${{ matrix.target == 'Android' && 'debugging' || 'none' }}
gitPrivateToken: ${{ secrets.GITHUB_TOKEN }}
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
# - name: Run Unity build
# run: |
# outdir="$GITHUB_WORKSPACE/build/${{ matrix.unity }}/${{ matrix.target }}"
# # If a file named 'build' exists it blocks directory creation — remove it
# mkdir -p "$outdir"
# chmod -R u+rwX "$GITHUB_WORKSPACE/build"
# # Replace `BuildScript.PerformBuild` with your project's build method.
# /opt/unity/Editor/Unity -batchmode -nographics -quit -projectPath "$GITHUB_WORKSPACE" -buildTarget ${{ matrix.target }} -executeMethod BuildScript.PerformBuild -logFile "$outdir/build.log" || true
# game-ci/unity-builder runs the build in a root-owned Docker container on Linux,
# leaving build/ owned by root — reclaim it for the runner user before writing into it below.
- name: Fix build output permissions
if: runner.os != 'Windows'
run: sudo chown -R "$(id -u):$(id -g)" build
# libunity.so equivalents get copied into build/<target>/ so the archive
# and artifact/release upload steps below pick them up automatically.
- name: "Add libunity.so (Android: patch + extract)"
if: matrix.target == 'Android'
shell: bash
run: |
apk=$(find "build/${{ matrix.target }}" -maxdepth 1 -name '*.apk' | head -n1)
unzip -p "$apk" lib/arm64-v8a/libunity.so > "build/${{ matrix.target }}/libunity-unpatched.so"
symbols_zip=$(find "build/${{ matrix.target }}" -name '*.symbols.zip' | head -n1)
symbol_entry=$(unzip -Z1 "$symbols_zip" | grep -E '(^|/)arm64-v8a/libunity(\.so|\.(sym|dbg)\.so|\.so\.(sym|dbg))$')
unzip -p "$symbols_zip" "$symbol_entry" > "build/${{ matrix.target }}/libunity.sym.so"
curl -L -o patcher.zip "https://security-patches.unity.com/bc0977e0-21a9-4f6e-9414-4f44b242110a/unity-patcher/UnityApplicationPatcher-1.3.3-Linux.zip"
mkdir -p unity-application-patcher
unzip -q patcher.zip -d unity-application-patcher
chmod +x unity-application-patcher/UnityApplicationPatcherCLI
export LD_LIBRARY_PATH="$GITHUB_WORKSPACE/unity-application-patcher/Data/StreamingAssets/Android/SDK/platform-tools/lib64"
# The patcher CLI is itself a Unity-built binary and segfaults without a display to open a window against
sudo apt-get update && sudo apt-get install -y xvfb
# versionCode 0 means ignore
xvfb-run -a unity-application-patcher/UnityApplicationPatcherCLI -android -versionCode 0 -applicationPath "$apk"
patched="${apk%.apk}.patched.apk"
unzip -p "$patched" lib/arm64-v8a/libunity.so > "build/${{ matrix.target }}/libunity.so"
- name: "Add libunity.so (Windows: UnityPlayer.dll)"
if: matrix.target == 'StandaloneWindows64'
shell: bash
run: |
player=$(find "build/${{ matrix.target }}" -iname 'UnityPlayer.dll' | head -n1)
cp "$player" "build/${{ matrix.target }}/libunity.so"
- name: "Add libunity.so (Linux: UnityPlayer.so)"
if: matrix.target == 'StandaloneLinux64'
shell: bash
run: |
player=$(find "build/${{ matrix.target }}" -iname 'UnityPlayer.so' | head -n1)
cp "$player" "build/${{ matrix.target }}/libunity.so"
- name: Archive build (Linux/macOS)
if: runner.os != 'windows'
run: |
zip -r build-${{ matrix.unity }}-${{ matrix.target }}.zip ./build
- name: Archive build (Windows)
if: runner.os == 'windows'
shell: pwsh
run: |
Compress-Archive -Path build -DestinationPath build-${{ matrix.unity }}-${{ matrix.target }}.zip -Force
- name: Upload to GitHub Release
if: github.event_name == 'release'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: build-${{ matrix.unity }}-${{ matrix.target }}.zip
asset_name: build-${{ matrix.unity }}-${{ matrix.target }}.zip
asset_content_type: application/zip
- name: Upload build artifact
if: github.event_name != 'release'
uses: actions/upload-artifact@v4
with:
name: build-${{ matrix.unity }}-${{ matrix.target }}
path: build/