Events #22
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Unity Editmode Test | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout repository | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
# Cache | |
- uses: actions/cache@v3 | |
with: | |
path: Library | |
key: Library-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }} | |
restore-keys: | | |
Library- | |
# Activate Unity License using the secret ULF file | |
- name: Activate Unity License | |
env: | |
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} # Reference the ULF license secret | |
run: | | |
echo "$UNITY_LICENSE" > UnityLicenseFile.ulf | |
unity-editor -batchmode -nographics -logfile -quit -manualLicenseFile UnityLicenseFile.ulf | |
# Run Unity Tests | |
- name: Run Unity Tests | |
uses: game-ci/unity-test-runner@v4 | |
env: | |
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} # Pass the Unity license to the runner | |
with: | |
githubToken: ${{ secrets.GITHUB_TOKEN }} | |
testMode: editmode # You can change this to playmode or editmode depending on the test type | |
# Build the Unity project | |
- name: Build project | |
uses: game-ci/unity-builder@v4 | |
env: | |
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} # Unity license for build | |
with: | |
targetPlatform: WebGL # Adjust based on your target platform | |
# Publish Test Results | |
- name: Publish Test Results | |
uses: actions/upload-artifact@v3 | |
with: | |
name: test-results | |
path: test-results.xml | |
# Clean up License | |
- name: Return License | |
run: | | |
unity-editor -batchmode -nographics -logfile -quit -returnlicense |