-
-
Notifications
You must be signed in to change notification settings - Fork 96
156 lines (141 loc) · 5.53 KB
/
test.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
name: Run Tests 🧪
env:
ACTIONS_RUNNER_DEBUG: true
ACTIONS_STEP_DEBUG: true
on:
push:
branches:
- main
- development/v3
- "feature/**"
paths:
- "Editor/**"
- "Runtime/**"
- "Samples~/**"
- "Tests/**"
workflow_dispatch:
jobs:
buildAndTestForSomePlatforms:
concurrency:
group: ${{ github.workflow }}-${{ matrix.unityVersion }}-${{ matrix.unityLocalisation }}-${{ matrix.uniTask }}
cancel-in-progress: true # Cancel other jobs if another one arrives
name: ${{ matrix.unityVersion }} (${{ matrix.targetPlatform }}, ${{ matrix.unityLocalisation && 'with unity loc' || 'no unity loc' }}, ${{ matrix.uniTask && 'with unitask' || 'no unitask' }})
runs-on: [self-hosted, linux]
strategy:
fail-fast: false
# max-parallel: 1 # Only run one at a time, to prevent license contention
matrix:
projectPath:
- YarnSpinner
unityVersion:
- 2022.3.45f1
- 2023.2.12f1
- 6000.0.24f1
unityLocalisation:
- true
- false
uniTask:
- true
- false
targetPlatform:
# - StandaloneOSX # Build a macOS standalone (Intel 64-bit).
# - StandaloneWindows64 # Build a Windows 64-bit standalone.
- StandaloneLinux64 # Build a Linux 64-bit standalone.
# - iOS # Build an iOS player.
# - Android # Build an Android player.
# - WebGL # WebGL.
steps:
- name: Create empty Unity project
shell: bash
run: |
mkdir -p ${{ matrix.projectPath }}/Assets
mkdir -p ${{ matrix.projectPath }}/ProjectSettings
mkdir -p ${{ matrix.projectPath }}/Packages
mkdir -p output
# Add the Unity Input System package, and configure the new project to use
# both the Input System and the legacy Input Manager.
- name: Add Input System package
shell: bash
run: |
cat <<EOF > ${{ matrix.projectPath }}/ProjectSettings/ProjectSettings.asset
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!129 &1
PlayerSettings:
activeInputHandler: 2
EOF
cat <<EOF > ${{ matrix.projectPath }}/Packages/manifest.json
{
"dependencies": {
"com.unity.inputsystem": "1.11.2"
}
}
EOF
# Select correct TMP Essentials package
if [[ ${{matrix.unityVersion}} == "2022"* ]]; then
TMP_VERSION="ugui-1.0.0"
else
TMP_VERSION="ugui-2.0.0"
fi
echo "Installing TMP Essentials for $TMP_VERSION"
# Add the correct version of the TMP Essentials package to package manifest
MANIFEST_PATH=${{ matrix.projectPath }}/Packages/manifest.json
jq ".dependencies += {\"dev.yarnspinner.tmp-essentials\": \"https://github.com/desplesda/dev.yarnspinner.tmp-essentials.git#$TMP_VERSION\"}" "$MANIFEST_PATH" > manifest.json
mv manifest.json "$MANIFEST_PATH"
- name: Add Unity Localisation
if: ${{ matrix.unityLocalisation }}
run: |
# Add Unity Localisation package to package manifest
MANIFEST_PATH=${{ matrix.projectPath }}/Packages/manifest.json
jq '.dependencies += {"com.unity.localization": "1.3.2"}' "$MANIFEST_PATH" > manifest.json
mv manifest.json "$MANIFEST_PATH"
- name: Add UniTask Package
if: ${{ matrix.uniTask }}
run: |
# Add UniTask package to package manifest
MANIFEST_PATH=${{ matrix.projectPath }}/Packages/manifest.json
jq '.dependencies += {"com.cysharp.unitask": "https://github.com/Cysharp/UniTask.git?path=src/UniTask/Assets/Plugins/UniTask"}' "$MANIFEST_PATH" > manifest.json
mv manifest.json "$MANIFEST_PATH"
- name: Check out to Packages/YarnSpinner
uses: actions/checkout@v2
with:
fetch-depth: 0
path: ${{ matrix.projectPath }}/Packages/dev.yarnspinner.unity
- name: Run edit mode tests
run: |
docker run \
--rm \
-v ./${{ matrix.projectPath }}:/project \
-v ./output:/output \
-e TEST_MODE=EditMode \
--hostname YS-Linux-Build \
yarnspinner/unity-${{ matrix.unityVersion }}
- name: Run play mode tests
if: always()
run: |
docker run \
--rm \
-v ./${{ matrix.projectPath }}:/project \
-v ./output:/output \
-e TEST_MODE=PlayMode \
--hostname YS-Linux-Build \
yarnspinner/unity-${{ matrix.unityVersion }}
- name: Generate HTML test report (Play Mode)
uses: rjtngit/nunit-html-action@v1
if: always()
with:
inputXmlPath: output/TestResults-PlayMode.xml
outputHtmlPath: output/TestResults-PlayMode.html
- name: Generate HTML test report (Edit Mode)
uses: rjtngit/nunit-html-action@v1
if: always()
with:
inputXmlPath: output/TestResults-EditMode.xml
outputHtmlPath: output/TestResults-EditMode.html
- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: Test results (edit + play, ${{ matrix.unityVersion }} ${{ matrix.targetPlatform }} ${{ matrix.unityLocalisation && 'with-unity-loc' || 'no-unity-loc' }} ${{ matrix.uniTask && 'with-unitask' || 'no-unitask' }})
# path: ${{ steps.testRunner.outputs.artifactsPath }}
path: ./output