Skip to content

Commit b34c1ef

Browse files
committed
Clean up github actions and remove net5.0
1 parent 1ce2d67 commit b34c1ef

File tree

7 files changed

+251
-111
lines changed

7 files changed

+251
-111
lines changed

.github/workflows/IKVM.Jdbc.yml

+136-61
Original file line numberDiff line numberDiff line change
@@ -4,43 +4,51 @@ on:
44
push:
55
branches:
66
- main
7+
- hotfix/*
78
- develop
9+
- release/*
810
pull_request:
911
branches:
1012
- main
1113
- develop
1214

1315
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
1719
steps:
1820
- name: Checkout Source
1921
uses: actions/checkout@v3
2022
with:
2123
fetch-depth: 0
2224
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"
3131
- name: Setup .NET 3.1
32-
uses: actions/setup-dotnet@v2
32+
uses: actions/setup-dotnet@v3
3333
with:
3434
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
3935
- name: Setup .NET 6.0
40-
uses: actions/setup-dotnet@v2
36+
uses: actions/setup-dotnet@v3
4137
with:
4238
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
4452
shell: pwsh
4553
run: Add-Content $env:GITHUB_ENV "`nNUGET_PACKAGES=${{ runner.temp }}\nuget\packages"
4654
- name: Add NuGet Source (GitHub)
@@ -55,20 +63,11 @@ jobs:
5563
path: ${{ runner.temp }}\nuget\packages
5664
key: ${{ runner.os }}-nuget-${{ hashFiles('**\*.csproj', '**\*.msbuildproj') }}-1
5765
restore-keys: ${{ runner.os }}-nuget-
58-
- name: Add msbuild to PATH
59-
uses: microsoft/[email protected]
6066
- name: NuGet Restore
6167
run: dotnet restore IKVM.Jdbc.sln
62-
- name: Build Artifacts
68+
- name: Build
6369
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 `
7271
/p:Configuration="Release" `
7372
/p:Platform="Any CPU" `
7473
/p:Version=${env:GitVersion_FullSemVer} `
@@ -78,107 +77,183 @@ jobs:
7877
/p:PackageVersion=${env:GitVersion_NuGetVersionV2} `
7978
/p:RepositoryUrl="${env:GITHUB_SERVER_URL}/${env:GITHUB_REPOSITORY}.git" `
8079
/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
8294
- name: Upload NuGet Packages
8395
uses: actions/upload-artifact@v3
8496
with:
8597
name: nuget
86-
path: build/nuget
98+
path: dist/nuget
8799
- name: Package Tests
88100
run: tar czvf tests.tar.gz tests
89-
working-directory: build
101+
working-directory: dist
90102
- name: Upload Tests
91103
uses: actions/upload-artifact@v3
92104
with:
93105
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 }})
97122
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] }}
100125
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"
101156
- name: Setup .NET 3.1
102-
uses: actions/setup-dotnet@v2
157+
uses: actions/setup-dotnet@v3
103158
with:
104159
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
109160
- name: Setup .NET 6.0
110-
uses: actions/setup-dotnet@v2
161+
uses: actions/setup-dotnet@v3
111162
with:
112163
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 }}
113174
- name: Download Tests
114175
uses: actions/download-artifact@v3
115176
with:
116177
name: tests
117-
path: build
178+
path: ${{ env.JOBPATH }}
118179
- name: Restore Tests
119180
run: tar xzvf tests.tar.gz
120-
working-directory: build
181+
working-directory: ${{ env.JOBPATH }}
121182
- name: Execute Tests
183+
timeout-minutes: 480
122184
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 }}
124194
- name: Upload Test Results
195+
if: always() && startsWith(env.RET, 'TestResults--')
125196
uses: actions/upload-artifact@v3
126197
with:
127-
name: TestResults-windows
128-
path: TestResults
198+
name: ${{ env.RET }}
199+
path: ${{ env.JOBPATH }}/TestResults
129200
release:
130201
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'
132203
needs:
133-
- test-ikvm-jdbc-windows
134-
runs-on: ubuntu-latest
204+
- test
205+
runs-on: ubuntu-22.04
135206
steps:
136207
- name: Checkout Source
137208
uses: actions/checkout@v3
138209
with:
139210
fetch-depth: 0
211+
- name: Setup .NET 7.0
212+
uses: actions/setup-dotnet@v3
213+
with:
214+
dotnet-version: 7.0.x
140215
- name: Install GitVersion
141-
uses: gittools/actions/gitversion/[email protected].13
216+
uses: gittools/actions/gitversion/[email protected].15
142217
with:
143218
versionSpec: 5.x
144219
- name: Execute GitVersion
145220
id: GitVersion
146-
uses: gittools/actions/gitversion/[email protected].13
221+
uses: gittools/actions/gitversion/[email protected].15
147222
with:
148223
useConfigFile: true
149224
- name: Download NuGet Packages
150225
uses: actions/download-artifact@v3
151226
with:
152227
name: nuget
153-
path: build/nuget
228+
path: dist/nuget
154229
- 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
157232
with:
158233
tag: ${{ steps.GitVersion.outputs.semVer }}
159-
artifacts: build/nuget/*.nupkg,build/nuget/*.snupkg
234+
artifacts: dist/nuget/*.nupkg,dist/nuget/*.snupkg
160235
draft: false
161236
generateReleaseNotes: true
162237
prerelease: ${{ github.ref == 'refs/heads/develop' }}
163238
token: ${{ secrets.GITHUB_TOKEN }}
164239
- name: Push NuGet (GitHub)
165240
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
167242
env:
168243
GITHUB_REPOS: https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json
169244
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
170245
- name: Push NuGet (Azure DevOps)
171246
shell: pwsh
172247
run: |
173248
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
175250
env:
176251
AZUREDEVOPS_REPOS: https://pkgs.dev.azure.com/ikvm-revived/ikvm/_packaging/ikvm-ci/nuget/v3/index.json
177252
AZUREDEVOPS_TOKEN: ${{ secrets.AZUREDEVOPS_PAT }}
178253
- 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'
180255
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
182257
env:
183258
NUGET_REPOS: https://api.nuget.org/v3/index.json
184259
NUGET_TOKEN: ${{ secrets.NUGET_TOKEN }}

IKVM.Jdbc.artifacts.msbuildproj

-49
This file was deleted.

IKVM.Jdbc.dist.msbuildproj

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<Project DefaultTargets="Publish">
2+
<PropertyGroup>
3+
<DistDir Condition="'$(DistDir)' == ''">$(DISTDIR)</DistDir>
4+
<DistDir Condition="'$(DistDir)' == ''">$([System.IO.Path]::Combine('$(MSBuildThisFileDirectory)', 'dist'))</DistDir>
5+
<DistDir>$([System.IO.Path]::GetFullPath('$(DistDir)'))</DistDir>
6+
<SolutionFile>$([System.IO.Path]::Combine('$(MSBuildThisFileDirectory)', 'IKVM.Jdbc.sln'))</SolutionFile>
7+
<Configuration Condition=" '$(Configuration)' == '' ">Release</Configuration>
8+
<Platform Condition=" '$(Platform)' == '' ">Any CPU</Platform>
9+
</PropertyGroup>
10+
11+
<ItemGroup>
12+
<TargetsForPublish Include="$(SolutionFile)">
13+
<Targets>dist%5Cdist-nuget:Publish</Targets>
14+
<Properties>PublishDir=$(DistDir)\nuget</Properties>
15+
</TargetsForPublish>
16+
<TargetsForPublish Include="$(SolutionFile)">
17+
<Targets>dist%5Cdist-tests:Publish</Targets>
18+
<Properties>PublishDir=$(DistDir)\tests</Properties>
19+
</TargetsForPublish>
20+
</ItemGroup>
21+
22+
<Target Name="Publish">
23+
<ItemGroup>
24+
<_TargetsForPublish Include="@(TargetsForPublish)">
25+
<Properties>%(TargetsForPublish.Properties)</Properties>
26+
</_TargetsForPublish>
27+
</ItemGroup>
28+
29+
<MSBuild BuildInParallel="$(BuildInParallel)" ContinueOnError="false" Projects="@(_TargetsForPublish)" Targets="%(_TargetsForPublish.Targets)" />
30+
</Target>
31+
32+
</Project>

0 commit comments

Comments
 (0)