-
-
Notifications
You must be signed in to change notification settings - Fork 11
133 lines (118 loc) · 4.44 KB
/
Copy pathbuild-and-test.yml
File metadata and controls
133 lines (118 loc) · 4.44 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
name: build-and-test
on:
push:
branches-ignore:
- 'dependabot/**'
- 'gh-pages'
tags-ignore:
- 'v*'
pull_request:
branches:
- 'main'
- 'develop'
permissions:
contents: read
checks: write
concurrency:
group: unity-build-and-test-${{ github.ref }}
cancel-in-progress: true
jobs:
unity-editmode:
name: Unity EditMode (${{ matrix.package_display_name }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- package_display_name: FixedMathSharp
package_name: com.mrdav30.fixedmathsharp
package_path: com.mrdav30.fixedmathsharp
runtime_assembly: FixedMathSharp.Runtime
artifact_suffix: standard
- package_display_name: FixedMathSharp Lean
package_name: com.mrdav30.fixedmathsharp.lean
package_path: com.mrdav30.fixedmathsharp.lean
runtime_assembly: FixedMathSharp.Lean.Runtime
artifact_suffix: lean
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0
persist-credentials: false
- name: Prepare Unity test project
shell: bash
run: |
set -euo pipefail
project_path=".ci/unity-project"
rm -rf "$project_path"
mkdir -p "$project_path/Assets/Tests/EditMode"
mkdir -p "$project_path/Packages"
mkdir -p "$project_path/ProjectSettings"
cp Tests/EditMode/*.cs "$project_path/Assets/Tests/EditMode/"
cat > "$project_path/Assets/Tests/EditMode/FixedMathSharp.Unity.Tests.EditMode.asmdef" <<JSON
{
"name": "FixedMathSharp.Unity.Tests.EditMode",
"references": [
"${{ matrix.runtime_assembly }}",
"UnityEngine.TestRunner",
"UnityEditor.TestRunner"
],
"includePlatforms": [
"Editor"
],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": true,
"precompiledReferences": [
"nunit.framework.dll",
"FixedMathSharp.dll"
],
"autoReferenced": false,
"defineConstraints": [
"UNITY_INCLUDE_TESTS"
],
"versionDefines": []
}
JSON
cat > "$project_path/Packages/manifest.json" <<JSON
{
"dependencies": {
"${{ matrix.package_name }}": "file:../../../${{ matrix.package_path }}",
"com.unity.modules.physics": "1.0.0",
"com.unity.test-framework": "1.6.0"
}
}
JSON
cat > "$project_path/ProjectSettings/ProjectVersion.txt" <<'EOF'
m_EditorVersion: 6000.3.9f1
m_EditorVersionWithRevision: 6000.3.9f1 (7a9955a4f2fa)
EOF
- name: Cache Unity Library
uses: actions/cache@v5
with:
path: .ci/unity-project/Library
key: unity-library-${{ runner.os }}-${{ matrix.artifact_suffix }}-${{ hashFiles('Tests/EditMode/**/*.cs', 'Tests/EditMode/**/*.asmdef', 'com.mrdav30.fixedmathsharp/**/*.cs', 'com.mrdav30.fixedmathsharp/**/*.asmdef', 'com.mrdav30.fixedmathsharp/package.json', 'com.mrdav30.fixedmathsharp.lean/**/*.cs', 'com.mrdav30.fixedmathsharp.lean/**/*.asmdef', 'com.mrdav30.fixedmathsharp.lean/package.json') }}
restore-keys: |
unity-library-${{ runner.os }}-${{ matrix.artifact_suffix }}-
- name: Run Unity EditMode tests
id: tests
uses: game-ci/unity-test-runner@v4
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
with:
projectPath: .ci/unity-project
unityVersion: 6000.3.9f1
testMode: EditMode
customParameters: -assemblyNames FixedMathSharp.Unity.Tests.EditMode -runSynchronously
artifactsPath: artifacts/${{ matrix.artifact_suffix }}
githubToken: ${{ github.token }}
checkName: Unity EditMode ${{ matrix.package_display_name }}
- name: Upload Unity test artifacts
if: failure()
uses: actions/upload-artifact@v7
with:
name: unity-editmode-${{ matrix.artifact_suffix }}
path: artifacts/${{ matrix.artifact_suffix }}