Update few more. #104
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.Clang | |
on: | |
push: | |
branches: | |
- main | |
- develop | |
pull_request: | |
branches: | |
- main | |
- develop | |
release: | |
types: | |
- created | |
jobs: | |
build: | |
name: Build | |
runs-on: windows-2022 | |
steps: | |
- name: Set Paths | |
shell: pwsh | |
run: | | |
$WORKPATH="C:\work" | |
mkdir $WORKPATH | |
mkdir $WORKPATH\temp | |
mkdir $WORKPATH\dotnet | |
mkdir $WORKPATH\nuget | |
mkdir $WORKPATH\nuget\packages | |
mkdir $WORKPATH\ikvm-clang | |
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-clang" | |
- name: Checkout Source | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- 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: Install GitVersion | |
uses: gittools/actions/gitversion/setup@v1 | |
with: | |
versionSpec: 5.11 | |
- name: Execute GitVersion | |
uses: gittools/actions/gitversion/execute@v1 | |
with: | |
useConfigFile: true | |
- name: Add msbuild to PATH | |
uses: microsoft/setup-msbuild@v2 | |
- name: Restore | |
run: dotnet restore IKVM.Clang.sln | |
working-directory: ${{ env.WORKPATH }}/ikvm | |
- name: Build | |
shell: pwsh | |
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.Clang.dist.msbuildproj | |
working-directory: ${{ env.WORKPATH }}/ikvm-clang | |
- name: Upload MSBuild Log | |
if: ${{ always() }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: msbuild.binlog | |
path: ${{ env.WORKPATH }}/ikvm-clang/msbuild.binlog | |
- name: Upload NuGet Packages | |
uses: actions/upload-artifact@v4 | |
with: | |
name: nuget | |
path: ${{ env.WORKPATH }}/ikvm-clang/dist/nuget | |
- name: Upload VXIS | |
uses: actions/upload-artifact@v4 | |
with: | |
name: vsix | |
path: ${{ env.WORKPATH }}/ikvm-clang/dist/vsix | |
- name: Package Tests | |
run: tar czvf tests.tar.gz tests | |
working-directory: ${{ env.WORKPATH }}/ikvm-clang/dist | |
- name: Upload Tests | |
uses: actions/upload-artifact@v4 | |
with: | |
name: tests | |
path: ${{ env.WORKPATH }}/ikvm-clang/dist/tests.tar.gz | |
test: | |
strategy: | |
matrix: | |
run: | |
- IKVM.Clang.Sdk.Tests | |
tfm: | |
- net7.0 | |
sys: | |
- win10-x64 | |
name: Test (${{ matrix.run }}:${{ matrix.tfm }}:${{ matrix.sys }}) | |
needs: | |
- build | |
timeout-minutes: 240 | |
runs-on: ${{ fromJSON('{"win10-x64":["windows-2022"],"linux-x64":["ubuntu-22.04"],"osx-x64":["macosx-latest"]}')[matrix.sys] }} | |
steps: | |
- 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: Download Tests | |
uses: actions/download-artifact@v3 | |
with: | |
name: tests | |
- name: Restore Tests | |
run: tar xzvf tests.tar.gz | |
- 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 for test assemblies | |
$tests = $(gci ./tests/$tst/$tfm -Recurse -Filter '*.Tests.dll') | |
# if a query was specified, add to test command | |
if ($tests) { | |
if ($qry -ne "" -and $qry -ne $null) { | |
Add-Content $env:GITHUB_ENV "`nRET=TestResults--$tst-$qry--$tfm--$sys" | |
dotnet test -f $tfm --blame -v 2 --results-directory "TestResults" --logger:"console;verbosity=detailed" --logger:trx --collect "Code Coverage" --filter "$qry" $tests | |
} else { | |
Add-Content $env:GITHUB_ENV "`nRET=TestResults--$tst--$tfm--$sys" | |
dotnet test -f $tfm --blame -v 2 --results-directory "TestResults" --logger:"console;verbosity=detailed" --logger:trx --collect "Code Coverage" $tests | |
} | |
} | |
- name: Archive Test Results | |
if: always() && startsWith(env.RET, 'TestResults--') | |
run: tar czvf TestResults.tar.gz TestResults | |
- name: Upload Test Results | |
if: always() && startsWith(env.RET, 'TestResults--') | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ env.RET }} | |
path: TestResults.tar.gz | |
release: | |
name: Release | |
if: github.event_name != 'pull_request' | |
needs: | |
- test | |
runs-on: windows-2022 | |
steps: | |
- name: Checkout Source | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup .NET 7.0 | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 7.0.x | |
- name: Install GitVersion | |
uses: gittools/actions/gitversion/[email protected] | |
with: | |
versionSpec: 5.11 | |
- name: Execute GitVersion | |
id: GitVersion | |
uses: gittools/actions/gitversion/[email protected] | |
with: | |
useConfigFile: true | |
- name: Restore NuGet | |
uses: actions/download-artifact@v3 | |
with: | |
name: nuget | |
path: dist/nuget | |
- name: Restore VSIX | |
uses: actions/download-artifact@v3 | |
with: | |
name: vsix | |
path: dist/vsix | |
- name: Create Release | |
if: github.ref_type == 'tag' | |
uses: ncipollo/release-action@v1 | |
with: | |
tag: ${{ steps.GitVersion.outputs.semVer }} | |
artifacts: dist/nuget/*.nupkg,dist/nuget/*.snupkg | |
allowUpdates: true | |
draft: false | |
makeLatest: true | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Push NuGet (GitHub) | |
shell: pwsh | |
run: dotnet nuget push dist\nuget\*.nupkg --source $env:GITHUB_REPOS --api-key $env:GITHUB_TOKEN --skip-duplicate | |
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 }} | |
- name: Publish to Visual Studio Marketplace | |
if: github.ref_type == 'tag' | |
uses: CalvinAllen/action-vs-marketplace-publish@v1 | |
with: | |
marketplace-pat: ${{ secrets.VS_MARKETPLACE_TOKEN }} | |
publish-manifest-path: dist/vsix/IKVM.Clang.manifest.json | |
vsix-path: dist/vsix/IKVM.Clang.vsix |