-
Notifications
You must be signed in to change notification settings - Fork 0
234 lines (211 loc) · 8.51 KB
/
githubactionsbuilds.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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
name: GitHubActionsBuilds
on: push
jobs:
generate_version_number:
runs-on: ubuntu-latest
outputs:
build_number: ${{ github.ref == 'refs/heads/master' && steps.buildnumber.outputs.build_number || 1 }}
steps:
- name: Generate build number
if: github.ref == 'refs/heads/master'
id: buildnumber
uses: einaregilsson/build-number@v3
with:
token: ${{secrets.github_token}}
windows_runfileoptimizertests_coverage_sonarqube:
needs: generate_version_number
runs-on: windows-2022
steps:
- uses: actions/checkout@v4
- name: Setup .NET Core @ Latest
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '19' # The JDK version to make available on the path.
java-package: jdk # (jre, jdk, or jdk+fx) - defaults to jdk
architecture: x64 # (x64 or x86) - defaults to x64
- name: Install tools
run: |
dotnet tool install --global dotnet-sonarscanner
dotnet tool install --global dotnet-reportgenerator-globaltool
- name: Run download-fileoptimizer2.ps1 script
run: .\Scripts\download-fileoptimizer2.ps1
shell: powershell
- name: dotnet restore
run: dotnet restore DeveImageOptimizer.sln
- name: SonarQube begin
if: github.actor != 'dependabot[bot]'
run: dotnet-sonarscanner begin /k:"DeveImageOptimizer" /o:"devedse-github" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.login=${{secrets.SONARQUBETOKEN}} /d:sonar.cs.opencover.reportsPaths=".\DeveImageOptimizer.Tests\TestResults\Coverage\coverage.opencover.xml" /d:sonar.coverage.exclusions="DeveImageOptimizer.ConsoleApp/**/*.cs,DeveImageOptimizer.Tests/**/*.cs"
- name: dotnet build
run: dotnet build DeveImageOptimizer.sln -c Release --no-restore /p:Version=1.0.${{needs.generate_version_number.outputs.build_number}}
- name: dotnet test and coverage
run: dotnet test DeveImageOptimizer.sln -c Release --filter "CallsFileOptimizer!=True&FailingTest!=True" --no-build --verbosity normal /p:CollectCoverage=true /p:CoverletOutputFormat=\`"cobertura,opencover\`" /p:CoverletOutput=./TestResults/Coverage/
- name: SonarQube end
if: github.actor != 'dependabot[bot]'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: dotnet-sonarscanner end /d:sonar.login=${{secrets.SONARQUBETOKEN}}
- name: Run CodeCov #codecov -f ".\DeveImageOptimizer.Tests\TestResults\Coverage\coverage.opencover.xml"
uses: codecov/codecov-action@v3
with:
#token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
files: .\DeveImageOptimizer.Tests\TestResults\Coverage\coverage.opencover.xml # optional
#flags: unittests # optional
#name: codecov-umbrella # optional
#fail_ci_if_error: true # optional (default = false)
verbose: true # optional (default = false)
intellicode:
needs: generate_version_number
runs-on: windows-2022
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # We need to fetch the entire Git history in order to verify the authenticity.
- name: Setup .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
- name: Build with dotnet
run: dotnet build DeveImageOptimizer.sln -c Release /p:Version=1.0.${{needs.generate_version_number.outputs.build_number}} # Project needs to build before training a model.
- name: Train Intellicode Model
uses: microsoft/vs-intellicode@v1
build_linux:
needs: generate_version_number
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
- name: dotnet restore
run: dotnet restore DeveImageOptimizer.sln
- name: dotnet build
run: dotnet build DeveImageOptimizer.sln -c Release --no-restore /p:Version=1.0.${{needs.generate_version_number.outputs.build_number}}
- name: dotnet test
run: dotnet test DeveImageOptimizer.sln -c Release --no-build --verbosity normal
build_windows:
needs: generate_version_number
runs-on: windows-2022
steps:
- uses: actions/checkout@v4
- name: Setup .NET Core @ Latest
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
- name: dotnet restore
run: dotnet restore DeveImageOptimizer.sln
- name: dotnet build
run: dotnet build DeveImageOptimizer.sln -c Release --no-restore /p:Version=1.0.${{needs.generate_version_number.outputs.build_number}}
- name: dotnet test
run: dotnet test DeveImageOptimizer.sln -c Release --no-build --verbosity normal
- name: Pack
run: dotnet pack DeveImageOptimizer\DeveImageOptimizer.csproj --verbosity normal --no-build -c Release /p:Version=1.0.${{needs.generate_version_number.outputs.build_number}}
- name: Run GoPackage.ps1 script
run: .\Scripts\GoPackage.ps1
shell: powershell
- uses: actions/upload-artifact@v3
with:
name: DeveImageOptimizer7z
path: ./Scripts/Output/DeveImageOptimizer.7z
- uses: actions/upload-artifact@v3
with:
name: DeveImageOptimizerZip
path: ./Scripts/Output/DeveImageOptimizer.zip
- uses: actions/upload-artifact@v3
with:
name: DeveImageOptimizerNuGet
path: |
./DeveImageOptimizer/bin/Release/*.nupkg
./DeveImageOptimizer/bin/Release/*.snupkg
release_github:
needs: [generate_version_number, intellicode, build_windows, build_linux]
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
steps:
- name: Download all artifacts
uses: actions/download-artifact@v3
with:
path: ./artifacts/
- name: Display structure of downloaded files
run: |
cd ./artifacts/
ls -R
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: 1.0.${{needs.generate_version_number.outputs.build_number}}
release_name: 1.0.${{needs.generate_version_number.outputs.build_number}}
body: |
${{ github.event.head_commit.message }}
draft: false
prerelease: false
- name: Release
uses: softprops/action-gh-release@v1
with:
tag_name: 1.0.${{needs.generate_version_number.outputs.build_number}}
files: |
./artifacts/DeveImageOptimizer7z/DeveImageOptimizer.7z
./artifacts/DeveImageOptimizerZip/DeveImageOptimizer.zip
./artifacts/DeveImageOptimizerNuGet/*.nupkg
./artifacts/DeveImageOptimizerNuGet/*.snupkg
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
release_nuget:
needs: [generate_version_number, intellicode, build_windows, build_linux, release_github]
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
steps:
- name: Download all artifacts
uses: actions/download-artifact@v3
with:
name: DeveImageOptimizerNuGet
path: ./artifacts/DeveImageOptimizerNuGet/
- name: Push NuGet
run: dotnet nuget push ./artifacts/DeveImageOptimizerNuGet/DeveImageOptimizer.1.0.${{needs.generate_version_number.outputs.build_number}}.nupkg -k ${{ secrets.NUGETTOKEN }} -s https://api.nuget.org/v3/index.json
codeqlanalyze:
runs-on: windows-latest
needs: generate_version_number
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'csharp', 'javascript' ]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
- name: Run tree
run: tree /A
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
- name: Autobuild
uses: github/codeql-action/autobuild@v2
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
output: './artifacts'
- name: Run tree2
run: |
tree /A
cd
- uses: actions/upload-artifact@v3
with:
name: CodeQLAnalysis_${{ matrix.language }}
path: ./artifacts/${{ matrix.language }}.zip