-
Notifications
You must be signed in to change notification settings - Fork 424
114 lines (97 loc) · 3.54 KB
/
create-unitypackage.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
name: Create UnityPackage
on:
workflow_dispatch:
push:
branches:
- workflow-wip-2
env:
UNITY_PROJECT_PATH: .
defaults:
run:
shell: bash
jobs:
checkout:
runs-on: [self-hosted, Windows, X64, Unity]
timeout-minutes: 10
steps:
- id: checkout
uses: actions/checkout@v4
with:
submodules: recursive
lfs: true
detect-unity-version:
needs: checkout
runs-on: [self-hosted, Windows, X64, Unity]
timeout-minutes: 10
outputs:
unity-editor-executable: ${{ steps.detect-unity-version.outputs.unity-editor-executable }}
steps:
- name: Detect Unity Version
id: detect-unity-version
run: |
PROJECT_VERSION_PATH="${UNITY_PROJECT_PATH}/ProjectSettings/ProjectVersion.txt"
UNITY_HUB="C:\Program Files\Unity Hub\Unity Hub.exe"
UNITY_VERSION=`cat ${PROJECT_VERSION_PATH} | sed -n -E "s/^m_EditorVersion:\s+//p" | head -n 1`
UNITY_CHANGESET=`cat ${PROJECT_VERSION_PATH} | sed -n -E "s/^m_EditorVersionWithRevision:\s+\S+\s+\((\S+)\)/\1/p" | head -n 1`
UNITY_EDITOR_EXECUTABLE=`"${UNITY_HUB}" -- --headless editors --installed | \
sed -n -E "s/^${UNITY_VERSION} , installed at //p" | \
head -n 1`
if [ -z "${UNITY_EDITOR_EXECUTABLE}" ]; then
echo "Unity ${UNITY_VERSION} is not installed."
exit 1
# コマンドラインからのインストールは Unity 3.7.0 時点では UAC 必須で難しい
UNITY_INSTALL_COMMAND="\"${UNITY_HUB}\" -- --headless install \
--version ${UNITY_VERSION} \
--changeset ${UNITY_CHANGESET} \
--module windows-il2cpp \
--childModules"
fi
echo "unity-editor-executable=${UNITY_EDITOR_EXECUTABLE}" >> "${GITHUB_OUTPUT}"
run-edit-mode-tests:
needs: detect-unity-version
runs-on: [self-hosted, Windows, X64, Unity]
timeout-minutes: 10
steps:
- name: Run EditMode Tests
id: run-edit-mode-tests
run: |
echo "Run EditMode Tests..."
# RunEditModeTests の実行の結果、終了コードが 0 でない場合でもテストの結果を表示したいので set +e して一時的に回避する
set +e
"${{ needs.detect-unity-version.outputs.unity-editor-executable }}" \
-batchmode \
-silent-crashes \
-projectPath "${UNITY_PROJECT_PATH}" \
-executeMethod "UniGLTF.TestRunner.RunEditModeTests" \
-logFile run-edit-mode-tests.log \
-testRunnerNUnitXmlFile run-edit-mode-tests.xml
RET=$?
set -e
echo "Output Log..."
cat run-edit-mode-tests.log | egrep "^\[\[TestRunnerLog\]\]"
if [ ${RET:-1} -eq 0 ]; then
echo "Test succeeded."
exit 0
else
echo "Test failed."
exit 1
fi
create-unitypackage:
needs: [detect-unity-version, run-edit-mode-tests]
runs-on: [self-hosted, Windows, X64, Unity]
timeout-minutes: 10
steps:
- name: Create UnityPackage
id: create-unitypackage
run: |
"${{ needs.detect-unity-version.outputs.unity-editor-executable }}" \
-batchmode \
-silent-crashes \
-projectPath "${UNITY_PROJECT_PATH}" \
-executeMethod "VRM.DevOnly.PackageExporter.VRMExportUnityPackage.CreateUnityPackageWithBuild" \
-logFile create-unitypackage.log
- name: Upload UnityPackage
uses: actions/upload-artifact@v4
with:
name: unitypackage
path: "${UNITY_PROJECT_PATH}/*.unitypackage"