Skip to content

Commit

Permalink
Many updates fixing test execution (#574)
Browse files Browse the repository at this point in the history
* #573 (comment): fix license set-up

* Try to get logs from operating system after an error

* Log only failing OSes

* Update logging for MacOS 13

* Centralized environment variables and steps

* #518 (comment): setup heap params and verify if this change solves SIGFPE

* Test execution of java with a simple program to verify activation

* Try to compile and execute a native method to start a JVM

* Adding more steps in test function

* Avoid useless chaining

* Fix variable initialization

* Use procdump to get windows application crashes

* #573 (comment): disabled CETCompat on .NET 9 applications

* #573 (comment): test disabling at library level

* #573 (comment): moved CETCompat in the Common.props file

* #518 (comment): removed MacOS 13

* Update templates

* Remove many warning

* Try test activation using dotnet app host

* #573 (comment): apply workaround and make executable CET compatible

* Fix double registration under windows
  • Loading branch information
masesdevelopers authored Dec 18, 2024
1 parent 424871d commit eaa1c4d
Show file tree
Hide file tree
Showing 10 changed files with 275 additions and 72 deletions.
155 changes: 130 additions & 25 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,40 @@ concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: true

# This workflow contains two jobs called "check_changes", "build_windows"
# This workflow contains multiple jobs
jobs:
## Now run "build_macos_native"
#build_macos_native:
# runs-on: macos-13
# # Steps represent a sequence of tasks that will be executed as part of the job
# steps:
# # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
# - uses: actions/checkout@v4
# with:
# fetch-depth: '1'
# submodules: 'true'
#
# - name: Compile CreateVM
# run: |
# cd ${{ github.workspace }}/tests/native
# g++ -I $JAVA_HOME/include -I $JAVA_HOME/include/darwin -L $JAVA_HOME/lib/server -ljvm CreateVM.cpp -o CreateVM.out
#
# - name: Export location
# shell: bash
# run: echo "DYLD_LIBRARY_PATH=$(echo $JAVA_HOME/lib/server)" >> $GITHUB_ENV
#
# - name: Execute CreateVM
# shell: bash
# run: |
# export
# echo "GITHUB_ENV_LD_LIBRARY_PATH=$(echo $JAVA_HOME/lib/server)" >> $GITHUB_ENV
# export DYLD_LIBRARY_PATH=/Users/runner/hostedtoolcache/Java_Temurin-Hotspot_jdk/17.0.13-11/x64/Contents/Home/lib/server
# export
# ${{ github.workspace }}/tests/native/CreateVM.out

# Verify if a build is needed
check_changes:
#needs: build_macos_native
name: Check changed files
outputs:
run_build_windows: ${{ steps.check_files.outputs.run_build_windows }}
Expand Down Expand Up @@ -149,7 +179,7 @@ jobs:
subject-name: ghcr.io/${{ github.repository_owner }}/jnet
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true

# Now run "build_windows"
build_windows:
needs: check_changes
Expand Down Expand Up @@ -231,6 +261,7 @@ jobs:

- uses: actions/upload-artifact@v4
with:
if-no-files-found: ignore
name: JNetNuGet
path: .\bin\*nupkg

Expand Down Expand Up @@ -259,6 +290,7 @@ jobs:

- uses: actions/upload-artifact@v4
with:
if-no-files-found: ignore
name: JNetBin
path: .\bin\

Expand All @@ -267,7 +299,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ 'ubuntu-latest', 'windows-latest', 'macos-latest', 'macos-13' ]
os: [ 'ubuntu-latest', 'windows-latest', 'macos-latest' ] # , 'macos-13' ] disable due to https://github.com/masesgroup/JNet/issues/518#issuecomment-2547271924
framework: [ 'net462', 'net8.0', 'net9.0' ]
jdk_vendor: [ 'temurin', 'zulu', 'microsoft', 'corretto', 'oracle']
jdk_version: [ '11', '17', '21' ] # only LTS versions
Expand All @@ -283,6 +315,12 @@ jobs:

runs-on: ${{ matrix.os }}
env:
DOTNET_DbgEnableMiniDump: 1
DOTNET_DbgMiniDumpType: 3
DOTNET_DbgMiniDumpName: ${{ github.workspace }}/coredump.%p
DOTNET_CreateDumpDiagnostics: 1
DOTNET_CreateDumpVerboseDiagnostics: 1
DOTNET_EnableCrashReport: 1
JCOBRIDGE_LicensePath: ${{ secrets.JCOBRIDGE_ENCODED_2_5_19 }}

