Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
184 changes: 184 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
name: ci.yml

on:
push:
pull_request:
workflow_dispatch:

env:
UNITY_VERSION: 6000.2.9f1
UNITY_CHANGESET: e0c4e791ab71

jobs:
playmode-tests:
name: PlayMode Tests (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]

steps:
- name: Checkout project
uses: actions/checkout@v4
with:
lfs: true

- name: Cache Library
uses: actions/cache@v4
with:
path: Library
key: Library-${{ runner.os }}-${{ env.UNITY_VERSION }}-${{ hashFiles('Packages/manifest.json') }}
restore-keys: |
Library-${{ runner.os }}-${{ env.UNITY_VERSION }}-
Library-${{ runner.os }}-

- name: Configure Unity license (Linux)
if: runner.os == 'Linux'
shell: bash
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} # generate .ulf from any machine where you’ve activated Unity Personal (Hub -> Manage License -> “Manual activation” -> save the license file)” and upload the response Unity emails back. Once you have the .ulf, add UNITY_LICENSE to your repo’s secrets with its base64 text; the workflow will then decode it and tests will run on all three OS runners.
run: |
python3 -c "import base64, os, sys, pathlib; data=os.environ.get('UNITY_LICENSE'); \
if not data: sys.stderr.write('UNITY_LICENSE secret is required to run Unity in CI.\n'); sys.exit(1); \
target = pathlib.Path.home() / '.local/share/unity3d/Unity/Unity_lic.ulf'; \
target.parent.mkdir(parents=True, exist_ok=True); \
target.write_bytes(base64.b64decode(data)); \
print(f'Wrote Unity license to {target}')"
echo "UNITY_LICENSE_FILE=$HOME/.local/share/unity3d/Unity/Unity_lic.ulf" >> "$GITHUB_ENV"

- name: Configure Unity license (macOS)
if: runner.os == 'macOS'
shell: bash
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
run: |
python3 -c "import base64, os, sys, pathlib; data=os.environ.get('UNITY_LICENSE'); \
if not data: sys.stderr.write('UNITY_LICENSE secret is required to run Unity in CI.\n'); sys.exit(1); \
target = pathlib.Path.home() / 'Library/Application Support/Unity/Unity_lic.ulf'; \
target.parent.mkdir(parents=True, exist_ok=True); \
target.write_bytes(base64.b64decode(data)); \
print(f'Wrote Unity license to {target}')"
echo "UNITY_LICENSE_FILE=$HOME/Library/Application Support/Unity/Unity_lic.ulf" >> "$GITHUB_ENV"

- name: Configure Unity license (Windows)
if: runner.os == 'Windows'
shell: pwsh
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
run: |
if (-not $env:UNITY_LICENSE) {
Write-Error "UNITY_LICENSE secret is required to run Unity in CI." -ErrorAction Stop
}
$licenseDir = Join-Path $env:LOCALAPPDATA 'Unity'
New-Item -ItemType Directory -Path $licenseDir -Force | Out-Null
$licensePath = Join-Path $licenseDir 'Unity_lic.ulf'
[System.IO.File]::WriteAllBytes($licensePath, [System.Convert]::FromBase64String($env:UNITY_LICENSE))
Add-Content -Path $env:GITHUB_ENV -Value "UNITY_LICENSE_FILE=$licensePath"
Comment on lines +36 to +77

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Gate Unity CI when secrets are unavailable

The workflow unconditionally requires secrets.UNITY_LICENSE and exits with an error when it is absent. GitHub does not expose repository secrets to pull_request workflows triggered from forks, so any external contributor PR will fail before tests even run. Consider guarding the license configuration and test steps behind a check for a present secret or skipping the entire job when the event originates from a fork to keep CI usable for outside contributions.

Useful? React with 👍 / 👎.


