10000 Build nuget packages in CI and push to nuget.org by webwarrior-ws · Pull Request #28 · nblockchain/Mali · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Build nuget packages in CI and push to nuget.org #28

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

Merged
merged 13 commits into from
Nov 25, 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
47 changes: 47 additions & 0 deletions .github/workflows/build-gtk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Build Controls.Sample.Gtk
on: [push, pull_request]

jobs:
build_and_test:
name: Build & Test
runs-on: ubuntu-22.04
env:
GtkSharpVersion: 3.24.24.117-develop
GtkSharpManifestVersion: 8.0.200
DotnetVersion: 8.0.200
PROJECTS_TO_PACK: |
src/BlazorWebView/src/Maui/Microsoft.AspNetCore.Components.WebView.Maui.csproj
src/Essentials/src/Essentials.csproj
src/Controls/src/Core/Controls.Core.csproj
src/Controls/src/Xaml/Controls.Xaml.csproj
src/Core/src/Core.csproj
src/Compatibility/Core/src/Compatibility.csproj
src/Controls/Foldable/src/Controls.Foldable.csproj
src/Graphics/src/Graphics/Graphics.csproj
steps:
- name: Checkout MAUI repo
uses: actions/checkout@v2
- name: Setup .NET SDK ${{ env.DotnetVersion }}
uses: actions/setup-dotnet@v1.7.2
with:
dotnet-version: ${{ env.DotnetVersion }}
- name: Install gtk workload
run: ./install_gtk_workload.sh
- name: Generate pre-release version suffix
run: dotnet fsi nugetPreRelease.fsx "" > PreReleaseVersionSuffix.txt
- name: Build MAUI
run: |
mv Directory.Build.Override.props.in Directory.Build.Override.props
dotnet build Microsoft.Maui.BuildTasks.slnf
echo "$PROJECTS_TO_PACK" | while read -r project; do
[ -z "$project" ] && continue # Skip if empty
dotnet build -c Release "$project"
done
- name: Pack MAUI
run: ./pack_mali.sh
- name: Upload binaries to nuget (if tag or main branch, and nugetKey is present)
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NUGET_KEY: ${{ secrets.NUGET_KEY }}
if: ${{ env.NUGET_KEY != '' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) }}
run: dotnet nuget push **/*.nupkg --api-key ${{ secrets.NUGET_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
3 changes: 2 additions & 1 deletion Directory.Build.Override.props.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@
-->
<_IncludeWindows></_IncludeWindows>
<_IncludeTizen></_IncludeTizen>
<_IncludeGtk>true</_IncludeGtk>
<_IncludeAndroid></_IncludeAndroid>
<_IncludeIos></_IncludeIos>
<_IncludeMacCatalyst></_IncludeMacCatalyst>
<_IncludeMacOS></_IncludeMacOS>
</PropertyGroup>

<PropertyGroup>
<_SpecificPlatformRequested Condition="'$(_IncludeAndroid)' == 'true' OR '$(_IncludeWindows)' == 'true' OR '$(_IncludeTizen)' == 'true' OR '$(_IncludeIos)' == 'true' OR '$(_IncludeMacCatalyst)' == 'true' OR '$(_IncludeMacOS)' == 'true'">true</_SpecificPlatformRequested>
<_SpecificPlatformRequested Condition="'$(_IncludeAndroid)' == 'true' OR '$(_IncludeWindows)' == 'true' OR '$(_IncludeTizen)' == 'true' OR '$(_IncludeGtk)' == true OR '$(_IncludeIos)' == 'true' OR '$(_IncludeMacCatalyst)' == 'true' OR '$(_IncludeMacOS)' == 'true'">true</_SpecificPlatformRequested>
<IncludeAndroidTargetFrameworks Condition="'$(_SpecificPlatformRequested)' == 'true' AND '$(_IncludeAndroid)' != 'true'">false</IncludeAndroidTargetFrameworks>
<IncludeWindowsTargetFrameworks Condition="'$(_SpecificPlatformRequested)' == 'true' AND '$(_IncludeWindows)' != 'true'">false</IncludeWindowsTargetFrameworks>
<IncludeTizenTargetFrameworks Condition="'$(_SpecificPlatformRequested)' == 'true' AND '$(_IncludeTizen)' != 'true'">false</IncludeTizenTargetFrameworks>
Expand Down
2 changes: 2 additions & 0 deletions Directory.Build.props
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@
<_MauiBuildTasksLocation Condition="'$(_MauiBuildTasksLocation)' == ''">$(MSBuildThisFileDirectory).buildtasks\</_MauiBuildTasksLocation>
<_MauiAOTProfileLocation>$(MauiSrcDirectory)Controls\src\Build.Tasks\nuget\buildTransitive\netstandard2.0\</_MauiAOTProfileLocation>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<NoWarn>$(NoWarn);NU1605</NoWarn>
<WarningsNotAsErrors>NU1605</WarningsNotAsErrors>
<DebugType>portable</DebugType>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
Expand Down
4 changes: 2 additions & 2 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<SystemNumericsVectorsVersion>4.5.0</SystemNumericsVectorsVersion>
<SystemMemoryPackageVersion>4.5.5</SystemMemoryPackageVersion>
<SystemBuffersPackageVersion>4.5.1</SystemBuffersPackageVersion>
<SystemTextJsonPackageVersion>7.0.2</SystemTextJsonPackageVersion>
<SystemTextJsonPackageVersion>8.0.5</SystemTextJsonPackageVersion>
<SystemTextEncodingsWebPackageVersion>7.0.0</SystemTextEncodingsWebPackageVersion>
<MicrosoftBclAsyncInterfacesPackageVersion>7.0.0</MicrosoftBclAsyncInterfacesPackageVersion>
<SystemIOUnmanagedMemoryStreamPackageVersion>4.3.0</SystemIOUnmanagedMemoryStreamPackageVersion>
Expand All @@ -64,7 +64,7 @@
- Feed URI in the nuget.config
- Native assets build and sha
-->
<_SkiaSharpVersion>2.88.2</_SkiaSharpVersion>
<_SkiaSharpVersion>2.88.6</_SkiaSharpVersion>
<_HarfBuzzSharpVersion>2.8.2.2</_HarfBuzzSharpVersion>
<_SkiaSharpNativeAssetsVersion>0.0.0-commit.193b587552cb0ed39372a049d7e6c692db98c267.483</_SkiaSharpNativeAssetsVersion>
<MicrosoftTemplateEngineTasksVersion>7.0.100-preview.5.22226.1</MicrosoftTemplateEngineTasksVersion>
Expand Down
11 changes: 8 additions & 3 deletions eng/Versions.targets
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@

<VersionMetadata Include="sha.$(GitCommit)"/>

<VersionMetadata Condition="$(CI)"
<VersionMetadata Condition="$(CI) and '$(BUILD_BUILDID)' != ''"
Include="azdo.$(BUILD_BUILDID)"/>
</ItemGroup>

<PropertyGroup>
<VersionMetadataLabel>@(VersionMetadata -> '%(Identity)', '-')</VersionMetadataLabel>
<VersionMetadataPlusLabel Condition="'$(VersionMetadataLabel)' != ''">+$(VersionMetadataLabel)</VersionMetadataPlusLabel>
<VersionMetadataPlusLabel Condition="'$(VersionMetadataLabel)' != ''">0+$(VersionMetadataLabel)</VersionMetadataPlusLabel>
<Version>$(GitBaseVersionMajor).$(GitBaseVersionMinor).$(GitBaseVersionPatch)</Version>
<PackageReferenceVersion>$(GitSemVerMajor).$(GitSemVerMinor).$(GitSemVerPatch)$(GitSemVerDashLabel)</PackageReferenceVersion>
<PackageReferenceVersion Condition="$(CI) and '$(GitSemVerDashLabel)' != ''">$(GitSemVerMajor).$(GitSemVerMinor).$(GitBaseVersionPatch)$(GitSemVerDashLabel).$(BUILDVERSION)</PackageReferenceVersion>
Expand All @@ -79,6 +79,11 @@
<VSComponentVersion Condition="$(CI) and '$(GitSemVerDashLabel)' != ''">$(GitSemVerMajor).$(GitSemVerMinor).$(GitBaseVersionPatch).$(BUILDVERSION)</VSComponentVersion>
<VSComponentVersion Condition="$(CI) and '$(GitSemVerDashLabel)' == ''">$(GitSemVerMajor).$(GitSemVerMinor).$(GitSemVerPatch).0</VSComponentVersion>
<PackageVersion>$(PackageReferenceVersion)$(VersionMetadataPlusLabel)</PackageVersion>
<!-- Generate stable release package for tags -->
<PackageVersion Condition=" '$(GitTag)' != '' ">$(GitSemVerMajor).$(GitSemVerMinor).$(GitSemVerPatch)</PackageVersion>
<!-- Pre-release version for other cases -->
<PreReleaseVersionSuffix>$([System.IO.File]::ReadAllText($(MSBuildThisFileDirectory)../PreReleaseVersionSuffix.txt))</PreReleaseVersionSuffix>
<PackageVersion Condition="$(CI) and '$(GitTag)' == '' ">$(GitSemVerMajor).$(GitSemVerMinor).$(GitSemVerPatch)$(PreReleaseVersionSuffix)</PackageVersion>
</PropertyGroup>

<PropertyGroup>
Expand Down
15 changes: 15 additions & 0 deletions install_gtk_workload.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash

set -euxo pipefail

# For some reason automatic workload manifest detection doesn't work (see https://github.com/GtkSharp/GtkSharp/issues/355#issuecomment-1446262239), so download and uzip mainfest file manually
dotnet nuget add source --name nuget.org "https://api.nuget.org/v3/index.json"
wget https://www.nuget.org/api/v2/package/gtksharp.net.sdk.gtk.manifest-$GtkSharpManifestVersion/$GtkSharpVersion -O gtksharp.net.sdk.gtk.manifest-$GtkSharpManifestVersion.nupkg
DOTNET_DIR=/home/runner/.dotnet
WORKLOAD_MANIFEST_DIR=$DOTNET_DIR/sdk-manifests/$DotnetVersion/gtksharp.net.sdk.gtk
mkdir -p $WORKLOAD_MANIFEST_DIR
unzip -j gtksharp.net.sdk.gtk.manifest-$GtkSharpManifestVersion.nupkg "data/*" -d $WORKLOAD_MANIFEST_DIR/
rm gtksharp.net.sdk.gtk.manifest-$GtkSharpManifestVersion.nupkg
chmod 764 $WORKLOAD_MANIFEST_DIR/*
dotnet workload search
dotnet workload install gtk --skip-manifest-update
6 changes: 6 additions & 0 deletions nugetPreRelease.fsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#r "nuget: Fsdk, Version=0.6.0--date20231213-0703.git-d7a5962"

let args = fsi.CommandLineArgs

Fsdk.Network.GetNugetPrereleaseVersionFromBaseVersion args.[1]
|> System.Console.WriteLine
11 changes: 11 additions & 0 deletions pack_mali.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/env bash

# Use PROJECTS_TO_PACK env. var for newline-separated list of projects.

set -euxo pipefail


echo "$PROJECTS_TO_PACK" | while read -r project; do
[ -z "$project" ] && continue # Skip if empty
dotnet pack "$project" --no-build --no-restore
done
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

<PropertyGroup>
<TargetFrameworks>$(_MauiDotNetTfm);$(MauiPlatforms)</TargetFrameworks>
<PackageId>Mali.AspNetCore.Components.WebView</PackageId>
<Nullable>enable</Nullable>
<Description>Build .NET MAUI applications with Blazor web UI in the BlazorWebView control.</Description>
<DefineConstants>$(DefineConstants);WEBVIEW2_MAUI</DefineConstants>
Expand Down
1 change: 1 addition & 0 deletions src/Compatibility/Core/src/Compatibility.csproj
10000
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<TargetFrameworks>netstandard2.1;netstandard2.0;$(_MauiDotNetTfm);$(MauiPlatforms)</TargetFrameworks>
<RootNamespace>Microsoft.Maui.Controls.Compatibility</RootNamespace>
<AssemblyName>Microsoft.Maui.Controls.Compatibility</AssemblyName>
<PackageId>Mali.Controls.Compatibility</PackageId>
<Nullable>disable</Nullable>
<AndroidRoot>Android\</AndroidRoot>
<iOSRoot>iOS\</iOSRoot>
Expand Down
1 change: 1 addition & 0 deletions src/Controls/Foldable/src/Controls.Foldable.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<TargetFrameworks>$(_MauiDotNetTfm);$(MauiPlatforms)</TargetFrameworks>
<AssemblyName>Microsoft.Maui.Controls.Foldable</AssemblyName>
<RootNamespace>Microsoft.Maui.Controls.Foldable</RootNamespace>
<PackageId>Mali.Controls.Foldable</PackageId>
<WarningsNotAsErrors>BI1234</WarningsNotAsErrors>
<IsTrimmable>false</IsTrimmable>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
Expand Down
2 changes: 1 addition & 1 deletion src/Controls/src/Core/Controls.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFrameworks>netstandard2.1;netstandard2.0;$(_MauiDotNetTfm);$(MauiPlatforms)</TargetFrameworks>
<RootNamespace>Microsoft.Maui.Controls</RootNamespace>
<AssemblyName>Microsoft.Maui.Controls</AssemblyName>
<PackageId>Microsoft.Maui.Controls.Core</PackageId>
<PackageId>Mali.Controls.Core</PackageId>
<Nullable>enable</Nullable>
<IsPackable>true</IsPackable>
<IsTrimmable>false</IsTrimmable>
Expand Down
2 changes: 1 addition & 1 deletion src/Controls/src/Xaml/Controls.Xaml.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
<TargetFrameworks>netstandard2.1;netstandard2.0;$(_MauiDotNetTfm);$(MauiPlatforms)</TargetFrameworks>
<AssemblyName>M 57AE icrosoft.Maui.Controls.Xaml</AssemblyName>
<RootNamespace>Microsoft.Maui.Controls.Xaml</RootNamespace>
<PackageId>Mali.Controls.Xaml</PackageId>
<IsPackable>true</IsPackable>
<IsTrimmable>false</IsTrimmable>
<_MauiDesignDllBuild Condition=" '$(OS)' != 'Unix' ">True</_MauiDesignDllBuild>
<NoWarn>$(NoWarn);CA2200;CS1591;RS0041</NoWarn>
<PackageId>Microsoft.Maui.Controls.Xaml</PackageId>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/Core/src/Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFrameworks>netstandard2.1;netstandard2.0;$(_MauiDotNetTfm);$(MauiPlatforms)</TargetFrameworks>
<RootNamespace>Microsoft.Maui</RootNamespace>
<AssemblyName>Microsoft.Maui</AssemblyName>
<PackageId>Microsoft.Maui.Core</PackageId>
<PackageId>Mali.Core</PackageId>
<Nullable>enable</Nullable>
<IsPackable>true</IsPackable>
<IsTrimmable>false</IsTrimmable>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
<UsingMicrosoftMauiCoreSdk>true</UsingMicrosoftMauiCoreSdk>
</PropertyGroup>

<Import Project="$(MSBuildThisFileDirectory)Microsoft.Maui.Core.Before.targets" />
<Import Project="$(MSBuildThisFileDirectory)Mali.Core.Before.targets" />

<PropertyGroup>
<AfterMicrosoftNETSdkTargets>$(AfterMicrosoftNETSdkTargets);$(MSBuildThisFileDirectory)Microsoft.Maui.Core.After.targets</AfterMicrosoftNETSdkTargets>
<AfterMicrosoftNETSdkTargets>$(AfterMicrosoftNETSdkTargets);$(MSBuildThisFileDirectory)Mali.Core.After.targets</AfterMicrosoftNETSdkTargets>
</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
<WinUISDKReferences Condition=" '$(WinUISDKReferences)' == '' and '$(EnableMsixTooling)' == 'true' ">false</WinUISDKReferences>
</PropertyGroup>

<Import Project="$(MSBuildThisFileDirectory)..\Microsoft.Maui.Core.props" />
<Import Project="$(MSBuildThisFileDirectory)..\Mali.Core.props" />

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<Project>

<Import Project="$(MSBuildThisFileDirectory)..\Mali.Core.targets" />

</Project>

This file was deleted.

DE4F 1 change: 1 addition & 0 deletions src/Essentials/src/Essentials.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<TargetFrameworks>netstandard2.1;netstandard2.0;$(_MauiDotNetTfm);$(MauiPlatforms)</TargetFrameworks>
<AssemblyName>Microsoft.Maui.Essentials</AssemblyName>
<RootNamespace>Microsoft.Maui.Essentials</RootNamespace>
<PackageId>Mali.Essentials</PackageId>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
<WarningsNotAsErrors>BI1234</WarningsNotAsErrors>
<IsPackable>true</IsPackable>
Expand Down
2 changes: 1 addition & 1 deletion src/Graphics/src/Graphics/Graphics.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<AssemblyName>Microsoft.Maui.Graphics</AssemblyName>
<RootNamespace>Microsoft.Maui.Graphics</RootNamespace>
<PackageId>Microsoft.Maui.Graphics</PackageId>
<PackageId>Mali.Graphics</PackageId>
<Product>Microsoft.Maui.Graphics</Product>
<IsTrimmable>false</IsTrimmable>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
Expand Down
Loading
0