A small experimental Unity Editor package for running Unity Project Auditor in CI with GitHub Actions.
Once the audit completes, extensions generate:
- a SARIF file for GitHub code scanning
- GitHub annotations
- a Markdown summary for GitHub Actions
- SARIF includes only
CriticalandMajorissues with file paths. - GitHub annotations emit
::errorforCriticalissues and::warningforMajorissues. - The Markdown summary includes the top 10
CriticalandMajorissues after filtering. - The native
.projectauditorfile is still saved in full.
This package can be installed directly from a GitHub repository using Unity Package Manager.
In Unity:
- Open Window > Package Manager
- Click the + button
- Select Add package from git URL...
- Paste the repository URL
Example:
https://github.com/keiranlovett/unity-project-auditor-ci-package.git
Or manually
{
"dependencies": {
"com.kvcl.project-auditor-ci": "https://github.com/keiranlovett/unity-project-auditor-ci-package.git"
}
}
Use this method in CI:
ProjectAuditorCI.AuditAndExport
The included sample workflow runs the audit in CI, publishes a Markdown summary to the GitHub Actions job summary, uploads SARIF for GitHub code scanning, and uploads the raw .projectauditor report as an artifact.
A sample workflow is included at:
Samples/unity-project-auditor.yml
In your project this file should be renamed and moved to the workflows folder:
.github/workflows/project-auditor.yml
Then configure the required Unity secrets in your GitHub repository:
UNITY_LICENSEUNITY_EMAILUNITY_PASSWORD
You can copy and use as is, or modify it to better suit your project.
PROJECT_AUDITOR_FAIL_THRESHOLD— Fails the run when the total issue count meets or exceeds this value.PROJECT_AUDITOR_FAIL_ON_ANY_ISSUE— Fails the run if any issue is found.
PROJECT_AUDITOR_REPORT— Output path for the.projectauditorreport file.PROJECT_AUDITOR_SARIF— Output path for the SARIF file.PROJECT_AUDITOR_SUMMARY— Output path for the.mdsummary file.
PROJECT_AUDITOR_CATEGORIES— Comma-separated list of Project Auditor categories to include in the audit.PROJECT_AUDITOR_ASSEMBLIES— Comma-separated list of Assemblies to audit.PROJECT_AUDITOR_PLATFORM— (Optional) Build target override used for the audit. Use a validUnityEditor.BuildTargetvalue such asStandaloneWindows64,Android,iOS, orWebGL. See the official UnityBuildTargetdocumentation.PROJECT_AUDITOR_CODE_OPTIMIZATION— (Optional) Code optimisation mode used during analysis. Valid values areDebugandRelease. See the official UnityCodeOptimizationdocumentation.PROJECT_AUDITOR_COMPILATION_MODE— (Optional) Compilation mode used when auditing code. Valid values areEditorandPlayer. See the official Unity Project AuditorCompilationModedocumentation.
Example:
PROJECT_AUDITOR_ASSEMBLIES=MyGame.Core,MyGame.Runtime
PROJECT_AUDITOR_EXCLUDE_PATH_PREFIXES- Suppresses package and and any other paths from reporting outputs.
Example:
PROJECT_AUDITOR_EXCLUDE_PATH_PREFIXES=Packages/com.unity.,Library/PackageCache/
- Improved Extensions Support
- Extension: Per Assembly Reports
MIT License