-
-
Notifications
You must be signed in to change notification settings - Fork 50
97 lines (82 loc) · 3.1 KB
/
Copy pathcode-complexity.yml
File metadata and controls
97 lines (82 loc) · 3.1 KB
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
name: Code Complexity
on:
pull_request:
paths:
- 'cli/**/*.go'
- 'cli/.go-version'
- 'cli/.golangci-complexity.yml'
- 'Packages/src/**/*.cs'
- 'tools/**/*.cs'
- 'tools/UnityCliLoop.CodeComplexity/**'
- 'tests/UnityCliLoop.CodeComplexity.Tests/**'
- 'scripts/check-code-complexity.sh'
- 'scripts/check-file-length.sh'
- 'docs/file-length.md'
- '.github/workflows/code-complexity.yml'
workflow_dispatch:
permissions:
contents: read
jobs:
complexity:
name: Complexity Report
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
persist-credentials: false
- name: Setup Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c
with:
go-version-file: cli/.go-version
cache: false
- name: Setup .NET
uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68
with:
dotnet-version: 10.0.x
- name: Install golangci-lint
run: |
go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.12.0
echo "$(go env GOPATH)/bin" >> "$GITHUB_PATH"
- name: Test C# complexity host
run: dotnet test tests/UnityCliLoop.CodeComplexity.Tests/UnityCliLoop.CodeComplexity.Tests.csproj --configuration Release
- name: Report complexity
env:
CODE_COMPLEXITY_FAIL_ON_EXCEEDED: 'true'
run: scripts/check-code-complexity.sh
- name: Write complexity artifacts
if: always()
run: |
mkdir -p artifacts
for module_dir in cli/common cli/dispatcher cli/project-runner cli/release-automation; do
artifact_name="go-code-complexity-$(printf '%s' "$module_dir" | tr '/' '-').json"
(cd "$module_dir" && golangci-lint run --config "$GITHUB_WORKSPACE/cli/.golangci-complexity.yml" --issues-exit-code=0 --show-stats=false --output.json.path "$GITHUB_WORKSPACE/artifacts/$artifact_name" ./...)
done
dotnet run --project tools/UnityCliLoop.CodeComplexity/UnityCliLoop.CodeComplexity.csproj -- \
--root . \
--max-complexity 15 \
--format json \
--fail-on-exceeded false > artifacts/csharp-code-complexity.json
- name: Upload complexity artifacts
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
with:
name: code-complexity-results
path: artifacts/*.json
file-length:
name: File Length Report
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
persist-credentials: false
- name: Setup Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c
with:
go-version-file: cli/.go-version
cache: false
- name: Report file length
env:
CODE_FILE_LENGTH_FAIL_ON_EXCEEDED: 'true'
run: scripts/check-file-length.sh