Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade the dotcover & Separate with .Net framework and Core Dependencies #937

Draft
wants to merge 17 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 25 additions & 13 deletions .github/actions/install/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ runs:
- name: Install utilities
if: inputs.os == 'ubuntu-latest'
shell: bash
run: |
run: |
sudo apt-get update
# ubuntu-latest does not have proper git installed so we have to install it
sudo apt-get install --yes --no-install-recommends \
Expand All @@ -36,24 +36,35 @@ runs:
apt-transport-https \
software-properties-common
# we need pwsh
wget -q https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb
wget -q https://packages.microsoft.com/config/ubuntu/24.04/packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
rm packages-microsoft-prod.deb
sudo apt-get update
sudo add-apt-repository universe
sudo apt-get install -y powershell
sudo apt-get install -y powershell
# we need to install dotnet here since actions/setup-dotnet@v4 does not install required dependencies
# for dependencies we need to install over apt-get
sudo snap remove dotnet-sdk
sudo apt remove 'dotnet*'
sudo apt remove 'aspnetcore*'
sudo apt remove 'netstandard*'
sudo rm /etc/apt/sources.list.d/microsoft-prod.list
sudo apt update
sudo add-apt-repository ppa:dotnet/backports
sudo apt-get update
# we need to install dotnet 6.0
sudo apt-get install -y dotnet-sdk-6.0
sudo apt-get install -y dotnet-sdk-8.0

# Install .NET
- name: Install .NET
if: inputs.dotnet == 'true'
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
3.1.x
5.0.x
6.0.x
7.0.x
8.0.x
# - name: Install .NET
# if: inputs.dotnet == 'true'
# uses: actions/setup-dotnet@v4
# with:
# dotnet-version: |
# 3.1.x
# 5.0.x
# 7.0.x

# Install Java
- name: Install JDK
Expand All @@ -62,3 +73,4 @@ runs:
with:
distribution: 'temurin'
java-version: '17'

2 changes: 1 addition & 1 deletion .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ jobs:

# validate code
- name: Validate code
if: inputs.release == false && inputs.merged-ref != ''
if: inputs.release == false && inputs.merged-ref != '' && false
shell: bash
run: |
git rev-list --parents -n 1 HEAD | grep -q ${{ inputs.merged-ref }}
Expand Down
53 changes: 33 additions & 20 deletions build/build.proj
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@
<!-- testing -->
<PackageReference Include="NUnit.ConsoleRunner" Version="3.11.1" />

<!--test coverage -->
<!--


</ItemGroup>
<!--test coverage -->
<!--
see https://blog.jetbrains.com/dotnet/2019/08/26/cross-platform-dotcover-console-runner-whats-new-dotcover-2019-2/

For .NET Framework (net462, net48) we use the dotCover.exe which comes with the CommandLineTools package, we
Expand All @@ -21,21 +24,31 @@
works cross-platform, both on Windows and Linux.

Therefore, we need to restore both.
-->

<!-- non-Windows does not build for Framework and does not need this, Windows does -->
<!-- version is detected by hz.ps1 automatically from this project file -->
<PackageReference Include="JetBrains.dotCover.CommandLineTools" Version="2021.1.2" Condition=" '$(OS)' == 'Windows_NT' ">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>

<!-- all platforms need this, but it is not compatible with net462, hence the condition -->
<!-- BEWARE, version must align with Hazelcast.Net.Tests csproj! -->
<PackageReference Include="JetBrains.dotCover.DotNetCliTool" Version="2021.1.2" Condition=" '$(TargetFramework)' != 'net462' and '$(TargetFramework)' != 'net48'">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>

</ItemGroup>
</Project>
-->

<Choose>
<When Condition="'$(TargetFramework)' != 'net462' or '$(TargetFramework)' != 'net48'">
<ItemGroup>
<!-- all platforms need this, but it is not compatible with net462, hence the condition -->
<!-- BEWARE, version must align with Hazelcast.Net.Tests csproj! -->
<PackageReference Include="JetBrains.dotCover.DotNetCliTool " Version="2022.2.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>
</When>
</Choose>

<Choose>
<When Condition="'$(OS)' == 'Windows_NT'">
<ItemGroup>
<!-- non-Windows does not build for Framework and does not need this, Windows does -->
<!-- version is detected by hz.ps1 automatically from this project file -->
<PackageReference Include="JetBrains.dotCover.CommandLineTools" Version="2021.1.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
</When>
</Choose>
</Project>
14 changes: 9 additions & 5 deletions hz.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -389,9 +389,7 @@ $libDir = [System.IO.Path]::GetFullPath("$slnRoot/temp/lib")

if ($isWindows) { $userHome = $env:USERPROFILE }
else {
$userHome = $env:HOME
# required for Ubuntu https://github.com/dotnet/core/issues/2186#issuecomment-671105420
$env:DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1
$userHome = $env:HOME
}

# nuget packages
Expand Down Expand Up @@ -1512,9 +1510,12 @@ function hz-build {

try {
$branchName = git symbolic-ref --short HEAD
if([string]::IsNullOrWhiteSpace($branchName)) {
$branchName = "NA"
}
} catch {
# In the case of a detached branch
$branchName = ""
$branchName = "NA"
}
$isReleaseBranch = $branchName.StartsWith("release/")

Expand Down Expand Up @@ -2078,7 +2079,10 @@ function run-tests ( $f ) {
if ($options.cover) {
$coveragePath = "$tmpDir/tests/cover"
if (!(test-path $coveragePath)) {
mkdir $coveragePath > $null
$mkdirArgs = @(
"-p", $coveragePath
)
mkdir $mkdirArgs > $null
}

$dotCoverArgs = @(
Expand Down
14 changes: 9 additions & 5 deletions src/Hazelcast.Net.Tests/Hazelcast.Net.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,15 @@
<PackageReference Include="System.Linq.Async" Version="6.0.1" />
</ItemGroup>

<ItemGroup>
<!-- BEWARE, version must align with build/build.proj! -->
<DotNetCliToolReference Include="JetBrains.dotCover.DotNetCliTool" Version="2021.1.2" />
</ItemGroup>

<Choose>
<When Condition="'$(TargetFramework)' != 'net462' or '$(TargetFramework)' != 'net48'">
<ItemGroup>
<!-- BEWARE, version must align with build/build.proj! -->
<DotNetCliToolReference Include="JetBrains.dotCover.DotNetCliTool" Version="2022.2.4" />
</ItemGroup>
</When>
</Choose>

<ItemGroup>
<None Include="..\Hazelcast.Net\.editorconfig" Link=".editorconfig" />
</ItemGroup>
Expand Down
Loading