-
Notifications
You must be signed in to change notification settings - Fork 1
183 lines (168 loc) · 6.21 KB
/
test-build.yaml
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
name: Build Pipeline on the Unity Project
on:
push:
paths:
- '.github/workflows/**'
- 'Assets/**'
- 'Packages/**'
- 'ProjectSettings/**'
branches:
- main
- dev
pull_request:
types:
- opened
- synchronize
- reopened
branches:
- main
- dev
# paths:
# - '.github/workflows/**'
# - 'Assets/**'
# - 'Packages/**'
# - 'ProjectSettings/**'
release:
types:
- published
workflow_dispatch:
inputs:
workflow_mode:
description: '[release] [Android, iOS, StandaloneLinux64, WebGL, StandaloneWindows, StandaloneWindows64, WSAPlayer, StandaloneOSX, Steam]'
required: false
default: ''
jobs:
tests:
name: Test Code Quality
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- 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
- name: Cache Library
uses: actions/cache@v3
with:
path: Library
key: Library-test-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }}
restore-keys: Library-test-
- name: Run Unit Tests
uses: game-ci/unity-test-runner@v2
with:
projectPath: aplib.net-demo/
env:
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
with:
githubToken: ${{ secrets.GITHUB_TOKEN }}
- name: Setup dotnet 5 for SonarQube
uses: actions/setup-dotnet@v2
with:
dotnet-version: '5.0.x'
- name: Set up JDK 11 for SonarQube
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 11
- name: Setup Unity for SonarQube
id: setup-unity
uses: kuler90/setup-unity@v1
- name: Activate Unity for SonarQube
uses: kuler90/activate-unity@v1
with:
unity-username: ${{ secrets.UNITY_EMAIL }}
unity-password: ${{ secrets.UNITY_PASSWORD }}
unity-license: ${{ secrets.UNITY_LICENSE }}
- name: SonarQube Analysis
env:
FrameworkPathOverride: ${{ steps.setup-unity.outputs.unity-path }}/../Data/MonoBleedingEdge/
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
sudo rm -rf Library
pwd; ls -alh
xvfb-run --auto-servernum ${{ steps.setup-unity.outputs.unity-path }} -batchmode -nographics -quit -logFile "-" -customBuildName aplib.net-demo -projectPath aplib.net-demo/. -executeMethod Packages.Rider.Editor.RiderScriptEditor.SyncSolution
pwd; ls -alh
sed -i 's/<ReferenceOutputAssembly>false<\/ReferenceOutputAssembly>/<ReferenceOutputAssembly>true<\/ReferenceOutputAssembly>/g' *.csproj
sed -i 's/\([A-Za-z0-9.-]\+csproj\)/aplib.net-demo\/&/g' aplib.net-demo.sln
mv aplib.net-demo.sln ..
cd ..
dotnet tool install --global dotnet-sonarscanner
dotnet sonarscanner begin \
/o:"finol-digital" \
/k:"finol-digital_aplib.net-demo" \
/d:sonar.login="$SONAR_TOKEN" \
/d:sonar.host.url=https://sonarcloud.io \
/d:sonar.exclusions=Assets/Plugins/**,Assets/Mirror/**, \
/d:sonar.cpd.exclusions=Assets/Tests/** \
/d:sonar.coverage.exclusions=Assets/Tests/** \
/d:sonar.cs.nunit.reportsPaths=aplib.net-demo/artifacts/editmode-results.xml,aplib.net-demo/artifacts/playmode-results.xml \
/d:sonar.cs.opencover.reportsPaths=aplib.net-demo/CodeCoverage/aplib.net-demo-opencov/EditMode/TestCoverageResults_0000.xml,aplib.net-demo/CodeCoverage/aplib.net-demo-opencov/PlayMode/TestCoverageResults_0000.xml
dotnet build aplib.net-demo.sln
dotnet sonarscanner end /d:sonar.login="$SONAR_TOKEN"
cd aplib.net-demo
- name: SonarQube Quality Gate Check
uses: SonarSource/[email protected]
with:
scanMetadataReportFile: ../.sonarqube/out/.sonar/report-task.txt
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
# - name: Update Release Notes
# if: github.event.action == 'published'
# env:
# RELEASE_NOTES: ${{ github.event.release.body }}
# run: |
# echo "$RELEASE_NOTES" > fastlane/metadata/android/en-US/changelogs/default.txt
# echo "$RELEASE_NOTES" > fastlane/metadata/en-US/release_notes.txt
# - name: Auto-Commit Release Notes
# if: github.event.action == 'published'
# uses: stefanzweifel/git-auto-commit-action@v4
# with:
# branch: main
# file_pattern: fastlane/metadata
# commit_message: Update Release Notes
# build:
# name: Build Project
# runs-on: ubuntu-latest
# strategy:
# matrix:
# unity-version: [2022.3.19f1]
# platform: [ StandaloneOSX, StandaloneWindows64, StandaloneLinux64, WebGL ]
# steps:
# - name: Checkout Repository
# uses: actions/checkout@v4
# - uses: actions/cache@v3
# with:
# path: Library
# key: Library-aplib.net-demo
# restore-keys: |
# Library-
# Library-aplib.net-demo-
# - name: Build Project
# uses: game-ci/[email protected]
# env:
# UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
# UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
# UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
# with:
# targetPlatform: ${{ matrix.platform }}
# unityVersion: ${{ matrix.unity-version }}
# # buildMethod: Cgs.Editor.BuildCgs.BuildOptions
# - uses: actions/upload-artifact@v3
# with:
# name: Build
# path: Build