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

Publish as native aot on windows #479

Merged
merged 18 commits into from
May 16, 2024
Merged
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
49 changes: 19 additions & 30 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: '6.0.x'
dotnet-version: '8.0.x'

- name: Install GitVersion
uses: gittools/actions/gitversion/[email protected]
Expand All @@ -45,13 +45,15 @@ jobs:
- name: Echo version
run: echo ${{ steps.gitversion.outputs.nuGetVersionV2 }}

- name: Test
run: dotnet test src --configuration Release --nologo --verbosity normal /p:CollectCoverage=true /p:CoverletOutputFormat=opencover

- name: Build
shell: powershell
run: dotnet build src --configuration Release --no-restore /p:Version=${{ steps.gitversion.outputs.nuGetVersionV2 }}
id: build
run: |
dotnet build src --configuration Release
echo "release_folder=./src/NVika/bin/Release/net8.0" >> $env:GITHUB_OUTPUT

- name: Test
run: dotnet test src --configuration Release --no-build --nologo --verbosity normal /p:CollectCoverage=true /p:CoverletOutputFormat=opencover

- name: InspectCode Analysis - old xml
run: |
nuget install JetBrains.ReSharper.CommandLineTools -ExcludeVersion -OutputDirectory tools
Expand All @@ -72,46 +74,33 @@ jobs:
path: inspectcodereport.json
name: inspectcodereport.json

- name: GendarmeAnalysis
run: |
nuget install mono.gendarme -ExcludeVersion -OutputDirectory tools
./tools/Mono.Gendarme/tools/gendarme.exe --xml GendarmeReport.xml --ignore gendarme.ignore .\src\NVika\bin\Release\net8.0\NVika.exe

- uses: actions/upload-artifact@v4
with:
path: GendarmeReport.xml
name: GendarmeReport.xml

- name: LaunchNVika
run: .\src\NVika\bin\Release\net8.0\NVika.exe --debug --includesource inspectcodereport.xml inspectcodereport.json ./src/NVika/bin/Release/net8.0/static-analysis.sarif.json GendarmeReport.xml
run: ${{ steps.build.outputs.release_folder }}/NVika.exe --debug --includesource inspectcodereport.xml inspectcodereport.json ${{ steps.build.outputs.release_folder }}/static-analysis.sarif.json

# - name: Create release notes
# run: |
# dotnet SemanticReleaseNotesParser -g=categories --debug -o="artifacts/ReleaseNotes.html" --pluralizecategoriestitle --includestyle
# dotnet SemanticReleaseNotesParser -g=categories --debug -t=environment -f=markdown --pluralizecategoriestitle
- name: Create Nuget package
run: dotnet pack src --configuration Release --nologo --no-build /p:Version=${{ steps.gitversion.outputs.nuGetVersionV2 }}

- name: Create MSBuild package
run: |
Copy-Item -Path resources/icon.png -Destination src\NVika.MSBuild\
mkdir src\NVika.MSBuild\tools\
Copy-Item -Path "src/NVika/bin/Release/net8.0/publish/*" -Destination src\NVika.MSBuild\tools\
Copy-Item -Path "${{ steps.build.outputs.release_folder }}/publish/*" -Destination src\NVika.MSBuild\tools\
nuget pack src/NVika.MSBuild/NVika.MSBuild.nuspec -Version ${{ steps.gitversion.outputs.nuGetVersionV2 }} -OutputDirectory artifacts/nuget

