Merge pull request #521 from ikvmnet/platio #77
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: IKVM | |
on: | |
workflow_dispatch: | |
inputs: | |
full_test: | |
required: false | |
type: boolean | |
push: | |
branches: | |
- main | |
- develop | |
pull_request: | |
branches: | |
- main | |
- develop | |
release: | |
types: | |
- created | |
env: | |
NATIVE_SDK_VERSION: "20240413.1" | |
jobs: | |
build-openjdk: | |
name: Build OpenJDK | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Source | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Cache OpenJDK Build | |
uses: actions/cache@v4 | |
with: | |
path: openjdk/build/linux-x86_64-normal-server-release | |
key: openjdk-build-linux-x86_64-normal-server-release--${{ runner.os }}--${{ hashFiles('openjdk/**', '!openjdk/build') }}-10 | |
- name: Check OpenJDK Build Stamp | |
id: openjdk-build-stamp | |
uses: andstor/file-existence-action@v3 | |
with: | |
files: openjdk/build/linux-x86_64-normal-server-release/stamp | |
- name: Fetch OpenJDK 7 | |
if: steps.openjdk-build-stamp.outputs.files_exists != 'true' | |
run: | | |
mkdir -p openjdk/build && | |
curl -o openjdk/build/openjdk-7u75-b13-linux-x64-18_dec_2014.tar.gz "https://download.java.net/openjdk/jdk7u75/ri/openjdk-7u75-b13-linux-x64-18_dec_2014.tar.gz" && | |
tar xzvf openjdk/build/openjdk-7u75-b13-linux-x64-18_dec_2014.tar.gz -C openjdk/build | |
- name: Build OpenJDK | |
if: steps.openjdk-build-stamp.outputs.files_exists != 'true' | |
uses: docker://debian/eol:lenny | |
with: | |
args: > | |
/bin/bash -c " | |
echo 'deb http://archive.debian.org/debian/ lenny main' > /etc/apt/sources.list && | |
apt-get update && | |
apt-get install -y \ | |
build-essential \ | |
unzip \ | |
zip \ | |
curl \ | |
gcc-4.3 \ | |
g++-4.3 \ | |
libx11-dev \ | |
libxext-dev \ | |
libxrender-dev \ | |
libxtst-dev \ | |
libxt-dev \ | |
libxi-dev \ | |
libcups2-dev \ | |
libasound2-dev \ | |
libfreetype6-dev \ | |
libfontconfig1-dev && | |
cd openjdk && | |
JAVA_HOME=build/java-se-7u75-ri bash ./configure && | |
make DISABLE_HOTSPOT_OS_VERSION_CHECK=ok images && | |
touch build/linux-x86_64-normal-server-release/stamp" | |
- name: Update OpenJDK Attributes | |
run: | | |
sudo chown -R `id -u`:`id -g` linux-x86_64-normal-server-release && \ | |
sudo chmod -R +rwx linux-x86_64-normal-server-release/images/j2sdk-image/bin | |
working-directory: openjdk/build | |
- name: Package OpenJDK | |
run: zip -r /tmp/openjdk-build-linux-x86_64-normal-server-release.zip linux-x86_64-normal-server-release/* | |
working-directory: openjdk/build | |
- name: Upload OpenJDK | |
uses: actions/upload-artifact@v4 | |
with: | |
name: openjdk-build-linux-x86_64-normal-server-release | |
path: /tmp/openjdk-build-linux-x86_64-normal-server-release.zip | |
- name: Cache OpenJDK Test Harness Build | |
uses: actions/cache@v4 | |
with: | |
path: jtreg/build | |
key: jtreg-build--${{ runner.os }}--${{ hashFiles('jtreg/**', 'openjdk/build/linux-x86_64-normal-server-release/images/j2sdk-image', '!jtreg/build') }}-6 | |
- name: Check OpenJDK Test Harness Build Stamp | |
id: jtreg-build-stamp | |
uses: andstor/file-existence-action@v3 | |
with: | |
files: jtreg/build/stamp | |
- name: Build OpenJDK Test Harness | |
if: steps.jtreg-build-stamp.outputs.files_exists != 'true' | |
run: WGET_OPTS='-U Mozilla/5.0' bash make/build-all.sh `realpath ../openjdk/build/linux-x86_64-normal-server-release/images/j2sdk-image` && touch build/stamp | |
working-directory: jtreg | |
- name: Package OpenJDK Test Harness | |
run: zip -r /tmp/jtreg-build.zip build | |
working-directory: jtreg | |
- name: Upload OpenJDK Test Harness | |
uses: actions/upload-artifact@v4 | |
with: | |
name: jtreg-build | |
path: /tmp/jtreg-build.zip | |
build-ikvm: | |
name: Build IKVM | |
needs: | |
- build-openjdk | |
timeout-minutes: 720 | |
runs-on: windows-latest | |
steps: | |
- name: Set Paths (Windows) | |
shell: pwsh | |
run: | | |
$WORKPATH="C:\work" | |
mkdir $WORKPATH | |
mkdir $WORKPATH\temp | |
mkdir $WORKPATH\dotnet | |
mkdir $WORKPATH\nuget | |
mkdir $WORKPATH\nuget\packages | |
mkdir $WORKPATH\ikvm | |
Add-Content $env:GITHUB_ENV "`nWORKPATH=$WORKPATH" | |
Add-Content $env:GITHUB_ENV "`nTMP=$WORKPATH\temp`nTEMP=$WORKPATH\temp`nTMPDIR=$WORKPATH\temp" | |
Add-Content $env:GITHUB_ENV "`nDOTNET_INSTALL_DIR=$WORKPATH\dotnet" | |
Add-Content $env:GITHUB_ENV "`nNUGET_PACKAGES=$WORKPATH\nuget\packages" | |
New-Item -Path "$env:GITHUB_WORKSPACE\work" -ItemType SymbolicLink -Value "$WORKPATH\ikvm" | |
- name: Checkout Source | |
uses: actions/checkout@v4 | |
with: | |
path: work | |
fetch-depth: 0 | |
submodules: recursive | |
- name: Setup .NET 6.0 | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 6.0.x | |
- name: Setup .NET 7.0 | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 7.0.x | |
- name: Setup .NET 8.0 | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
- name: Cache LLVM and Clang | |
id: cache-llvm | |
uses: actions/cache@v4 | |
with: | |
path: C:/Program Files/LLVM | |
key: llvm-16.0 | |
- name: Install LLVM and Clang | |
uses: KyleMayes/install-llvm-action@v1 | |
with: | |
version: "16.0" | |
cached: ${{ steps.cache-llvm.outputs.cache-hit }} | |
- name: Install apple-codesign | |
uses: baptiste0928/cargo-install@v3 | |
with: | |
crate: apple-codesign | |
version: latest | |
- name: Install GitVersion | |
uses: gittools/actions/gitversion/setup@v1 | |
with: | |
versionSpec: 5.x | |
- name: Execute GitVersion | |
uses: gittools/actions/gitversion/execute@v1 | |
with: | |
targetPath: ${{ env.WORKPATH }}\ikvm | |
useConfigFile: true | |
configFilePath: ${{ env.WORKPATH }}\ikvm\GitVersion.yml | |
- name: Cache NuGet | |
uses: actions/cache@v4 | |
with: | |
path: ${{ env.NUGET_PACKAGES }} | |
key: nuget--${{ runner.os }}--${{ hashFiles('IKVM.sln', 'src/**/*.csproj', 'src/**/*.msbuildproj') }}--1 | |
restore-keys: ${{ runner.os }}-nuget-2- | |
- name: Add msbuild to PATH | |
uses: microsoft/setup-msbuild@v2 | |
with: | |
msbuild-architecture: x64 | |
- name: Download OpenJDK 8 Build | |
uses: actions/download-artifact@v4 | |
with: | |
name: openjdk-build-linux-x86_64-normal-server-release | |
path: ${{ env.WORKPATH }}/temp | |
- name: Restore OpenJDK 8 Build | |
shell: pwsh | |
run: New-Item -Type Directory -Force ${{ env.WORKPATH }}/ikvm/openjdk/build; Expand-Archive ${{ env.WORKPATH }}/temp/openjdk-build-linux-x86_64-normal-server-release.zip -DestinationPath ${{ env.WORKPATH }}/ikvm/openjdk/build | |
- name: Download JTReg Build | |
uses: actions/download-artifact@v4 | |
with: | |
name: jtreg-build | |
path: ${{ env.WORKPATH }}/temp | |
- name: Restore JTReg Build | |
shell: pwsh | |
run: New-Item -Type Directory -Force ${{ env.WORKPATH }}/ikvm/jtreg; Expand-Archive ${{ env.WORKPATH }}/temp/jtreg-build.zip -DestinationPath ${{ env.WORKPATH }}/ikvm/jtreg | |
- name: Download Native SDKs | |
uses: robinraju/[email protected] | |
with: | |
repository: ikvmnet/ikvm-native-sdk | |
tag: ${{ env.NATIVE_SDK_VERSION }} | |
fileName: "*.tar.gz" | |
out-file-path: ${{ env.WORKPATH }}/ikvm/ext/ikvm-native-sdk | |
extract: true | |
- name: Fix Symbolic Links | |
shell: pwsh | |
run: ri win -Recurse; .\Fix-SymbolicLinks.ps1 | |
working-directory: ${{ env.WORKPATH }}/ikvm/ext/ikvm-native-sdk | |
- name: NuGet Restore | |
run: dotnet restore IKVM.sln | |
working-directory: ${{ env.WORKPATH }}/ikvm | |
- name: Build Artifacts | |
run: | | |
msbuild /m /bl ` | |
/p:Configuration="Release" ` | |
/p:Platform="Any CPU" ` | |
/p:PreReleaseLabel=${env:GitVersion_PreReleaseLabel} ` | |
/p:PreReleaseNumber=${env:GitVersion_WeightedPreReleaseNumber} ` | |
/p:Version=${env:GitVersion_FullSemVer} ` | |
/p:AssemblyVersion=${env:GitVersion_AssemblySemVer} ` | |
/p:InformationalVersion=${env:GitVersion_InformationalVersion} ` | |
/p:FileVersion=${env:GitVersion_AssemblySemFileVer} ` | |
/p:PackageVersion=${env:GitVersion_FullSemVer} ` | |
/p:RepositoryUrl="${env:GITHUB_SERVER_URL}/${env:GITHUB_REPOSITORY}.git" ` | |
/p:PackageProjectUrl="${env:GITHUB_SERVER_URL}/${env:GITHUB_REPOSITORY}" ` | |
/p:BuildInParallel=true ` | |
/p:CreateHardLinksForAdditionalFilesIfPossible=true ` | |
/p:CreateHardLinksForCopyAdditionalFilesIfPossible=true ` | |
/p:CreateHardLinksForCopyFilesToOutputDirectoryIfPossible=true ` | |
/p:CreateHardLinksForCopyLocalIfPossible=true ` | |
/p:CreateHardLinksForPublishFilesIfPossible=true ` | |
/p:ContinuousIntegrationBuild=true ` | |
IKVM.dist.msbuildproj | |
working-directory: ${{ env.WORKPATH }}\ikvm | |
- name: Upload MSBuild Log | |
if: ${{ always() }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: msbuild.binlog | |
path: ${{ env.WORKPATH }}\ikvm\msbuild.binlog | |
- name: Package NuGet Packages | |
run: tar czvf C:\nuget.tar.gz nuget | |
working-directory: ${{ env.WORKPATH }}\ikvm\dist | |
- name: Upload NuGet Packages | |
uses: actions/upload-artifact@v4 | |
with: | |
name: nuget | |
path: C:\nuget.tar.gz | |
- name: Delete NuGet Packages | |
shell: pwsh | |
run: ri C:\nuget.tar.gz | |
- name: Package Binaries | |
run: tar czvf C:\bin.tar.gz bin | |
working-directory: ${{ env.WORKPATH }}\ikvm\dist | |
- name: Upload Binaries | |
uses: actions/upload-artifact@v4 | |
with: | |
name: bin | |
path: C:\bin.tar.gz | |
- name: Delete Binaries | |
shell: pwsh | |
run: ri C:\bin.tar.gz | |
- name: Package Tools | |
run: tar czvf C:\tools.tar.gz tools | |
working-directory: ${{ env.WORKPATH }}\ikvm\dist | |
- name: Upload Tools | |
uses: actions/upload-artifact@v4 | |
with: | |
name: tools | |
path: C:\tools.tar.gz | |
- name: Delete Tools | |
shell: pwsh | |
run: ri C:\tools.tar.gz | |
- name: Package Image | |
run: tar czvf C:\image.tar.gz image | |
working-directory: ${{ env.WORKPATH }}\ikvm\dist | |
- name: Upload Image | |
uses: actions/upload-artifact@v4 | |
with: | |
name: image | |
path: C:\image.tar.gz | |
- name: Delete Image | |
shell: pwsh | |
run: ri C:\image.tar.gz | |
- name: Package Tests (IKVM.ByteCode.Tests) | |
run: tar czvf C:\tests--IKVM.ByteCode.Tests.tar.gz tests\IKVM.ByteCode.Tests | |
working-directory: ${{ env.WORKPATH }}\ikvm\dist | |
- name: Upload Tests (IKVM.ByteCode.Tests) | |
uses: actions/upload-artifact@v4 | |
with: | |
name: tests--IKVM.ByteCode.Tests | |
path: C:\tests--IKVM.ByteCode.Tests.tar.gz | |
- name: Delete Tests (IKVM.ByteCode.Tests) | |
shell: pwsh | |
run: ri C:\tests--IKVM.ByteCode.Tests.tar.gz | |
- name: Package Tests (IKVM.Reflection.Tests) | |
run: tar czvf C:\tests--IKVM.Reflection.Tests.tar.gz tests\IKVM.Reflection.Tests | |
working-directory: ${{ env.WORKPATH }}\ikvm\dist | |
- name: Upload Tests (IKVM.Reflection.Tests) | |
uses: actions/upload-artifact@v4 | |
with: | |
name: tests--IKVM.Reflection.Tests | |
path: C:\tests--IKVM.Reflection.Tests.tar.gz | |
- name: Delete Tests (IKVM.Reflection.Tests) | |
shell: pwsh | |
run: ri C:\tests--IKVM.Reflection.Tests.tar.gz | |
- name: Package Tests (IKVM.Tests) | |
run: tar czvf C:\tests--IKVM.Tests.tar.gz tests\IKVM.Tests | |
working-directory: ${{ env.WORKPATH }}\ikvm\dist | |
- name: Upload Tests (IKVM.Tests) | |
uses: actions/upload-artifact@v4 | |
with: | |
name: tests--IKVM.Tests | |
path: C:\tests--IKVM.Tests.tar.gz | |
- name: Delete Tests (IKVM.Tests) | |
shell: pwsh | |
run: ri C:\tests--IKVM.Tests.tar.gz | |
- name: Package Tests (IKVM.Java.Tests) | |
run: tar czvf C:\tests--IKVM.Java.Tests.tar.gz tests\IKVM.Java.Tests | |
working-directory: ${{ env.WORKPATH }}\ikvm\dist | |
- name: Upload Tests (IKVM.Java.Tests) | |
uses: actions/upload-artifact@v4 | |
with: | |
name: tests--IKVM.Java.Tests | |
path: C:\tests--IKVM.Java.Tests.tar.gz | |
- name: Delete Tests (IKVM.Java.Tests) | |
shell: pwsh | |
run: ri C:\tests--IKVM.Java.Tests.tar.gz | |
- name: Package Tests (IKVM.Tools.Tests) | |
run: tar czvf C:\tests--IKVM.Tools.Tests.tar.gz tests\IKVM.Tools.Tests | |
working-directory: ${{ env.WORKPATH }}\ikvm\dist | |
- name: Upload Tests (IKVM.Tools.Tests) | |
uses: actions/upload-artifact@v4 | |
with: | |
name: tests--IKVM.Tools.Tests | |
path: C:\tests--IKVM.Tools.Tests.tar.gz | |
- name: Delete Tests (IKVM.Tools.Tests) | |
shell: pwsh | |
run: ri C:\tests--IKVM.Tools.Tests.tar.gz | |
- name: Package Tests (IKVM.Tools.Exporter.Tests) | |
run: tar czvf C:\tests--IKVM.Tools.Exporter.Tests.tar.gz tests\IKVM.Tools.Exporter.Tests | |
working-directory: ${{ env.WORKPATH }}\ikvm\dist | |
- name: Upload Tests (IKVM.Tools.Exporter.Tests) | |
uses: actions/upload-artifact@v4 | |
with: | |
name: tests--IKVM.Tools.Exporter.Tests | |
path: C:\tests--IKVM.Tools.Exporter.Tests.tar.gz | |
- name: Delete Tests (IKVM.Tools.Exporter.Tests) | |
shell: pwsh | |
run: ri C:\tests--IKVM.Tools.Exporter.Tests.tar.gz | |
- name: Package Tests (IKVM.Tools.Importer.Tests) | |
run: tar czvf C:\tests--IKVM.Tools.Importer.Tests.tar.gz tests\IKVM.Tools.Importer.Tests | |
working-directory: ${{ env.WORKPATH }}\ikvm\dist | |
- name: Upload Tests (IKVM.Tools.Importer.Tests) | |
uses: actions/upload-artifact@v4 | |
with: | |
name: tests--IKVM.Tools.Importer.Tests | |
path: C:\tests--IKVM.Tools.Importer.Tests.tar.gz | |
- name: Delete Tests (IKVM.Tools.Importer.Tests) | |
shell: pwsh | |
run: ri C:\tests--IKVM.Tools.Importer.Tests.tar.gz | |
- name: Package Tests (IKVM.MSBuild.Tasks.Tests) | |
run: tar czvf C:\tests--IKVM.MSBuild.Tasks.Tests.tar.gz tests\IKVM.MSBuild.Tasks.Tests | |
working-directory: ${{ env.WORKPATH }}\ikvm\dist | |
- name: Upload Tests (IKVM.MSBuild.Tasks.Tests) | |
uses: actions/upload-artifact@v4 | |
with: | |
name: tests--IKVM.MSBuild.Tasks.Tests | |
path: C:\tests--IKVM.MSBuild.Tasks.Tests.tar.gz | |
- name: Delete Tests (IKVM.MSBuild.Tasks.Tests) | |
shell: pwsh | |
run: ri C:\tests--IKVM.MSBuild.Tasks.Tests.tar.gz | |
- name: Package Tests (IKVM.MSBuild.Tests) | |
run: tar czvf C:\tests--IKVM.MSBuild.Tests.tar.gz tests\IKVM.MSBuild.Tests | |
working-directory: ${{ env.WORKPATH }}\ikvm\dist | |
- name: Upload Tests (IKVM.MSBuild.Tests) | |
uses: actions/upload-artifact@v4 | |
with: | |
name: tests--IKVM.MSBuild.Tests | |
path: C:\tests--IKVM.MSBuild.Tests.tar.gz | |
- name: Delete Tests (IKVM.MSBuild.Tests) | |
shell: pwsh | |
run: ri C:\tests--IKVM.MSBuild.Tests.tar.gz | |
- name: Package Tests (IKVM.NET.Sdk.Tests) | |
run: tar czvf C:\tests--IKVM.NET.Sdk.Tests.tar.gz tests\IKVM.NET.Sdk.Tests | |
working-directory: ${{ env.WORKPATH }}\ikvm\dist | |
- name: Upload Tests (IKVM.NET.Sdk.Tests) | |
uses: actions/upload-artifact@v4 | |
with: | |
name: tests--IKVM.NET.Sdk.Tests | |
path: C:\tests--IKVM.NET.Sdk.Tests.tar.gz | |
- name: Delete Tests (IKVM.NET.Sdk.Tests) | |
shell: pwsh | |
run: ri C:\tests--IKVM.NET.Sdk.Tests.tar.gz | |
- name: Package Tests (IKVM.JTReg.TestAdapter.Tests) | |
run: tar czvf C:\tests--IKVM.JTReg.TestAdapter.Tests.tar.gz tests\IKVM.JTReg.TestAdapter.Tests | |
working-directory: ${{ env.WORKPATH }}\ikvm\dist | |
- name: Upload Tests (IKVM.JTReg.TestAdapter.Tests) | |
uses: actions/upload-artifact@v4 | |
with: | |
name: tests--IKVM.JTReg.TestAdapter.Tests | |
path: C:\tests--IKVM.JTReg.TestAdapter.Tests.tar.gz | |
- name: Delete Tests (IKVM.JTReg.TestAdapter.Tests) | |
shell: pwsh | |
run: ri C:\tests--IKVM.JTReg.TestAdapter.Tests.tar.gz | |
- name: Package Tests (IKVM.OpenJDK.Tests) | |
run: tar czvf C:\tests--IKVM.OpenJDK.Tests.tar.gz tests\IKVM.OpenJDK.Tests | |
working-directory: ${{ env.WORKPATH }}\ikvm\dist | |
- name: Upload Tests (IKVM.OpenJDK.Tests) | |
uses: actions/upload-artifact@v4 | |
with: | |
name: tests--IKVM.OpenJDK.Tests | |
path: C:\tests--IKVM.OpenJDK.Tests.tar.gz | |
- name: Delete Tests (IKVM.OpenJDK.Tests) | |
shell: pwsh | |
run: ri C:\tests--IKVM.OpenJDK.Tests.tar.gz | |
- name: Package Documentation | |
shell: pwsh | |
run: Compress-Archive -Path doc\* -DestinationPath C:\doc.zip | |
working-directory: ${{ env.WORKPATH }}\ikvm | |
- name: Upload Documentation | |
uses: actions/upload-artifact@v4 | |
with: | |
name: doc | |
path: C:\doc.zip | |
test-vars: | |
name: Test Variables | |
needs: | |
- build-ikvm | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.test-vars.outputs.matrix }} | |
steps: | |
- id: test-vars | |
shell: pwsh | |
env: | |
FULL_TEST: ${{ inputs.full_test }} | |
run: | | |
$sys = @( | |
"win-x64", | |
"linux-x64", | |
"osx-x64" | |
) | |
$tfm = @( | |
"net472", | |
"net6.0", | |
"net8.0" | |
) | |
$run = @( | |
"IKVM.ByteCode.Tests", | |
"IKVM.Reflection.Tests", | |
"IKVM.Tests", | |
"IKVM.Java.Tests", | |
"IKVM.Tools.Exporter.Tests", | |
"IKVM.Tools.Importer.Tests", | |
"IKVM.Tools.Tests", | |
"IKVM.MSBuild.Tasks.Tests", | |
"IKVM.MSBuild.Tests", | |
"IKVM.NET.Sdk.Tests", | |
"IKVM.JTReg.TestAdapter.Tests") | |
foreach ($_ in (0..15)) { | |
$run += @("IKVM.OpenJDK.Tests?TestPartition=$_") | |
} | |
$exclude = @( | |
@{ | |
"tfm" = "net472" | |
"sys" = "linux-x64" | |
}, | |
@{ | |
"tfm" = "net472" | |
"sys" = "osx-x64" | |
}, | |
@{ | |
"run" = "IKVM.MSBuild.Tests" | |
"tfm" = "net472" | |
}, | |
@{ | |
"run" = "IKVM.MSBuild.Tests" | |
"tfm" = "net6.0" | |
}, | |
@{ | |
"run" = "IKVM.MSBuild.Tests" | |
"tfm" = "net7.0" | |
}, | |
@{ | |
"run" = "IKVM.MSBuild.Tests" | |
"sys" = "linux-x64" | |
}, | |
@{ | |
"run" = "IKVM.MSBuild.Tests" | |
"sys" = "osx-x64" | |
}, | |
@{ | |
"run" = "IKVM.MSBuild.Tests" | |
"sys" = "osx-arm64" | |
}, | |
@{ | |
"run" = "IKVM.NET.Sdk.Tests" | |
"tfm" = "net472" | |
}, | |
@{ | |
"run" = "IKVM.NET.Sdk.Tests" | |
"tfm" = "net6.0" | |
}, | |
@{ | |
"run" = "IKVM.NET.Sdk.Tests" | |
"tfm" = "net7.0" | |
} | |
) | |
if ($env:FULL_TEST -ne "true") { | |
foreach ($_ in (0..15)) { | |
$exclude += @(@{ | |
"run" = "IKVM.OpenJDK.Tests?TestPartition=$_" | |
"tfm" = "net8.0" | |
}) | |
} | |
} | |
"matrix=" + (@{ | |
sys = $sys | |
tfm = $tfm | |
run = $run | |
exclude = $exclude | |
} | ConvertTo-Json -Compress).Replace('"', "'") >> $env:GITHUB_OUTPUT | |
test: | |
needs: | |
- build-ikvm | |
- test-vars | |
strategy: | |
fail-fast: false | |
matrix: ${{ fromJSON(needs.test-vars.outputs.matrix) }} | |
name: Test (${{ matrix.run }}:${{ matrix.tfm }}:${{ matrix.sys }}) | |
timeout-minutes: 240 | |
runs-on: ${{ fromJSON('{"win-x64":["windows-2022"],"linux-x64":["ubuntu-22.04"],"osx-x64":["macos-12"]}')[matrix.sys] }} | |
steps: | |
- name: Free Disk Space (Linux) | |
if: runner.os == 'Linux' | |
uses: jlumbroso/free-disk-space@main | |
with: | |
dotnet: false | |
swap-storage: false | |
large-packages: false | |
- name: Set Paths (Windows) | |
if: runner.os == 'Windows' | |
shell: pwsh | |
run: | | |
$dir="C:\w" | |
mkdir $dir | |
mkdir $dir\temp | |
mkdir $dir\dotnet | |
mkdir $dir\work | |
Add-Content $env:GITHUB_ENV "`nWORKPATH=$dir\work" | |
Add-Content $env:GITHUB_ENV "`nTMP=$dir\temp`nTEMP=$dir\temp`nTMPDIR=$dir\temp" | |
Add-Content $env:GITHUB_ENV "`nDOTNET_INSTALL_DIR=$dir\dotnet" | |
- name: Set Paths (Linux/OS X) | |
if: runner.os == 'Linux' || runner.os == 'macOS' | |
shell: pwsh | |
run: | | |
$dir="${{ runner.temp }}/w" | |
mkdir $dir | |
mkdir $dir/temp | |
mkdir $dir/dotnet | |
mkdir $dir/work | |
Add-Content $env:GITHUB_ENV "`nWORKPATH=$dir/work" | |
Add-Content $env:GITHUB_ENV "`nTMP=$dir/temp`nTEMP=$dir/temp`nTMPDIR=$dir/temp" | |
Add-Content $env:GITHUB_ENV "`nDOTNET_INSTALL_DIR=$dir/dotnet" | |
- name: Install ProcDump | |
if: runner.os == 'Windows' | |
shell: pwsh | |
run: choco install procdump -y; Add-Content $env:GITHUB_PATH "$env:ProgramData\chocolatey\bin\" | |
- name: Setup .NET 6.0 | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 6.0.x | |
- name: Setup .NET 7.0 | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 7.0.x | |
- name: Setup .NET 8.0 | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
- name: Setup WSL | |
if: runner.os == 'Windows' | |
uses: Vampire/setup-wsl@v3 | |
- name: Setup Linux | |
if: runner.os == 'Linux' | |
shell: bash | |
run: sudo apt-get update && sudo apt-get install -y libasound2 | |
- name: Get Test Name | |
uses: actions/github-script@v7 | |
id: test-name | |
env: | |
MATRIX_RUN: '${{ matrix.run }}' | |
with: | |
script: | | |
const run = process.env.MATRIX_RUN; | |
const tst = run.split('?')[0]; | |
return tst; | |
result-encoding: string | |
- name: Download Tests | |
uses: actions/download-artifact@v4 | |
with: | |
name: tests--${{ steps.test-name.outputs.result }} | |
path: ${{ env.WORKPATH }} | |
- name: Restore Tests | |
run: tar xzvf tests--${{ steps.test-name.outputs.result }}.tar.gz | |
working-directory: ${{ env.WORKPATH }} | |
- name: Delete Tests | |
shell: pwsh | |
run: ri tests--${{ steps.test-name.outputs.result }}.tar.gz | |
working-directory: ${{ env.WORKPATH }} | |
- name: Execute Tests | |
timeout-minutes: 120 | |
shell: pwsh | |
run: | | |
# assign powershell variables | |
$run = "${{ matrix.run }}" | |
$tfm = "${{ matrix.tfm }}" | |
$sys = "${{ matrix.sys }}" | |
# suite name can contain filter expression after ? | |
$split = $run.IndexOf("?") | |
if ($split -gt -1) { | |
$tst = $run.Substring(0, $split) | |
$qry = $run.Substring($split + 1) | |
} else { | |
$tst = $run | |
} | |
# scan and process test assemblies | |
$tests = $(gi .\tests\$tst\$tfm\*.Tests.dll) | |
if ($tests) { | |
$argl = @( | |
"-f", $tfm, | |
"--blame", | |
"--blame-crash", | |
"--blame-hang", | |
"--blame-hang-timeout", "60m", | |
"--blame-hang-dump-type", "full", | |
"-v:diag", | |
"--results-directory", "TestResults", | |
"--logger:console;verbosity=detailed", | |
"--logger:trx" | |
# "--collect", "Code Coverage" | |
) | |
$runsettings = $(gi .\tests\$tst\$tfm\*.runsettings) | |
if ($runsettings) { | |
$argl += "--settings:$runsettings" | |
} | |
if ($qry -ne "" -and $qry -ne $null) { | |
$argl += @("--filter", $qry) | |
Add-Content $env:GITHUB_ENV "`nRET=TestResults--$tst-$qry--$tfm--$sys" | |
} else { | |
Add-Content $env:GITHUB_ENV "`nRET=TestResults--$tst--$tfm--$sys" | |
} | |
dotnet test @argl $tests[0].FullName | |
} | |
working-directory: ${{ env.WORKPATH }} | |
- name: Archive Test Results | |
if: always() && startsWith(env.RET, 'TestResults--') | |
run: tar czvf ${{ env.TMPDIR }}/TestResults.tar.gz TestResults | |
working-directory: ${{ env.WORKPATH }} | |
- name: Upload Test Results | |
if: always() && startsWith(env.RET, 'TestResults--') | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.RET }} | |
path: ${{ env.TMPDIR }}/TestResults.tar.gz | |
release: | |
name: Release | |
needs: | |
- test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Free Disk Space (Linux) | |
uses: jlumbroso/free-disk-space@main | |
with: | |
dotnet: false | |
swap-storage: false | |
large-packages: false | |
- name: Checkout Source | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup .NET | |
shell: pwsh | |
run: Add-Content $env:GITHUB_ENV "`nDOTNET_INSTALL_DIR=${{ runner.temp }}/dotnet" | |
- name: Setup .NET 8.0 | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
- name: Install GitVersion | |
uses: gittools/actions/gitversion/setup@v1 | |
with: | |
versionSpec: 5.x | |
- name: Execute GitVersion | |
id: GitVersion | |
uses: gittools/actions/gitversion/execute@v1 | |
with: | |
useConfigFile: true | |
- name: Download NuGet Packages | |
uses: actions/download-artifact@v4 | |
with: | |
name: nuget | |
path: dist | |
- name: Restore NuGet Packages | |
run: tar xzvf nuget.tar.gz | |
working-directory: dist | |
- name: Download Binaries | |
uses: actions/download-artifact@v4 | |
with: | |
name: bin | |
path: dist | |
- name: Restore Binaries | |
run: tar xzvf bin.tar.gz | |
working-directory: dist | |
- name: Compress Binaries | |
shell: pwsh | |
run: cd dist && gi bin/* | %{ $tfm = $_.Name; Push-Location "bin/$tfm"; zip -r "../IKVM-${env:GitVersion_SemVer}-bin-$tfm.zip" .; tar czvf "../IKVM-${env:GitVersion_SemVer}-bin-$tfm.tar.gz" .; Pop-Location } | |
- name: Download Tools | |
uses: actions/download-artifact@v4 | |
with: | |
name: tools | |
path: dist | |
- name: Restore Tools | |
run: tar xzvf tools.tar.gz | |
working-directory: dist | |
- name: Compress Tools | |
shell: pwsh | |
run: cd dist && gi tools/*/* | %{ $tfm = $_.Parent.Name; $rid = $_.Name; Push-Location "tools/$tfm/$rid"; zip -r "../../IKVM-${env:GitVersion_SemVer}-tools-$tfm-$rid.zip" .; tar czvf "../../IKVM-${env:GitVersion_SemVer}-tools-$tfm-$rid.tar.gz" .; Pop-Location } | |
- name: Download Image | |
uses: actions/download-artifact@v4 | |
with: | |
name: image | |
path: dist | |
- name: Restore Image | |
run: tar xzvf image.tar.gz | |
working-directory: dist | |
- name: Compress Image | |
shell: pwsh | |
run: cd dist && gi image/*/* | %{ $tfm = $_.Parent.Name; $rid = $_.Name; Push-Location "image/$tfm/$rid"; zip -r "../../IKVM-${env:GitVersion_SemVer}-image-$tfm-$rid.zip" .; tar czvf "../../IKVM-${env:GitVersion_SemVer}-image-$tfm-$rid.tar.gz" .; Pop-Location } | |
- name: Download Documentation | |
uses: actions/download-artifact@v4 | |
with: | |
name: doc | |
path: dist | |
- name: Create Release | |
if: github.ref_type == 'tag' | |
uses: ncipollo/[email protected] | |
with: | |
tag: ${{ github.ref_name }} | |
allowUpdates: true | |
omitBodyDuringUpdate: true | |
artifacts: dist/nuget/*.nupkg,dist/bin/*.zip,dist/bin/*.tar.gz,dist/image/*.zip,dist/image/*.tar.gz,dist/tools/*.zip,dist/tools/*.tar.gz,dist/doc.zip | |
draft: false | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Push NuGet (GitHub) | |
if: github.event_name != 'pull_request' | |
shell: pwsh | |
run: dotnet nuget push dist/nuget/*.nupkg --source $env:GITHUB_REPOS --api-key $env:GITHUB_TOKEN --skip-duplicate --no-symbols | |
env: | |
GITHUB_REPOS: https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Push NuGet | |
if: github.ref_type == 'tag' | |
shell: pwsh | |
run: dotnet nuget push dist/nuget/*.nupkg --source $env:NUGET_REPOS --api-key $env:NUGET_TOKEN --skip-duplicate | |
env: | |
NUGET_REPOS: https://api.nuget.org/v3/index.json | |
NUGET_TOKEN: ${{ secrets.NUGET_TOKEN }} |