steps:
Expand All @@ -301,29 +339,58 @@ jobs:
6.x
9.x
- name: Download Procdump and prepare
if: ${{ matrix.os == 'windows-latest' }} # see https://gist.github.com/Sedeniono/e6d6504e3bf0645937852ee5681ef9ee and https://learn.microsoft.com/it-it/sysinternals/downloads/procdump
continue-on-error: true
run: |
C:\msys64\usr\bin\wget.exe https://download.sysinternals.com/files/Procdump.zip
Expand-Archive -LiteralPath '${{ github.workspace }}\Procdump.zip' -DestinationPath ${{ github.workspace }}\Procdump -Force
dir .\Procdump
${{ github.workspace }}\Procdump\procdump.exe -accepteula
mkdir CrashDumpsDir
${{ github.workspace }}\Procdump\procdump.exe -ma -i ${{ github.workspace }}\CrashDumpsDir
- name: Set up JDK distribution
uses: actions/setup-java@v4
with: # running setup-java again overwrites the settings.xml
distribution: ${{ matrix.jdk_vendor }}
java-version: ${{ matrix.jdk_version }}

- name: Execute tests on ${{ matrix.os }} with ${{ matrix.jdk_vendor }} ${{ matrix.jdk_version }}
if: ${{ matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' || matrix.os == 'macos-13' }}
- if: ${{ matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' || matrix.os == 'macos-13' || (matrix.os == 'windows-latest' && matrix.framework != 'net462') }} # for windows see https://github.com/masesgroup/JNet/issues/573#issuecomment-2550033900
continue-on-error: true
run: |
dotnet ./bin/${{ matrix.framework }}/JNetTest.dll
dotnet ./bin/${{ matrix.framework }}/JNetByteBufferTest.dll
- name: WINDOWS ONLY - Execute tests on ${{ matrix.os }} with ${{ matrix.jdk_vendor }} ${{ matrix.jdk_version }}
if: ${{ matrix.os == 'windows-latest' }}
- if: ${{ matrix.os == 'windows-latest' && matrix.framework == 'net462' }}
continue-on-error: true
run: |
.\bin\${{ matrix.framework }}\JNetTest.exe
.\bin\${{ matrix.framework }}\JNetByteBufferTest.exe
- if: ${{ matrix.os == 'windows-latest' && matrix.framework == 'net9.0' }}
run: (Get-EventLog -LogName Application -Newest 5).Message

- uses: actions/upload-artifact@v4
if: failure()
if: ${{ matrix.os == 'windows-latest' }}
with:
if-no-files-found: ignore
name: Crash_tests_${{ matrix.os }}_${{ matrix.framework }}_${{ matrix.jdk_vendor }}_${{ matrix.jdk_version }}
path: .\CrashDumpsDir\*
retention-days: 7

- uses: actions/upload-artifact@v4
if: ${{ matrix.os != 'windows-latest' }}
with:
if-no-files-found: ignore
name: Crash_tests_${{ matrix.os }}_${{ matrix.framework }}_${{ matrix.jdk_vendor }}_${{ matrix.jdk_version }}
path: ${{ github.workspace }}/coredump.*
retention-days: 7

- uses: actions/upload-artifact@v4
with:
if-no-files-found: ignore
name: Crash_tests_hs_err__${{ matrix.os }}_${{ matrix.framework }}_${{ matrix.jdk_vendor }}_${{ matrix.jdk_version }}
path: ${{ github.workspace }}/**/hs_err_*
retention-days: 7

Expand All @@ -332,21 +399,42 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ 'ubuntu-latest', 'windows-latest', 'macos-latest', 'macos-13' ]
os: [ 'ubuntu-latest', 'windows-latest', 'macos-latest' ] # , 'macos-13' ] disable due to https://github.com/masesgroup/JNet/issues/518#issuecomment-2547271924
jdk_vendor: [ 'temurin', 'zulu', 'microsoft', 'corretto', 'oracle']
jdk_version: [ '11', '17', '21' ] # only LTS versions
exclude:
- jdk_vendor: oracle
jdk_version: 11

runs-on: ${{ matrix.os }}
env:
DOTNET_CLI_UI_LANGUAGE: en_US
DOTNET_DbgEnableMiniDump: 1
DOTNET_DbgMiniDumpType: 3
DOTNET_DbgMiniDumpName: ${{ github.workspace }}/coredump.%p
DOTNET_CreateDumpDiagnostics: 1
DOTNET_CreateDumpVerboseDiagnostics: 1
DOTNET_EnableCrashReport: 1
JCOBRIDGE_LicensePath: ${{ secrets.JCOBRIDGE_ENCODED_2_5_19 }}

steps:
- uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.x
9.x
- name: Download Procdump and prepare
if: ${{ matrix.os == 'windows-latest' }} # see https://gist.github.com/Sedeniono/e6d6504e3bf0645937852ee5681ef9ee and https://learn.microsoft.com/it-it/sysinternals/downloads/procdump
continue-on-error: true
run: |
C:\msys64\usr\bin\wget.exe https://download.sysinternals.com/files/Procdump.zip
Expand-Archive -LiteralPath '${{ github.workspace }}\Procdump.zip' -DestinationPath ${{ github.workspace }}\Procdump -Force
dir .\Procdump
${{ github.workspace }}\Procdump\procdump.exe -accepteula
mkdir CrashDumpsDir
${{ github.workspace }}\Procdump\procdump.exe -ma -i ${{ github.workspace }}\CrashDumpsDir
- name: Restore JNet bin from cache
uses: actions/cache/restore@v4
with:
Expand All @@ -361,36 +449,53 @@ jobs:
distribution: ${{ matrix.jdk_vendor }}
java-version: ${{ matrix.jdk_version }}

- name: Execute PowerShell test on ${{ matrix.os }} with ${{ matrix.jdk_vendor }} ${{ matrix.jdk_version }}
if: ${{ matrix.os != 'windows-latest' }}
- shell: pwsh
run: Register-PSRepository -Name Local_Nuget_Feed -SourceLocation $env:GITHUB_WORKSPACE\bin -PublishLocation $env:GITHUB_WORKSPACE\bin -InstallationPolicy Trusted

- if: ${{ matrix.os != 'windows-latest' }}
continue-on-error: true
shell: pwsh
run: |
$env:DOTNET_CLI_UI_LANGUAGE="en_US"
Register-PSRepository -Name Local_Nuget_Feed -SourceLocation $env:GITHUB_WORKSPACE\bin -PublishLocation $env:GITHUB_WORKSPACE\bin -InstallationPolicy Trusted
Install-Module MASES.JNetPS -Repository Local_Nuget_Feed
${{ github.workspace }}/bin/JNetPSTest.ps1
- name: Execute PowerShell test on ${{ matrix.os }} with ${{ matrix.jdk_vendor }} ${{ matrix.jdk_version }}
if: ${{ matrix.os == 'windows-latest' }}
- if: ${{ matrix.os == 'windows-latest' }}
continue-on-error: true
shell: pwsh
run: |
$env:DOTNET_CLI_UI_LANGUAGE="en_US"
Register-PSRepository -Name Local_Nuget_Feed -SourceLocation $env:GITHUB_WORKSPACE\bin -PublishLocation $env:GITHUB_WORKSPACE\bin -InstallationPolicy Trusted
Install-Module MASES.JNetPS -Repository Local_Nuget_Feed
${{ github.workspace }}\bin\JNetPSTest.ps1
- name: Execute PowerShell 5.1 test on ${{ matrix.os }} with ${{ matrix.jdk_vendor }} ${{ matrix.jdk_version }}
if: ${{ matrix.os == 'windows-latest' }}
- if: ${{ matrix.os == 'windows-latest' }}
continue-on-error: true
shell: powershell
run: |
$env:DOTNET_CLI_UI_LANGUAGE="en_US"
Install-Module MASES.JNetPS -Repository Local_Nuget_Feed
${{ github.workspace }}\bin\JNetPSTest.ps1
- if: ${{ matrix.os == 'windows-latest' }}
run: (Get-EventLog -LogName Application -Newest 5).Message

- uses: actions/upload-artifact@v4
if: ${{ matrix.os == 'windows-latest' }}
with:
if-no-files-found: ignore
name: Crash_powershell_${{ matrix.os }}_${{ matrix.framework }}_${{ matrix.jdk_vendor }}_${{ matrix.jdk_version }}
path: .\CrashDumpsDir\*
retention-days: 7

- uses: actions/upload-artifact@v4
if: ${{ matrix.os != 'windows-latest' }}
with:
if-no-files-found: ignore
name: Crash_powershell_${{ matrix.os }}_${{ matrix.framework }}_${{ matrix.jdk_vendor }}_${{ matrix.jdk_version }}
path: ${{ github.workspace }}/coredump.*
retention-days: 7

- uses: actions/upload-artifact@v4
if: failure()
with:
name: Crash_powershell_${{ matrix.os }}_${{ matrix.jdk_vendor }}_${{ matrix.jdk_version }}
if-no-files-found: ignore
name: Crash_powershell_hs_err_${{ matrix.os }}_${{ matrix.jdk_vendor }}_${{ matrix.jdk_version }}
path: ${{ github.workspace }}/**/hs_err_*
retention-days: 7

Expand Down
4 changes: 4 additions & 0 deletions src/net/Common/Common.props
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
<AssemblyOriginatorKeyFile>..\Common\JNet.snk</AssemblyOriginatorKeyFile>
<NoWarn>$(NoWarn);0618</NoWarn>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'net9.0'">
<!--see https://learn.microsoft.com/en-us/dotnet/core/compatibility/interop/9.0/cet-support-->
<CETCompat>false</CETCompat>
</PropertyGroup>
<PropertyGroup Condition="'$(JNET_DOCKER_BUILD_ACTIONS)' != 'true'">
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<TargetFrameworks>net462;net8.0;net9.0</TargetFrameworks>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net462;net8.0;net9.0</TargetFrameworks>
</PropertyGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net462'">
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="MASES.JCOBridge" Version="2.5.19" IncludeAssets="All" PrivateAssets="None" />
</ItemGroup>
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net462;net8.0;net9.0</TargetFrameworks>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'net9.0'">
<!--see https://learn.microsoft.com/en-us/dotnet/core/compatibility/interop/9.0/cet-support-->
<CETCompat>false</CETCompat>
</PropertyGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net462'">
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="MASES.JCOBridge" Version="2.5.19" IncludeAssets="All" PrivateAssets="None" />
</ItemGroup>
</Project>
4 changes: 4 additions & 0 deletions src/net/templates/templates/jnetAWTApp/jnetAWTApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
<OutputType>Exe</OutputType>
<TargetFrameworks>net462;net8.0;net9.0</TargetFrameworks>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'net9.0'">
<!--see https://learn.microsoft.com/en-us/dotnet/core/compatibility/interop/9.0/cet-support-->
<CETCompat>false</CETCompat>
</PropertyGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net462'">
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
Expand Down
34 changes: 19 additions & 15 deletions src/net/templates/templates/jnetApp/jnetApp.csproj
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net462;net8.0;net9.0</TargetFrameworks>
</PropertyGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net462'">
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
<ItemGroup Condition="Exists('..\..\..\JNet\JNet.csproj')">
<!--Within GitHub repo: used for test purpose-->
<ProjectReference Include="..\..\..\JNet\JNet.csproj" />
</ItemGroup>
<ItemGroup Condition="!Exists('..\..\..\JNet\JNet.csproj')">
<!--Outside GitHub repo-->
<PackageReference Include="MASES.JNet" Version="2.5.10" cludeAssets="All" PrivateAssets="None" />
</ItemGroup>
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net462;net8.0;net9.0</TargetFrameworks>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'net9.0'">
<!--see https://learn.microsoft.com/en-us/dotnet/core/compatibility/interop/9.0/cet-support-->
<CETCompat>false</CETCompat>
</PropertyGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net462'">
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
<ItemGroup Condition="Exists('..\..\..\JNet\JNet.csproj')">
<!--Within GitHub repo: used for test purpose-->
<ProjectReference Include="..\..\..\JNet\JNet.csproj" />
</ItemGroup>
<ItemGroup Condition="!Exists('..\..\..\JNet\JNet.csproj')">
<!--Outside GitHub repo-->
<PackageReference Include="MASES.JNet" Version="2.5.10" cludeAssets="All" PrivateAssets="None" />
</ItemGroup>
</Project>
Loading

0 comments on commit eaa1c4d

Please sign in to comment.