- name: Create netcore packages
run: |
mkdir ./artifacts/zips
Compress-Archive -Path src/NVika/bin/Release/net8.0/publish/* -DestinationPath "artifacts/zips/NVika.netcore.${{ steps.gitversion.outputs.nuGetVersionV2 }}.zip"
Compress-Archive -Path ${{ steps.build.outputs.release_folder }}/publish/* -DestinationPath "artifacts/zips/NVika.netcore.${{ steps.gitversion.outputs.nuGetVersionV2 }}.zip"
Copy-Item -Path "src/NVika/bin/Release/NVika.${{ steps.gitversion.outputs.nuGetVersionV2 }}.nupkg" -Destination artifacts/nuget

- name: Create windows version
run: |
dotnet publish src/NVika --configuration Release --output ./publish --self-contained true --runtime win-x86 -p:PublishSingleFile=true -p:PublishTrimmed=true /p:PackAsTool=false /p:Version=${{ steps.gitversion.outputs.nuGetVersionV2 }}
# Copy-Item -Path "artifacts/ReleaseNotes.html" -Destination publish
Compress-Archive -Path publish/* -DestinationPath "artifacts/zips/NVika.win-x86.${{ steps.gitversion.outputs.nuGetVersionV2 }}.zip"
dotnet publish src/NVika --configuration Release --output ./publish --runtime win-x64 -p:PublishAot=true -p:PublishTrimmed=true /p:PackAsTool=false /p:Version=${{ steps.gitversion.outputs.nuGetVersionV2 }}
Compress-Archive -Path publish/* -DestinationPath "artifacts/zips/NVika.win-x64.${{ steps.gitversion.outputs.nuGetVersionV2 }}.zip"

- name: Create chocolatey version
run: |
$winVersionChecksum = (Get-FileHash "artifacts/zips/NVika.win-x86.${{ steps.gitversion.outputs.nuGetVersionV2 }}.zip" -Algorithm SHA256).Hash
$winVersionChecksum = (Get-FileHash "artifacts/zips/NVika.win-x64.${{ steps.gitversion.outputs.nuGetVersionV2 }}.zip" -Algorithm SHA256).Hash
mkdir ./artifacts/chocolatey
$installPath = "chocolatey/tools/chocolateyInstall.ps1"
$originalContent = Get-Content $installPath
Expand Down Expand Up @@ -167,14 +156,14 @@ jobs:
asset_name: NVika.netcore.${{ steps.get_version.outputs.version }}.zip
asset_content_type: application/zip

- name: Upload Zip win-x86
- name: Upload Zip win-x64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./artifact/zips/NVika.win-x86.${{ steps.get_version.outputs.version }}.zip
asset_name: NVika.win-x86.${{ steps.get_version.outputs.version }}.zip
asset_path: ./artifact/zips/NVika.win-x64.${{ steps.get_version.outputs.version }}.zip
asset_name: NVika.win-x64.${{ steps.get_version.outputs.version }}.zip
asset_content_type: application/zip

- name: Chocolatey push
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ Right now it's just a tiny tool which parse analysis reports and send messages t
## Installation

- [Zip netcore](https://github.com/laedit/SemanticReleaseNotesParser/releases): download and extract
- [Zip win-x86](https://github.com/laedit/SemanticReleaseNotesParser/releases): download and extract
- [Chocolatey (win-x86)](https://chocolatey.org/packages/nvika/): `choco install nvika`
- [Zip win-x64](https://github.com/laedit/SemanticReleaseNotesParser/releases): download and extract
- [Chocolatey (win-x64)](https://chocolatey.org/packages/nvika/): `choco install nvika`
- [Dotnet tool](https://www.nuget.org/packages/NVika/): `dotnet tool install NVika`
- [MSBuild](https://www.nuget.org/packages/NVika.MSBuild/): `Install-Package NVika.MSBuild`

Expand Down
1 change: 1 addition & 0 deletions ReleaseNotes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# next

- [#479](https://github.com/laedit/vika/pull/479) - Publish as native AOT on windows +breaking
- [#478](https://github.com/laedit/vika/pull/478) - Upgrade to .NET 8 +breaking
- [#477](https://github.com/laedit/vika/pull/477) - Fix license on nuget +enhancement

Expand Down
2 changes: 1 addition & 1 deletion chocolatey/tools/chocolateyInstall.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$packageName = 'NVika'
$url = 'https://github.com/laedit/Vika/releases/download/v[version]/NVika.win-x86.[version].zip'
$url = 'https://github.com/laedit/Vika/releases/download/v[version]/NVika.win-x64.[version].zip'

Install-ChocolateyZipPackage -PackageName "$packageName" -Url "$url" -UnzipLocation "$(Split-Path -parent $MyInvocation.MyCommand.Definition)" -Checksum '[checksum]' -ChecksumType 'sha256'
1 change: 0 additions & 1 deletion src/NVika/NVika.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
<PackAsTool>true</PackAsTool>
<ToolCommandName>nvika</ToolCommandName>
<Authors>laedit</Authors>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Description>Tool - Parse analysis reports (InspectCode, ...) and send messages to build server or console.</Description>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<PackageIcon>icon.png</PackageIcon>
Expand Down
Loading