4
4
push :
5
5
branches :
6
6
- main
7
+ - hotfix/*
7
8
- develop
9
+ - release/*
8
10
pull_request :
9
11
branches :
10
12
- main
11
13
- develop
12
14
13
15
jobs :
14
- build-ikvm-jdbc :
15
- name : Build IKVM.Jdbc (Windows)
16
- runs-on : windows-latest
16
+ build :
17
+ name : Build
18
+ runs-on : windows-2022
17
19
steps :
18
20
- name : Checkout Source
19
21
uses : actions/checkout@v3
20
22
with :
21
23
fetch-depth : 0
22
24
submodules : recursive
23
- - name : Install GitVersion
24
- uses :
gittools/actions/gitversion/[email protected]
25
- with :
26
- versionSpec : 5.x
27
- - name : Execute GitVersion
28
- uses :
gittools/actions/gitversion/[email protected]
29
- with :
30
- useConfigFile : true
25
+ - name : Move Temporary Directory
26
+ shell : pwsh
27
+ run : Add-Content $env:GITHUB_ENV "`nTMP=${{ runner.temp }}`nTEMP=${{ runner.temp }}`nTMPDIR=${{ runner.temp }}"
28
+ - name : Setup .NET
29
+ shell : pwsh
30
+ run : Add-Content $env:GITHUB_ENV "`nDOTNET_INSTALL_DIR=${{ runner.temp }}\dotnet"
31
31
- name : Setup .NET 3.1
32
- uses : actions/setup-dotnet@v2
32
+ uses : actions/setup-dotnet@v3
33
33
with :
34
34
dotnet-version : 3.1.x
35
- - name : Setup .NET 5.0
36
- uses : actions/setup-dotnet@v2
37
- with :
38
- dotnet-version : 5.0.x
39
35
- name : Setup .NET 6.0
40
- uses : actions/setup-dotnet@v2
36
+ uses : actions/setup-dotnet@v3
41
37
with :
42
38
dotnet-version : 6.0.x
43
- - name : Setup NuGet
39
+ - name : Setup .NET 7.0
40
+ uses : actions/setup-dotnet@v3
41
+ with :
42
+ dotnet-version : 7.0.x
43
+ - name : Install GitVersion
44
+ uses :
gittools/actions/gitversion/[email protected]
45
+ with :
46
+ versionSpec : 5.x
47
+ - name : Execute GitVersion
48
+ uses :
gittools/actions/gitversion/[email protected]
49
+ with :
50
+ useConfigFile : true
51
+ - name : Move NuGet Directory
44
52
shell : pwsh
45
53
run : Add-Content $env:GITHUB_ENV "`nNUGET_PACKAGES=${{ runner.temp }}\nuget\packages"
46
54
- name : Add NuGet Source (GitHub)
@@ -55,20 +63,11 @@ jobs:
55
63
path : ${{ runner.temp }}\nuget\packages
56
64
key : ${{ runner.os }}-nuget-${{ hashFiles('**\*.csproj', '**\*.msbuildproj') }}-1
57
65
restore-keys : ${{ runner.os }}-nuget-
58
- - name : Add msbuild to PATH
59
-
60
66
- name : NuGet Restore
61
67
run : dotnet restore IKVM.Jdbc.sln
62
- - name : Build Artifacts
68
+ - name : Build
63
69
run : |
64
- msbuild /m:1 `
65
- /p:BuildInParallel=false `
66
- /p:CreateHardLinksForAdditionalFilesIfPossible=true `
67
- /p:CreateHardLinksForCopyAdditionalFilesIfPossible=true `
68
- /p:CreateHardLinksForCopyFilesToOutputDirectoryIfPossible=true `
69
- /p:CreateHardLinksForCopyLocalIfPossible=true `
70
- /p:CreateHardLinksForPublishFilesIfPossible=true `
71
- /p:ContinuousIntegrationBuild=true `
70
+ dotnet msbuild /m /bl `
72
71
/p:Configuration="Release" `
73
72
/p:Platform="Any CPU" `
74
73
/p:Version=${env:GitVersion_FullSemVer} `
@@ -78,107 +77,183 @@ jobs:
78
77
/p:PackageVersion=${env:GitVersion_NuGetVersionV2} `
79
78
/p:RepositoryUrl="${env:GITHUB_SERVER_URL}/${env:GITHUB_REPOSITORY}.git" `
80
79
/p:PackageProjectUrl="${env:GITHUB_SERVER_URL}/${env:GITHUB_REPOSITORY}" `
81
- IKVM.Jdbc.artifacts.msbuildproj
80
+ /p:BuildInParallel=true `
81
+ /p:CreateHardLinksForAdditionalFilesIfPossible=true `
82
+ /p:CreateHardLinksForCopyAdditionalFilesIfPossible=true `
83
+ /p:CreateHardLinksForCopyFilesToOutputDirectoryIfPossible=true `
84
+ /p:CreateHardLinksForCopyLocalIfPossible=true `
85
+ /p:CreateHardLinksForPublishFilesIfPossible=true `
86
+ /p:ContinuousIntegrationBuild=true `
87
+ IKVM.Jdbc.dist.msbuildproj
88
+ - name : Upload MSBuild Log
89
+ if : ${{ always() }}
90
+ uses : actions/upload-artifact@v3
91
+ with :
92
+ name : msbuild.binlog
93
+ path : msbuild.binlog
82
94
- name : Upload NuGet Packages
83
95
uses : actions/upload-artifact@v3
84
96
with :
85
97
name : nuget
86
- path : build /nuget
98
+ path : dist /nuget
87
99
- name : Package Tests
88
100
run : tar czvf tests.tar.gz tests
89
- working-directory : build
101
+ working-directory : dist
90
102
- name : Upload Tests
91
103
uses : actions/upload-artifact@v3
92
104
with :
93
105
name : tests
94
- path : build/tests.tar.gz
95
- test-ikvm-jdbc-windows :
96
- name : Test IKVM.Jdbc (Windows)
106
+ path : dist/tests.tar.gz
107
+ test :
108
+ strategy :
109
+ matrix :
110
+ sys :
111
+ - windows
112
+ - linux
113
+ tfm :
114
+ - net48
115
+ - netcoreapp3.1
116
+ - net6.0
117
+ - net7.0
118
+ exclude :
119
+ - tfm : net48
120
+ sys : linux
121
+ name : Test (${{ matrix.sys }}:${{ matrix.tfm }})
97
122
needs :
98
- - build-ikvm-jdbc
99
- runs-on : windows-latest
123
+ - build
124
+ runs-on : ${{ fromJSON('{" windows":["windows-2022"],"linux":["ubuntu-22.04"]}')[matrix.sys] }}
100
125
steps :
126
+ - name : Set Paths (Windows)
127
+ if : runner.os == 'Windows'
128
+ shell : pwsh
129
+ run : |
130
+ $dir="C:\run"
131
+ mkdir $dir
132
+ mkdir $dir\temp
133
+ mkdir $dir\dotnet
134
+ mkdir $dir\nuget
135
+ mkdir $dir\nuget\packages
136
+ mkdir $dir\job
137
+ Add-Content $env:GITHUB_ENV "`nJOBPATH=$dir\job"
138
+ Add-Content $env:GITHUB_ENV "`nTMP=$dir\temp`nTEMP=$dir\temp`nTMPDIR=$dir\temp"
139
+ Add-Content $env:GITHUB_ENV "`nDOTNET_INSTALL_DIR=$dir\dotnet"
140
+ Add-Content $env:GITHUB_ENV "`nNUGET_PACKAGES=$dir\nuget\packages"
141
+ - name : Set Paths (Linux)
142
+ if : runner.os == 'Linux'
143
+ shell : pwsh
144
+ run : |
145
+ $dir="${{ runner.temp }}/run"
146
+ mkdir $dir
147
+ mkdir $dir/temp
148
+ mkdir $dir/dotnet
149
+ mkdir $dir/nuget
150
+ mkdir $dir/nuget/packages
151
+ mkdir $dir/job
152
+ Add-Content $env:GITHUB_ENV "`nJOBPATH=$dir/job"
153
+ Add-Content $env:GITHUB_ENV "`nTMP=$dir/temp`nTEMP=$dir/temp`nTMPDIR=$dir/temp"
154
+ Add-Content $env:GITHUB_ENV "`nDOTNET_INSTALL_DIR=$dir/dotnet"
155
+ Add-Content $env:GITHUB_ENV "`nNUGET_PACKAGES=$dir/nuget/packages"
101
156
- name : Setup .NET 3.1
102
- uses : actions/setup-dotnet@v2
157
+ uses : actions/setup-dotnet@v3
103
158
with :
104
159
dotnet-version : 3.1.x
105
- - name : Setup .NET 5.0
106
- uses : actions/setup-dotnet@v2
107
- with :
108
- dotnet-version : 5.0.x
109
160
- name : Setup .NET 6.0
110
- uses : actions/setup-dotnet@v2
161
+ uses : actions/setup-dotnet@v3
111
162
with :
112
163
dotnet-version : 6.0.x
164
+ - name : Setup .NET 7.0
165
+ uses : actions/setup-dotnet@v3
166
+ with :
167
+ dotnet-version : 7.0.x
168
+ - name : Add NuGet Source (GitHub)
169
+ shell : pwsh
170
+ run : dotnet nuget add source --username USERNAME --password $env:GITHUB_TOKEN --store-password-in-clear-text --name ikvm $env:GITHUB_REPOS
171
+ env :
172
+ GITHUB_REPOS : https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json
173
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
113
174
- name : Download Tests
114
175
uses : actions/download-artifact@v3
115
176
with :
116
177
name : tests
117
- path : build
178
+ path : ${{ env.JOBPATH }}
118
179
- name : Restore Tests
119
180
run : tar xzvf tests.tar.gz
120
- working-directory : build
181
+ working-directory : ${{ env.JOBPATH }}
121
182
- name : Execute Tests
183
+ timeout-minutes : 480
122
184
shell : pwsh
123
- run : gci .\build\tests\ -Recurse -Filter '*.Tests.dll' | group { $_.Directory.BaseName } | %{ dotnet test $_.Group --blame -v 3 --results-directory .\TestResults --logger "trx;LogFileName=$($_.Name).trx" }
185
+ run : |
186
+ $tfm = "${{ matrix.tfm }}"
187
+ $sys = "${{ matrix.sys }}"
188
+ $tests = $(gci ./tests/*/$tfm -Recurse -Filter '*.Tests.dll')
189
+ if ($tests) {
190
+ Add-Content $env:GITHUB_ENV "`nRET=TestResults--$tfm--$sys"
191
+ dotnet test -f $tfm --blame -v 2 --results-directory "TestResults" --logger:"console;verbosity=detailed" --logger:trx --collect "Code Coverage" $tests
192
+ }
193
+ working-directory : ${{ env.JOBPATH }}
124
194
- name : Upload Test Results
195
+ if : always() && startsWith(env.RET, 'TestResults--')
125
196
uses : actions/upload-artifact@v3
126
197
with :
127
- name : TestResults-windows
128
- path : TestResults
198
+ name : ${{ env.RET }}
199
+ path : ${{ env.JOBPATH }}/ TestResults
129
200
release :
130
201
name : Release
131
- if : github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ main' || github.ref == 'refs/heads/develop'
202
+ if : github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop'
132
203
needs :
133
- - test-ikvm-jdbc-windows
134
- runs-on : ubuntu-latest
204
+ - test
205
+ runs-on : ubuntu-22.04
135
206
steps :
136
207
- name : Checkout Source
137
208
uses : actions/checkout@v3
138
209
with :
139
210
fetch-depth : 0
211
+ - name : Setup .NET 7.0
212
+ uses : actions/setup-dotnet@v3
213
+ with :
214
+ dotnet-version : 7.0.x
140
215
- name : Install GitVersion
141
- uses :
gittools/actions/gitversion/[email protected] .13
216
+ uses :
gittools/actions/gitversion/[email protected] .15
142
217
with :
143
218
versionSpec : 5.x
144
219
- name : Execute GitVersion
145
220
id : GitVersion
146
- uses :
gittools/actions/gitversion/[email protected] .13
221
+ uses :
gittools/actions/gitversion/[email protected] .15
147
222
with :
148
223
useConfigFile : true
149
224
- name : Download NuGet Packages
150
225
uses : actions/download-artifact@v3
151
226
with :
152
227
name : nuget
153
- path : build /nuget
228
+ path : dist /nuget
154
229
- name : Create Release
155
- if : github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ main' || github.event.head_commit.message == '+prerelease '
156
- uses : ncipollo/release-action@v1.10.0
230
+ if : github.ref == 'refs/heads/main' || github.event.head_commit.message == '+push '
231
+ uses : ncipollo/release-action@v1.11.2
157
232
with :
158
233
tag : ${{ steps.GitVersion.outputs.semVer }}
159
- artifacts : build /nuget/*.nupkg,build /nuget/*.snupkg
234
+ artifacts : dist /nuget/*.nupkg,dist /nuget/*.snupkg
160
235
draft : false
161
236
generateReleaseNotes : true
162
237
prerelease : ${{ github.ref == 'refs/heads/develop' }}
163
238
token : ${{ secrets.GITHUB_TOKEN }}
164
239
- name : Push NuGet (GitHub)
165
240
shell : pwsh
166
- run : dotnet nuget push build /nuget/*.nupkg --source $env:GITHUB_REPOS --api-key $env:GITHUB_TOKEN --skip-duplicate
241
+ run : dotnet nuget push dist /nuget/*.nupkg --source $env:GITHUB_REPOS --api-key $env:GITHUB_TOKEN --skip-duplicate
167
242
env :
168
243
GITHUB_REPOS : https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json
169
244
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
170
245
- name : Push NuGet (Azure DevOps)
171
246
shell : pwsh
172
247
run : |
173
248
dotnet nuget add source $env:AZUREDEVOPS_REPOS --name az --username az --password $env:AZUREDEVOPS_TOKEN --store-password-in-clear-text
174
- dotnet nuget push build /nuget/*.nupkg --source az --api-key az --skip-duplicate
249
+ dotnet nuget push dist /nuget/*.nupkg --source az --api-key az --skip-duplicate
175
250
env :
176
251
AZUREDEVOPS_REPOS : https://pkgs.dev.azure.com/ikvm-revived/ikvm/_packaging/ikvm-ci/nuget/v3/index.json
177
252
AZUREDEVOPS_TOKEN : ${{ secrets.AZUREDEVOPS_PAT }}
178
253
- name : Push NuGet
179
- if : github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ main' || github.event.head_commit.message == '+prerelease '
254
+ if : github.ref == 'refs/heads/main' || github.event.head_commit.message == '+push '
180
255
shell : pwsh
181
- run : dotnet nuget push build /nuget/*.nupkg --source $env:NUGET_REPOS --api-key $env:NUGET_TOKEN --skip-duplicate
256
+ run : dotnet nuget push dist /nuget/*.nupkg --source $env:NUGET_REPOS --api-key $env:NUGET_TOKEN --skip-duplicate
182
257
env :
183
258
NUGET_REPOS : https://api.nuget.org/v3/index.json
184
259
NUGET_TOKEN : ${{ secrets.NUGET_TOKEN }}
0 commit comments