Compare commits

...

12 Commits
v1 ... v1.1.1

Author SHA1 Message Date
Michael Bradley
3d7f5a853b Fix mislabeled header in entrypoint.sh
Both test mode results were labeled "Edit Mode".
2019-12-15 21:01:18 +01:00
Webber
b846d206bc Update readme for v1.1 2019-12-14 18:56:21 +01:00
Webber
2bcc487a09 Change UNITY_PROJECT_PATH to PROJECT_PATH 2019-12-14 18:56:21 +01:00
Webber
ae2ae7470f Add pull requests as trigger for workflow 2019-12-07 16:13:25 +01:00
Webber
02ff2d03e1 Add activate step 2019-12-07 13:36:23 +01:00
Webber
f8bd2b7266 Remove all licensing code 2019-12-07 13:36:23 +01:00
Webber
d1b98bf91e Add contributing and license 2019-12-03 23:27:48 +01:00
Webber
fd4bc863ba update readme header 2019-12-03 23:27:48 +01:00
Webber
98f19717b4 Fix typo 2019-12-01 02:43:08 +01:00
Webber
8f88c85bbf Fix test workflow 2019-12-01 02:43:08 +01:00
Webber
7a50426e16 Update badge url 2019-12-01 02:43:08 +01:00
Webber Takken
503c7cb617 Add documentation reference 2019-11-30 18:33:14 +01:00
3 changed files with 62 additions and 50 deletions

View File

@@ -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

View File

@@ -1,20 +1,31 @@
# Unity - Test runner
[![Actions status](https://github.com/WebberTakken/unity-test-runner/workflows/Actions%20%F0%9F%98%8E/badge.svg)](https://github.com/WebberTakken/unity-test-runner/workflows/Actions%20%F0%9F%98%8E/badge.svg)
[![Actions status](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)

View File

@@ -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"