mirror of
https://github.com/game-ci/unity-test-runner.git
synced 2026-01-29 22:49:12 +08:00
Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3d7f5a853b | ||
|
|
b846d206bc | ||
|
|
2bcc487a09 | ||
|
|
ae2ae7470f | ||
|
|
02ff2d03e1 | ||
|
|
f8bd2b7266 | ||
|
|
d1b98bf91e | ||
|
|
fd4bc863ba | ||
|
|
98f19717b4 | ||
|
|
8f88c85bbf | ||
|
|
7a50426e16 | ||
|
|
503c7cb617 |
43
.github/workflows/main.yml
vendored
43
.github/workflows/main.yml
vendored
@@ -1,5 +1,7 @@
|
||||
name: Actions 😎
|
||||
on: [push]
|
||||
on:
|
||||
pull_request: {}
|
||||
push: { branches: [master] }
|
||||
|
||||
jobs:
|
||||
testRunnerInAllModes:
|
||||
@@ -10,14 +12,19 @@ jobs:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v1
|
||||
|
||||
# Activate license
|
||||
- name: Activate Unity
|
||||
uses: webbertakken/unity-activate@v1
|
||||
env:
|
||||
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
|
||||
|
||||
# Configure test runner
|
||||
- name: Run tests
|
||||
id: allTests
|
||||
uses: ./
|
||||
env:
|
||||
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
|
||||
TEST_MODE: all
|
||||
UNITY_PROJECT_PATH: unity-project-with-correct-tests
|
||||
PROJECT_PATH: unity-project-with-correct-tests
|
||||
# Test implicit ARTIFACTS_PATH, by not setting it
|
||||
|
||||
# Upload artifacts
|
||||
@@ -35,14 +42,19 @@ jobs:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v1
|
||||
|
||||
# Activate license
|
||||
- name: Activate Unity
|
||||
uses: webbertakken/unity-activate@v1
|
||||
env:
|
||||
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
|
||||
|
||||
# Configure test runner
|
||||
- name: Run tests
|
||||
id: editMode
|
||||
uses: ./
|
||||
env:
|
||||
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
|
||||
TEST_MODE: editmode
|
||||
UNITY_PROJECT_PATH: unity-project-with-correct-tests
|
||||
PROJECT_PATH: unity-project-with-correct-tests
|
||||
ARTIFACTS_PATH: artifacts/editmode
|
||||
|
||||
# Upload artifacts
|
||||
@@ -60,14 +72,19 @@ jobs:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v1
|
||||
|
||||
# Activate license
|
||||
- name: Activate Unity
|
||||
uses: webbertakken/unity-activate@v1
|
||||
env:
|
||||
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
|
||||
|
||||
# Configure test runner
|
||||
- name: Run tests
|
||||
id: playMode
|
||||
uses: ./
|
||||
env:
|
||||
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
|
||||
TEST_MODE: playmode
|
||||
UNITY_PROJECT_PATH: unity-project-with-correct-tests
|
||||
PROJECT_PATH: unity-project-with-correct-tests
|
||||
ARTIFACTS_PATH: artifacts/editmode
|
||||
|
||||
# Upload artifacts
|
||||
@@ -85,22 +102,26 @@ jobs:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v1
|
||||
|
||||
# Activate license
|
||||
- name: Activate Unity
|
||||
uses: webbertakken/unity-activate@v1
|
||||
env:
|
||||
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
|
||||
|
||||
# Configure first test runner
|
||||
- name: Tests in editmode 📝
|
||||
uses: ./
|
||||
env:
|
||||
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
|
||||
TEST_MODE: editmode
|
||||
UNITY_PROJECT_PATH: unity-project-with-correct-tests
|
||||
PROJECT_PATH: unity-project-with-correct-tests
|
||||
ARTIFACTS_PATH: artifacts/editmode
|
||||
|
||||
# Configure second test runner
|
||||
- name: Tests in playmode 📺
|
||||
uses: ./
|
||||
env:
|
||||
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
|
||||
TEST_MODE: playmode
|
||||
UNITY_PROJECT_PATH: unity-project-with-correct-tests
|
||||
PROJECT_PATH: unity-project-with-correct-tests
|
||||
ARTIFACTS_PATH: artifacts/playmode
|
||||
|
||||
# Upload combined artifacts
|
||||
|
||||
41
README.md
41
README.md
@@ -1,20 +1,31 @@
|
||||
# Unity - Test runner
|
||||
[](https://github.com/WebberTakken/unity-test-runner/workflows/Actions%20%F0%9F%98%8E/badge.svg)
|
||||
[](https://github.com/webbertakken/unity-test-runner/actions?query=branch%3Amaster+workflow%3A%22Actions+%F0%9F%98%8E%22)
|
||||
|
||||
[Github Action](https://github.com/features/actions)
|
||||
to run tests for any Unity project.
|
||||
---
|
||||
|
||||
GitHub Action to
|
||||
[run tests](https://github.com/marketplace/actions/unity-test-runner)
|
||||
for any Unity project.
|
||||
|
||||
Part of the
|
||||
[Unity Actions](https://github.com/webbertakken/unity-actions)
|
||||
collection.
|
||||
|
||||
---
|
||||
|
||||
This is a recommended step to prepare your pipeline for using the
|
||||
[Build](https://github.com/webbertakken/unity-actions#build)
|
||||
action from the
|
||||
[Unity Actions](https://github.com/webbertakken/unity-actions)
|
||||
collection.
|
||||
action. This action also requires the [activation](https://github.com/marketplace/actions/unity-activate) step.
|
||||
|
||||
Requires the [activation](https://github.com/marketplace/actions/unity-activate) step.
|
||||
## Documentation
|
||||
|
||||
See the
|
||||
[Unity Actions](https://github.com/webbertakken/unity-actions)
|
||||
collection repository for workflow documentation and reference implementation.
|
||||
|
||||
## Usage
|
||||
|
||||
Create or edit the file called `.github/workflows/activation.yml` and add a job to it.
|
||||
Create or edit the file called `.github/workflows/main.yml` and add a job to it.
|
||||
|
||||
```yaml
|
||||
name: Test project
|
||||
@@ -32,15 +43,13 @@ Configure the test runner as follows:
|
||||
# Configure test runner
|
||||
- name: Run tests
|
||||
id: myTestStep
|
||||
uses: webbertakken/unity-test-runner@v1
|
||||
uses: webbertakken/unity-test-runner@v1.1
|
||||
env:
|
||||
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
|
||||
|
||||
# Choose: "all", "playmode", "editmode"
|
||||
TEST_MODE: all
|
||||
TEST_MODE: all
|
||||
|
||||
# Optional: Path to your project, leave blank for "./"
|
||||
UNITY_PROJECT_PATH: relative/path/to/your/project
|
||||
PROJECT_PATH: relative/path/to/your/project
|
||||
|
||||
# Optional: Artifacts path, leave blank for "artifacts"
|
||||
ARTIFACTS_PATH: store/artifacts/here
|
||||
@@ -64,3 +73,9 @@ Commit and push your workflow definition.
|
||||
Visit
|
||||
[Unity Actions](https://github.com/webbertakken/unity-actions)
|
||||
to find related actions for Unity.
|
||||
|
||||
Feel free to contribute.
|
||||
|
||||
## Licence
|
||||
|
||||
[MIT](./LICENSE)
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Set the license file path
|
||||
LICENSE_FILE_PATH=UnityLicenseFile.ulf
|
||||
UNITY_PROJECT_PATH=$GITHUB_WORKSPACE/$UNITY_PROJECT_PATH
|
||||
UNITY_PROJECT_PATH=$GITHUB_WORKSPACE/$PROJECT_PATH
|
||||
|
||||
# Set the artifacts path
|
||||
if [ -z "$ARTIFACTS_PATH" ]; then
|
||||
@@ -27,29 +26,6 @@ case $TEST_MODE in
|
||||
;;
|
||||
esac
|
||||
|
||||
# Copy license file from Github variables
|
||||
echo "$UNITY_LICENSE" | tr -d '\r' > $LICENSE_FILE_PATH
|
||||
echo "$UNITY_LICENSE" | tr -d '\r' > /root/.local/share/unity3d/Unity/Unity_lic.ulf
|
||||
# TODO - test if this line has any effect
|
||||
echo "$UNITY_LICENSE" | tr -d '\r' > /root/.local/share/unity3d/Unity/Unity_v2019.x.ulf
|
||||
|
||||
##
|
||||
## Activate license
|
||||
##
|
||||
echo "Requesting activation"
|
||||
xvfb-run --auto-servernum --server-args='-screen 0 640x480x24' \
|
||||
/opt/Unity/Editor/Unity \
|
||||
-batchmode \
|
||||
-nographics \
|
||||
-logFile /dev/stdout \
|
||||
-quit \
|
||||
-manualLicenseFile $LICENSE_FILE_PATH
|
||||
# This is expected to always exit with code 1 (both success and failure).
|
||||
# Convert to exit code 0 by echoing the current exit code.
|
||||
echo $?
|
||||
# Exit code is now 0
|
||||
|
||||
|
||||
# The following tests are 2019 mode (requires Unity 2019.2.11f1 or later)
|
||||
# Reference: https://docs.unity3d.com/2019.3/Documentation/Manual/CommandLineArguments.html
|
||||
|
||||
@@ -164,7 +140,7 @@ fi
|
||||
if [ $PLAY_MODE = true ]; then
|
||||
echo ""
|
||||
echo "###########################"
|
||||
echo "# Edit Mode Results #"
|
||||
echo "# Play Mode Results #"
|
||||
echo "###########################"
|
||||
echo ""
|
||||
cat "$FULL_ARTIFACTS_PATH/playmode-results.xml"
|
||||
|
||||
Reference in New Issue
Block a user