-
Notifications
You must be signed in to change notification settings - Fork 55
60 lines (51 loc) · 1.61 KB
/
static-code-analysis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
name: Static Code Analysis
on:
push:
branches:
- main
- feat/static-analysis
pull_request:
branches:
- main
- feat/static-analysis
workflow_dispatch:
jobs:
analyze:
runs-on: ubuntu-latest
steps:
# Checkout
- name: Checkout code
uses: actions/checkout@v4
with:
lfs: true
# Cache
- uses: actions/cache@v3
with:
path: Library
key: Library-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }}
restore-keys: |
Library-
- name: Set up .NET Core
uses: actions/setup-dotnet@v2
with:
dotnet-version: '6.0.x'
# Build
- name: Build project
uses: game-ci/unity-builder@v4
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
with:
targetPlatform: StandaloneLinux64
- name: Generate project files
run: |
# Run Unity in batch mode to generate .sln and .csproj files
/opt/unity/Editor/Unity -batchmode -quit -projectPath . -executeMethod UnityEditor.SyncVS.SyncSolution
- name: Restore NuGet packages
run: |
# Assuming Unity generates files in the root or known subdirectory
dotnet restore UnityProject/MyUnityProject.sln # Update with the correct path
- name: Run static code analysis
run: |
dotnet build UnityProject/MyUnityProject.sln /warnaserror /p:TreatWarningsAsErrors=true # Update with the correct path