-
Notifications
You must be signed in to change notification settings - Fork 3
155 lines (146 loc) · 7.57 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
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}}
intellicode:
needs: generate_version_number
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
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 DeveImageOptimizerWPF.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_windows:
needs: generate_version_number
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- 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: Install dependencies
run: dotnet restore DeveImageOptimizerWPF.sln
- name: SonarQube begin
if: github.actor != 'dependabot[bot]'
run: dotnet-sonarscanner begin /k:"DeveImageOptimizerWPF" /o:"devedse-github" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.login=${{secrets.SONARQUBETOKEN}} /d:sonar.cs.opencover.reportsPaths=".\DeveImageOptimizerWPF.Tests\TestResults\Coverage\coverage.opencover.xml" /d:sonar.coverage.exclusions="DeveImageOptimizerWPF.Tests/**/*.cs"
- name: Build
run: dotnet build DeveImageOptimizerWPF.sln -c Release --no-restore /p:Version=1.0.${{needs.generate_version_number.outputs.build_number}}
- name: Test
run: dotnet test DeveImageOptimizerWPF.sln --verbosity normal --no-build -c Release /p:CollectCoverage=true /p:CoverletOutputFormat=\`"cobertura,opencover\`" /p:CoverletOutput=./TestResults/Coverage/
- name: SonarQube end
if: github.actor != 'dependabot[bot]'
run: dotnet-sonarscanner end /d:sonar.login=${{secrets.SONARQUBETOKEN}}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish
run: dotnet publish .\DeveImageOptimizerWPF\DeveImageOptimizerWPF.csproj -r win-x64 -c Release /p:PublishSingleFile=true /p:SelfContained=true /p:IncludeNativeLibrariesForSelfExtract=true /p:PublishTrimmed=true /p:TrimMode=partial /p:Version=1.0.${{needs.generate_version_number.outputs.build_number}}
- name: Publish (Without Trim)
run: dotnet publish .\DeveImageOptimizerWPF\DeveImageOptimizerWPF.csproj -r win-x64 -c Release -o "DeveImageOptimizerWPF\bin\Release\net7.0-windows\win-x64\publishuntrimmed\" /p:PublishSingleFile=true /p:SelfContained=true /p:IncludeNativeLibrariesForSelfExtract=true /p:Version=1.0.${{needs.generate_version_number.outputs.build_number}}
- name: Publish
run: dotnet publish .\DeveImageOptimizerWPF\DeveImageOptimizerWPF.csproj -r win-x64 -c Release -o "DeveImageOptimizerWPF\bin\Release\net7.0-windows\win-x64\publishtrimmedlink\" /p:PublishSingleFile=true /p:SelfContained=true /p:IncludeNativeLibrariesForSelfExtract=true /p:PublishTrimmed=true /p:TrimMode=Link /p:Version=1.0.${{needs.generate_version_number.outputs.build_number}}
- name: Publish
run: dotnet publish .\DeveImageOptimizerWPF\DeveImageOptimizerWPF.csproj -r win-x64 -c Release -o "DeveImageOptimizerWPF\bin\Release\net7.0-windows\win-x64\publishtrimmedcopyused\" /p:PublishSingleFile=true /p:SelfContained=true /p:IncludeNativeLibrariesForSelfExtract=true /p:PublishTrimmed=true /p:TrimMode=CopyUsed /p:Version=1.0.${{needs.generate_version_number.outputs.build_number}}
# - 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 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: .\DeveImageOptimizerWPF.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)
- uses: actions/upload-artifact@v3
with:
name: DeveImageOptimizerWPF_win-x64
path: DeveImageOptimizerWPF\bin\Release\net7.0-windows\win-x64\publish\DeveImageOptimizerWPF.exe
- uses: actions/upload-artifact@v3
with:
name: DeveImageOptimizerWPF_win-x64_untrimmed
path: DeveImageOptimizerWPF\bin\Release\net7.0-windows\win-x64\publishuntrimmed\DeveImageOptimizerWPF.exe
- uses: actions/upload-artifact@v3
with:
name: DeveImageOptimizerWPF_win-x64_trimlink
path: DeveImageOptimizerWPF\bin\Release\net7.0-windows\win-x64\publishtrimmedlink\DeveImageOptimizerWPF.exe
- uses: actions/upload-artifact@v3
with:
name: DeveImageOptimizerWPF_win-x64_trimcopyused
path: DeveImageOptimizerWPF\bin\Release\net7.0-windows\win-x64\publishtrimmedcopyused\DeveImageOptimizerWPF.exe
release_github:
needs: [generate_version_number, intellicode, build_windows]
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/DeveImageOptimizerWPF_win-x64/DeveImageOptimizerWPF.exe
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
release_chocolatey:
needs: [intellicode, build_windows, release_github]
runs-on: windows-latest
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v2
- name: Download all artifacts
uses: actions/download-artifact@v3
with:
path: ./artifacts/
- name: Run CreatePackage.ps1 script
run: .\CreateChocoPackage\CreatePackage.ps1
shell: powershell
- name: Run PushPackage.ps1 script
run: .\CreateChocoPackage\PushPackage.ps1 -chocolateykey ${{secrets.CHOCOLATEYTOKEN}}
shell: powershell