-
Notifications
You must be signed in to change notification settings - Fork 18
139 lines (111 loc) · 3.91 KB
/
ci.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
# test:
# name: Run Tests
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# # Git LFS
# - name: Create LFS file list
# run: git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id
# - name: Restore LFS cache
# uses: actions/cache@v3
# id: lfs-cache
# with:
# path: .git/lfs
# key: ${{ runner.os }}-lfs-${{ hashFiles('.lfs-assets-id') }}
# - name: Git LFS Pull
# run: |
# git lfs pull
# git add .
# git reset --hard
# # Cache
# - uses: actions/cache@v3
# with:
# path: Library
# key: Library-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }}
# restore-keys: |
# Library-
# - name: Run Unity Tests
# uses: game-ci/unity-test-runner@v4
# env:
# UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
# UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
# UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
# with:
# projectPath: .
# testMode: all
# artifactsPath: TestResults
# githubToken: ${{ secrets.GITHUB_TOKEN }}
# - name: Upload Test Results
# uses: actions/upload-artifact@v3
# if: always()
# with:
# name: Test Results
# path: TestResults
format:
name: Check Code Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '6.0.x'
- name: Install dotnet-format
run: dotnet tool install -g dotnet-format
# Create a temporary solution and add all .cs files
- name: Create temporary solution
run: |
# Create a temporary directory for the solution
mkdir -p _temp
cd _temp
# Create a new solution
dotnet new sln -n TempSolution
# Create a temporary project and add all .cs files
dotnet new classlib -n TempProject
rm ./TempProject/Class1.cs
# Copy all .cs files from Assets to the temp project (adjust paths as needed)
find ../Assets -name "*.cs" -exec cp {} ./TempProject/ \;
# Add project to solution
dotnet sln add ./TempProject/TempProject.csproj
cd ..
# Run dotnet format on the temporary solution
- name: Check C# Formatting
run: dotnet format ./_temp/TempSolution.sln --verify-no-changes --verbosity detailed --severity error
# Cleanup
- name: Cleanup temporary files
run: rm -rf _temp
lint:
name: Run Code Linting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install dotnet tools
run: |
dotnet new tool-manifest
dotnet tool install JetBrains.ReSharper.GlobalTools
# Create a temporary solution and add all .cs files
- name: Create temporary solution
run: |
# Create a temporary directory for the solution
mkdir -p _temp
cd _temp
# Create a new solution
dotnet new sln -n TempSolution
# Create a temporary project and add all .cs files
dotnet new classlib -n TempProject
rm ./TempProject/Class1.cs
# Copy all .cs files from Assets to the temp project
find ../Assets -name "*.cs" -exec cp {} ./TempProject/ \;
# Add project to solution
dotnet sln add ./TempProject/TempProject.csproj
cd ..
- name: Run ReSharper CLI inspection
run: |
dotnet jb inspectcode ./_temp/TempSolution.sln --output=inspect-results.xml --severity=WARNING