-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (69 loc) · 2.61 KB
/
Copy pathunity-tests.yml
File metadata and controls
78 lines (69 loc) · 2.61 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
name: Unity Package Runtime Tests
permissions:
contents: read
on:
workflow_dispatch:
pull_request:
branches:
- main
types: [ready_for_review,opened,reopened,auto_merge_enabled,review_requested]
jobs:
checkChangedFiles:
runs-on: ubuntu-latest
outputs: # <--- 1. DEFINE JOB OUTPUTS HERE
csharp_files_changed: ${{ steps.changed-csharp-files.outputs.any_changed }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Get all changed csharp files
id: changed-csharp-files
uses: tj-actions/changed-files@24d32ffd492484c1d75e0c0b894501ddb9d30d62
with:
files: |
**.cs
.github/workflows/unity-tests.yml
- name: List all changed files
if: steps.changed-csharp-files.outputs.any_changed == 'true'
env:
ALL_CHANGED_FILES: ${{ steps.changed-markdown-files.outputs.all_changed_files }}
run: |
for file in ${ALL_CHANGED_FILES}; do
echo "$file was changed"
done
runTests:
name: Run Runtime Tests
runs-on: ubuntu-latest
needs: [checkChangedFiles]
if: needs.checkChangedFiles.outputs.csharp_files_changed == 'true'
env:
PROJECT_PATH: 'my-package'
UNITY_VERSION: '6000.2.8f1'
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
path: ${{ env.PROJECT_PATH }}
- name: Cache Unity Library
uses: actions/cache@v4
with:
path: TempProject/Library
key: lib-${{ runner.os }}-${{ env.UNITY_VERSION }}-${{ hashFiles(format('{0}/package.json', env.PROJECT_PATH)) }}
restore-keys: |
lib-${{ runner.os }}-${{ env.UNITY_VERSION }}-
- name: Run Unity tests
uses: game-ci/unity-test-runner@v4.3.1
env:
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
UNITY_LICENSE: ${{secrets.UNITY_LICENSE}}
with:
packageMode: true
unityVersion: ${{ env.UNITY_VERSION }}
projectPath: ${{ env.PROJECT_PATH }}
coverageOptions: generateAdditionalMetrics;generateHtmlReport;generateBadgeReport;dontClear;assembliesToInclude=HealthSystem.Runtime,HealthSystem.Editor
- name: Upload test results
uses: actions/upload-artifact@v4
if: always() # 'always()' ensures this runs even if tests fail
with:
name: test-playmode-results
path: artifacts # game-ci/unity-tester outputs results to 'artifacts'