- name: Install Unity dependencies (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
libgtk2.0-0 \
libgtk-3-0 \
libglib2.0-0 \
libasound2 \
libxcomposite1 \
libxcursor1 \
libxdamage1 \
libxrandr2 \
libxfixes3 \
libxtst6 \
libxi6 \
libnss3 \
libglu1-mesa \
xvfb

- name: Install Unity editor (Linux)
if: runner.os == 'Linux'
run: |
curl -L "https://download.unity3d.com/download_unity/${UNITY_CHANGESET}/Unity.tar.xz" -o Unity.tar.xz
sudo mkdir -p /opt/unity
sudo tar -xJf Unity.tar.xz -C /opt/unity
sudo chmod +x /opt/unity/Editor/Unity
echo "UNITY_EDITOR_PATH=/opt/unity/Editor/Unity" >> "$GITHUB_ENV"

- name: Install Unity editor (macOS)
if: runner.os == 'macOS'
run: |
curl -L "https://download.unity3d.com/download_unity/${UNITY_CHANGESET}/MacEditorInstaller/Unity.pkg" -o Unity.pkg
sudo installer -pkg Unity.pkg -target /
UNITY_APP="/Applications/Unity/Unity.app/Contents/MacOS/Unity"
if [ ! -f "$UNITY_APP" ]; then
echo "::error::Unity editor not found at $UNITY_APP"
exit 1
fi
echo "UNITY_EDITOR_PATH=$UNITY_APP" >> "$GITHUB_ENV"

- name: Install Unity editor (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
$installer = Join-Path $env:TEMP "UnitySetup-${{ env.UNITY_VERSION }}.exe"
Invoke-WebRequest "https://download.unity3d.com/download_unity/${{ env.UNITY_CHANGESET }}/Windows64EditorInstaller/UnitySetup64-${{ env.UNITY_VERSION }}.exe" -OutFile $installer
Start-Process -FilePath $installer -ArgumentList "/S","/D=C:\Program Files\Unity" -Wait
$unityPath = "C:\Program Files\Unity\Editor\Unity.exe"
if (-not (Test-Path $unityPath)) {
throw "Unity editor not found at $unityPath"
}
Add-Content -Path $env:GITHUB_ENV -Value "UNITY_EDITOR_PATH=$unityPath"

- name: Run PlayMode tests (Linux)
if: runner.os == 'Linux'
run: |
xvfb-run --auto-servernum -- \
"$UNITY_EDITOR_PATH" \
-batchmode \
-nographics \
-quit \
-projectPath "$GITHUB_WORKSPACE" \
-runTests \
-testPlatform PlayMode \
-testResults "$GITHUB_WORKSPACE/TestResults-${{ runner.os }}.xml" \
-logFile "$GITHUB_WORKSPACE/Unity-${{ runner.os }}.log"

- name: Run PlayMode tests (macOS)
if: runner.os == 'macOS'
run: |
"$UNITY_EDITOR_PATH" \
-batchmode \
-nographics \
-quit \
-projectPath "$GITHUB_WORKSPACE" \
-runTests \
-testPlatform PlayMode \
-testResults "$GITHUB_WORKSPACE/TestResults-${{ runner.os }}.xml" \
-logFile "$GITHUB_WORKSPACE/Unity-${{ runner.os }}.log"

- name: Run PlayMode tests (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
& "$env:UNITY_EDITOR_PATH" `
-batchmode `
-nographics `
-quit `
-projectPath "$env:GITHUB_WORKSPACE" `
-runTests `
-testPlatform PlayMode `
-testResults "$env:GITHUB_WORKSPACE\TestResults-${{ runner.os }}.xml" `
-logFile "$env:GITHUB_WORKSPACE\Unity-${{ runner.os }}.log"
if ($LASTEXITCODE -ne 0) {
throw "Unity exited with code $LASTEXITCODE"
}

- name: Upload test artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: unity-playmode-${{ runner.os }}
path: |
TestResults-${{ runner.os }}.xml
Unity-${{ runner.os }}.log
96 changes: 96 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@

# This .gitignore file should be placed at the root of your Unity project directory
#
# Get latest from https://github.com/github/gitignore/blob/master/Unity.gitignore
#
/[Ll]ibrary/
/[Tt]emp/
/[Oo]bj/
/[Bb]uild/
/[Bb]uilds/
/[Ll]ogs/
/[Uu]ser[Ss]ettings/

# MemoryCaptures can get excessive in size.
# They also could contain extremely sensitive data
/[Mm]emoryCaptures/

# Asset meta data should only be ignored when the corresponding asset is also ignored
!/[Aa]ssets/**/*.meta

# Recordings can get excessive in size
/[Rr]ecordings/


# Uncomment this line if you wish to ignore the asset store tools plugin
# /[Aa]ssets/AssetStoreTools*

# Autogenerated Jetbrains Rider plugin
[Aa]ssets/Plugins/Editor/JetBrains*

# Visual Studio cache directory
.vs/

# Gradle cache directory
.gradle/

# Autogenerated VS/MD/Consulo solution and project files
ExportedObj/
.consulo/
*.csproj
*.unityproj
*.sln
*.suo
*.tmp
*.user
*.userprefs
*.pidb
*.booproj
*.svd
*.pdb
*.mdb
*.opendb
*.VC.db

# Unity3D generated meta files
*.pidb.meta
*.pdb.meta
*.mdb.meta

# Unity3D generated file on crash reports
sysinfo.txt

# Builds
*.apk
*.unitypackage
*.aab
*.app

# Crashlytics generated file
crashlytics-build.properties

# macOS Specific
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
report.xml
Thumbs.db.meta

# JetBrains
/.idea/
.idea/**

# Asset Hunter build info
*.ahbuildinfo

# FMOD
fmod.log
fmod_editor.log
/Assets/Plugins/FMOD/Cache/Editor/FMODStudioCache.asset
/Assets/Plugins/FMOD/Cache/Editor/FMODStudioCache.asset.meta

/Assets/Plugins/FMOD/Cache/Editor.meta
6 changes: 6 additions & 0 deletions .vsconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"version": "1.0",
"components": [
"Microsoft.VisualStudio.Workload.ManagedGame"
]
}
39 changes: 39 additions & 0 deletions Assets/Readme.asset
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fcf7219bab7fe46a1ad266029b2fee19, type: 3}
m_Name: Readme
m_EditorClassIdentifier:
icon: {fileID: 2800000, guid: d19680cd422524695938fbe55cc3b3bd, type: 3}
title: HDRP Empty Template
sections:
- heading: Welcome to the HDRP Empty Template
text: This template includes the settings and assets you need to start creating
with HDRP.
linkText:
url:
- heading: Documentation
text:
linkText: Read more about the HDRP
url: https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@latest/index.html
- heading: Samples
text:
linkText: Samples and content you can use in your project
url: https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@latest?subfolder=/manual/HDRP-Sample-Content.html
- heading: Forums
text:
linkText: Get answers and support
url: https://forum.unity.com/forums/high-definition-render-pipeline.386/
- heading: Bugs
text:
linkText: Report any bugs
url: https://unity3d.com/unity/qa/bug-reporting
loadedLayout: 1
8 changes: 8 additions & 0 deletions Assets/Readme.asset.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Assets/Settings.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading