Skip to content

Commit 70ecbf4

Browse files
committed
refactor: refactor test workflow
1 parent 9000e3f commit 70ecbf4

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

.github/workflows/unity-test.yml

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ jobs:
4444
"2020.1.4f1",
4545
"2020.1.5f1",
4646
]
47+
env:
48+
RUN_UNITY: "xvfb-run --auto-servernum --server-args='-screen 0 640x480x24' /opt/Unity/Editor/Unity -batchmode -nographics -silent-crashes -logFile -projectPath ."
4749

4850
runs-on: ubuntu-latest
4951
container:
@@ -118,26 +120,22 @@ jobs:
118120

119121
# Run playmode tests
120122
- name: "Run playmode tests"
121-
if: always() && steps.activation.conclusion == 'success'
122-
run: |
123-
xvfb-run --auto-servernum --server-args='-screen 0 640x480x24' \
124-
/opt/Unity/Editor/Unity -batchmode -nographics -silent-crashes -logFile -projectPath . -runTests -testPlatform playmode || exit 0
125-
126-
# Run editmode tests
127-
- name: "Run editmode tests"
128123
if: always() && steps.activation.conclusion == 'success'
129124
run: |
130125
# Install codecoverage
131126
if [ -z "`echo ${{ matrix.unity }} | grep 2018.`" ]; then
132127
npm i -g openupm-cli
133128
openupm add com.unity.testtools.codecoverage
134-
135-
xvfb-run --auto-servernum --server-args='-screen 0 640x480x24' \
136-
/opt/Unity/Editor/Unity -batchmode -nographics -silent-crashes -logFile -projectPath . -executeMethod Coffee.CSharpCompilerSettings.Menus.SetDevelopMode
137129
fi
138130
139-
xvfb-run --auto-servernum --server-args='-screen 0 640x480x24' \
140-
/opt/Unity/Editor/Unity -batchmode -nographics -silent-crashes -logFile -projectPath . -runEditorTests -enableCodeCoverage -coverageOptions 'assemblyFilters:+CSharpCompilerSettings' || exit 0
131+
$RUN_UNITY -runTests -testPlatform playmode -enableCodeCoverage || exit 0
132+
133+
# Run editmode tests
134+
- name: "Run editmode tests"
135+
if: always() && steps.activation.conclusion == 'success'
136+
run: |
137+
$RUN_UNITY -executeMethod Coffee.CSharpCompilerSettings.Menus.SetDevelopMode || exit 0
138+
$RUN_UNITY -runTests -testPlatform editmode -enableCodeCoverage || exit 0
141139
142140
# Push test results
143141
- name: Push test results

0 commit comments

Comments
 (0)