mirror of
https://github.com/game-ci/unity-test-runner.git
synced 2026-02-03 02:09:08 +08:00
Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 😎
|
name: Actions 😎
|
||||||
on: [push]
|
on:
|
||||||
|
pull_request: {}
|
||||||
|
push: { branches: [master] }
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
testRunnerInAllModes:
|
testRunnerInAllModes:
|
||||||
@@ -10,14 +12,19 @@ jobs:
|
|||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v1
|
uses: actions/checkout@v1
|
||||||
|
|
||||||
|
# Activate license
|
||||||
|
- name: Activate Unity
|
||||||
|
uses: webbertakken/unity-activate@v1
|
||||||
|
env:
|
||||||
|
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
|
||||||
|
|
||||||
# Configure test runner
|
# Configure test runner
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
id: allTests
|
id: allTests
|
||||||
uses: ./
|
uses: ./
|
||||||
env:
|
env:
|
||||||
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
|
|
||||||
TEST_MODE: all
|
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
|
# Test implicit ARTIFACTS_PATH, by not setting it
|
||||||
|
|
||||||
# Upload artifacts
|
# Upload artifacts
|
||||||
@@ -35,14 +42,19 @@ jobs:
|
|||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v1
|
uses: actions/checkout@v1
|
||||||
|
|
||||||
|
# Activate license
|
||||||
|
- name: Activate Unity
|
||||||
|
uses: webbertakken/unity-activate@v1
|
||||||
|
env:
|
||||||
|
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
|
||||||
|
|
||||||
# Configure test runner
|
# Configure test runner
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
id: editMode
|
id: editMode
|
||||||
uses: ./
|
uses: ./
|
||||||
env:
|
env:
|
||||||
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
|
|
||||||
TEST_MODE: editmode
|
TEST_MODE: editmode
|
||||||
UNITY_PROJECT_PATH: unity-project-with-correct-tests
|
PROJECT_PATH: unity-project-with-correct-tests
|
||||||
ARTIFACTS_PATH: artifacts/editmode
|
ARTIFACTS_PATH: artifacts/editmode
|
||||||
|
|
||||||
# Upload artifacts
|
# Upload artifacts
|
||||||
@@ -60,14 +72,19 @@ jobs:
|
|||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v1
|
uses: actions/checkout@v1
|
||||||
|
|
||||||
|
# Activate license
|
||||||
|
- name: Activate Unity
|
||||||
|
uses: webbertakken/unity-activate@v1
|
||||||
|
env:
|
||||||
|
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
|
||||||
|
|
||||||
# Configure test runner
|
# Configure test runner
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
id: playMode
|
id: playMode
|
||||||
uses: ./
|
uses: ./
|
||||||
env:
|
env:
|
||||||
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
|
|
||||||
TEST_MODE: playmode
|
TEST_MODE: playmode
|
||||||
UNITY_PROJECT_PATH: unity-project-with-correct-tests
|
PROJECT_PATH: unity-project-with-correct-tests
|
||||||
ARTIFACTS_PATH: artifacts/editmode
|
ARTIFACTS_PATH: artifacts/editmode
|
||||||
|
|
||||||
# Upload artifacts
|
# Upload artifacts
|
||||||
@@ -85,22 +102,26 @@ jobs:
|
|||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v1
|
uses: actions/checkout@v1
|
||||||
|
|
||||||
|
# Activate license
|
||||||
|
- name: Activate Unity
|
||||||
|
uses: webbertakken/unity-activate@v1
|
||||||
|
env:
|
||||||
|
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
|
||||||
|
|
||||||
# Configure first test runner
|
# Configure first test runner
|
||||||
- name: Tests in editmode 📝
|
- name: Tests in editmode 📝
|
||||||
uses: ./
|
uses: ./
|
||||||
env:
|
env:
|
||||||
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
|
|
||||||
TEST_MODE: editmode
|
TEST_MODE: editmode
|
||||||
UNITY_PROJECT_PATH: unity-project-with-correct-tests
|
PROJECT_PATH: unity-project-with-correct-tests
|
||||||
ARTIFACTS_PATH: artifacts/editmode
|
ARTIFACTS_PATH: artifacts/editmode
|
||||||
|
|
||||||
# Configure second test runner
|
# Configure second test runner
|
||||||
- name: Tests in playmode 📺
|
- name: Tests in playmode 📺
|
||||||
uses: ./
|
uses: ./
|
||||||
env:
|
env:
|
||||||
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
|
|
||||||
TEST_MODE: playmode
|
TEST_MODE: playmode
|
||||||
UNITY_PROJECT_PATH: unity-project-with-correct-tests
|
PROJECT_PATH: unity-project-with-correct-tests
|
||||||
ARTIFACTS_PATH: artifacts/playmode
|
ARTIFACTS_PATH: artifacts/playmode
|
||||||
|
|
||||||
# Upload combined artifacts
|
# Upload combined artifacts
|
||||||
|
|||||||
41
README.md
41
README.md
@@ -1,20 +1,31 @@
|
|||||||
# Unity - Test runner
|
# 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
|
This is a recommended step to prepare your pipeline for using the
|
||||||
[Build](https://github.com/webbertakken/unity-actions#build)
|
[Build](https://github.com/webbertakken/unity-actions#build)
|
||||||
action from the
|
action. This action also requires the [activation](https://github.com/marketplace/actions/unity-activate) step.
|
||||||
[Unity Actions](https://github.com/webbertakken/unity-actions)
|
|
||||||
collection.
|
|
||||||
|
|
||||||
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
|
## 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
|
```yaml
|
||||||
name: Test project
|
name: Test project
|
||||||
@@ -32,15 +43,13 @@ Configure the test runner as follows:
|
|||||||
# Configure test runner
|
# Configure test runner
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
id: myTestStep
|
id: myTestStep
|
||||||
uses: webbertakken/unity-test-runner@v1
|
uses: webbertakken/unity-test-runner@v1.1
|
||||||
env:
|
env:
|
||||||
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
|
|
||||||
|
|
||||||
# Choose: "all", "playmode", "editmode"
|
# Choose: "all", "playmode", "editmode"
|
||||||
TEST_MODE: all
|
TEST_MODE: all
|
||||||
|
|
||||||
# Optional: Path to your project, leave blank for "./"
|
# 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"
|
# Optional: Artifacts path, leave blank for "artifacts"
|
||||||
ARTIFACTS_PATH: store/artifacts/here
|
ARTIFACTS_PATH: store/artifacts/here
|
||||||
@@ -64,3 +73,9 @@ Commit and push your workflow definition.
|
|||||||
Visit
|
Visit
|
||||||
[Unity Actions](https://github.com/webbertakken/unity-actions)
|
[Unity Actions](https://github.com/webbertakken/unity-actions)
|
||||||
to find related actions for Unity.
|
to find related actions for Unity.
|
||||||
|
|
||||||
|
Feel free to contribute.
|
||||||
|
|
||||||
|
## Licence
|
||||||
|
|
||||||
|
[MIT](./LICENSE)
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# Set the license file path
|
# Set the license file path
|
||||||
LICENSE_FILE_PATH=UnityLicenseFile.ulf
|
UNITY_PROJECT_PATH=$GITHUB_WORKSPACE/$PROJECT_PATH
|
||||||
UNITY_PROJECT_PATH=$GITHUB_WORKSPACE/$UNITY_PROJECT_PATH
|
|
||||||
|
|
||||||
# Set the artifacts path
|
# Set the artifacts path
|
||||||
if [ -z "$ARTIFACTS_PATH" ]; then
|
if [ -z "$ARTIFACTS_PATH" ]; then
|
||||||
@@ -27,29 +26,6 @@ case $TEST_MODE in
|
|||||||
;;
|
;;
|
||||||
esac
|
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)
|
# The following tests are 2019 mode (requires Unity 2019.2.11f1 or later)
|
||||||
# Reference: https://docs.unity3d.com/2019.3/Documentation/Manual/CommandLineArguments.html
|
# Reference: https://docs.unity3d.com/2019.3/Documentation/Manual/CommandLineArguments.html
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user