forked from unitystation/unitystation
-
Notifications
You must be signed in to change notification settings - Fork 0
131 lines (122 loc) · 4.63 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
name: Tests
on:
push:
branches:
- develop
- master
paths:
- 'Tools/UnityLicense.ulf'
- 'UnityProject/**'
- '.github/workflows/**'
- 'Docker/**'
pull_request:
branches:
- develop
- master
paths:
- 'Tools/UnityLicense.ulf'
- 'UnityProject/**'
- '.github/workflows/**'
jobs:
########## HOW TO UPDATE UNITY_LICENSE ##########
# The job below is only used to request a new activation file
#
# !!! WARNING: Use a throw away Unity account for this since anyone will have access to the license file !!!
#
# If you need a new one follow these steps:
# - Uncomment the job below and run it
# - Download the manual activation file that appears as an artifact in a zip (Unity_v20XX.x.alf).
# - Visit license.unity3d.com, sign in and upload it.
# - You should now receive your license file (Unity_v20XX.x.ulf) as a download.
# - Replace UnityLicense.ulf in the Tools directory with it.
# - Make sure LICENSE_FILE_PATH in the 'Setup license' step still points to it.
# # Request license file job
# requestManualActivationFile:
# name: Request manual activation file
# runs-on: ubuntu-latest
# steps:
# # Request manual activation file
# - name: Request manual activation file
# uses: webbertakken/[email protected]
# id: getManualLicenseFile
# with:
# unityVersion: 2020.1.6f1
# # Upload artifact (Unity_v20XX.X.XXXX.alf)
# - name: Expose as artifact
# uses: actions/upload-artifact@v1
# with:
# name: ${{ steps.getManualLicenseFile.outputs.filePath }}
# path: ${{ steps.getManualLicenseFile.outputs.filePath }}
# Perform unit testing
performTest:
name: Unit testing on ${{ matrix.unityVersion }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
projectPath:
- UnityProject
unityVersion:
# - 2019.3.15f1
- 2020.1.6f1
targetPlatform:
- StandaloneWindows64
steps:
# Checkout repository (required to test local actions)
- name: Checkout repository
uses: actions/[email protected]
# Cache the library directory to speed up builds
# - name: Cache library directory
# uses: actions/[email protected]
# with:
# path: ${{ matrix.projectPath }}/Library
# key: Library2-${{ matrix.projectPath }}-${{ matrix.targetPlatform }}
# restore-keys: |
# Library2-${{ matrix.projectPath }}-${{ matrix.targetPlatform }}
# Library2-${{ matrix.projectPath }}-
# Library2-
#
# Set the UNITY_LICENSE environment variable
- name: Setup license
# This step:
# - Grabs the license file contents from the $LICENSE_FILE_PATH
# - Uses substitution to escape newline characters for GitHub Actions set-env.
# (from: https://github.community/t5/GitHub-Actions/set-output-Truncates-Multiline-Strings/td-p/37870)
# - Set the UNITY_LICENSE env var for all future steps using special GitHub Actions syntax
env:
LICENSE_FILE_PATH: ./Tools/UnityLicense.ulf
run: |
license=$(<"$LICENSE_FILE_PATH")
license="${license//'%'/'%25'}"
license="${license//$'\n'/'%0A'}"
license="${license//$'\r'/'%0D'}"
echo "::set-env name=UNITY_LICENSE::$license"
# Delete unity version file (test runner will crash otherwise)
- name: Delete ProjectVersion.txt
run: sudo rm ./${{ matrix.projectPath }}/ProjectSettings/ProjectVersion.txt
# Run tests - only edit mode supported
- name: Run tests
uses: webbertakken/[email protected]
with:
customParameters: '-nographics'
projectPath: ${{ matrix.projectPath }}
unityVersion: ${{ matrix.unityVersion }}
artifactsPath: ./testReports/${{ matrix.targetPlatform }}
testMode: editmode
# Install dotnet
- name: Installing dotnet
if: always()
uses: actions/setup-dotnet@v1
with:
dotnet-version: '2.1.202'
# Do the report magic
- name: Generate .html report
run: sudo dotnet ./Tools/ExtentReports/ExtentReportsDotNetCLI.dll -i=testReports/${{ matrix.targetPlatform }}/editmode-results.xml -o testReports/${{ matrix.targetPlatform }}/
if: always()
# Upload test results
- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v1
with:
name: Test results
path: ./testReports/${{ matrix.targetPlatform }}