-
Notifications
You must be signed in to change notification settings - Fork 2
207 lines (182 loc) · 5.84 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
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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
name: "🔄 CI"
on:
push:
tags: ["v[1-9]+.[0-9]+.[0-9]"]
pull_request:
branches: ["main"]
types: ["opened", "synchronize", "reopened"]
jobs:
build:
name: 🔨 Build
runs-on: ubuntu-latest
steps:
- name: 📥 Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
with:
fetch-depth: 0
- name: 🔧 Use .NET 8.0 SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: 🔙 Get Previous Version
id: previoustag
uses: WyriHaximus/github-action-get-previous-tag@v1
- name: 🔨 Build
run: >
dotnet build ./Tethos.sln
--configuration Release
-p:Version=$(echo ${{ steps.previoustag.outputs.tag }} | tr -d 'v')
- name: 🔦 Lint
run: dotnet format --verify-no-changes --no-restore
- name: 📚 Artifact NuGet
uses: actions/upload-artifact@v4
if: success()
with:
name: nuget-packages
path: |
src/**/Tethos*.nupkg
src/**/Tethos*.snupkg
test:
name: 🔬 Test
runs-on: ubuntu-latest
steps:
- name: 📥 Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- name: 🔧 Use .NET 8.0 SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: 🔬 Test
run: >
dotnet test ./Tethos.sln
--configuration Release
--filter FullyQualifiedName\!~Tethos.PerformanceTests
/p:CollectCoverage=true
/p:CoverletOutputFormat=opencover
--logger trx
--results-directory ./coverage
- name: 🔍 Coverage
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
- name: 📚 Artifact Test Results
uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: test-results
path: |
coverage/*.trx
- name: 📚 Artifact Test Coverage
uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: test-coverage
path: |
**/coverage.opencover.xml
sonar:
needs: test
name: 📡 SonarCloud
runs-on: ubuntu-latest
if: ${{ github.actor != 'dependabot[bot]' }}
steps:
- name: 📥 Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
with:
fetch-depth: 0
- name: 🔖 Fetch test result artifact
uses: actions/download-artifact@v4
with:
name: test-results
path: results
- name: 🔖 Fetch test coverage artifact
uses: actions/download-artifact@v4
with:
name: test-coverage
path: coverage
- name: 🔧 Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: "zulu"
java-version: 17
- name: 🔧 Use .NET 8.0 SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: 🔦 Install SonarScanner
run: dotnet tool install dotnet-sonarscanner --version 5.* --global
- name: 🔽 Start SonarCloud scan
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: >
dotnet sonarscanner begin
/o:"${{ secrets.SONAR_ORGANIZATION }}"
/k:"${{ secrets.SONAR_PROJECT_KEY }}"
/d:sonar.login="${{ secrets.SONAR_TOKEN }}"
/d:sonar.host.url="${{ secrets.SONAR_URL }}"
/d:sonar.cs.opencover.reportsPaths="**/coverage.opencover.xml"
/d:sonar.cs.vstest.reportsPaths="results/*.trx"
/d:sonar.coverage.exclusions="test/**, demo/**"
- name: 🔨 Build
run: >
dotnet build ./Tethos.sln
--configuration Release
- name: 🔼 End SonarCloud scan
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: >
dotnet sonarscanner end
/d:sonar.login="${{ secrets.SONAR_TOKEN }}"
spellcheck:
name: 🔦 Spellcheck
permissions:
contents: read
pull-requests: read
actions: read
outputs:
followup: ${{ steps.spelling.outputs.followup }}
runs-on: ubuntu-latest
steps:
- name: ✅ Check spelling
id: spelling
uses: check-spelling/[email protected]
with:
checkout: true
post_comment: 0
dictionary_source_prefixes: >
{
"cspell": "https://raw.githubusercontent.com/check-spelling/cspell-dicts/v20220816/dictionaries/",
"cspell_old": "https://raw.githubusercontent.com/check-spelling/cspell-dicts/v20220427/dictionaries/"
}
extra_dictionaries: cspell:csharp/csharp.txt
cspell:dotnet/dotnet.txt
cspell:filetypes/filetypes.txt
cspell:fullstack/fullstack.txt
cspell:html/html.txt
cspell_old:companies/companies.txt
cspell_old:software-terms/softwareTerms.txt
check_extra_dictionaries: ""
spellcheck-comment:
name: 💬 Spellcheck
runs-on: ubuntu-latest
needs: spellcheck
permissions:
contents: write
pull-requests: write
if: (success() || failure()) && needs.spellcheck.outputs.followup
steps:
- name: 💬 Report
uses: check-spelling/[email protected]
with:
checkout: true
task: ${{ needs.spellcheck.outputs.followup }}
lint-yml:
name: 🐞 YML
runs-on: ubuntu-latest
steps:
- name: 📥 Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- name: ✅ Check YML
uses: ibiqlik/action-yamllint@v3