Skip to content

Commit 6555c30

Browse files
authored
Merge branch 'unoplatform:main' into docs-adding-skip-details
2 parents 9f9160e + 1b2a989 commit 6555c30

9 files changed

Lines changed: 192 additions & 16 deletions

File tree

.github/workflows/ci.yml

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,11 @@ jobs:
415415
name: Sign Package
416416
if: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/')) }}
417417
runs-on: windows-latest
418+
environment: PackageSign
419+
420+
permissions:
421+
id-token: write # Required for requesting the JWT
422+
418423
needs:
419424
- build_tool
420425
steps:
@@ -430,16 +435,34 @@ jobs:
430435
- name: Setup .NET SDK
431436
uses: actions/setup-dotnet@v1
432437
with:
433-
dotnet-version: '3.1.x'
438+
dotnet-version: '9.0.x'
434439

435-
- name: Setup SignClient
436-
run: |
437-
dotnet tool install --tool-path build SignClient
440+
# Install the code signing tool
441+
- name: Install Sign CLI tool
442+
run: dotnet tool install --tool-path . sign --version 0.9.1-beta.25278.1
443+
444+
# Login to Azure using a ServicePrincipal configured to authenticate agaist a GitHub Action
445+
- name: 'Az CLI login'
446+
uses: azure/login@v1
447+
with:
448+
allow-no-subscriptions: true
449+
client-id: ${{ secrets.SIGN_AZURE_CLIENT_ID }}
450+
tenant-id: ${{ secrets.SIGN_AZURE_TENANT_ID }}
451+
subscription-id: ${{ secrets.SIGN_AZURE_SUBSCRIPTION_ID }}
438452

439-
- name: SignClient
453+
# Run the signing command
454+
- name: Sign artifacts
440455
shell: pwsh
441-
run: |
442-
build\SignClient sign -i artifacts\NuGet\*.nupkg -c build\SignClient.json -r "${{ secrets.UNO_PLATFORM_CODESIGN_USERNAME }}" -s "${{ secrets.UNO_PLATFORM_CODESIGN_SECRET }}" -n "Uno.Check" -d "Uno.Check" -u "https://github.com/unoplatform/uno.check"
456+
run: >
457+
./sign code azure-key-vault
458+
artifacts\NuGet\*.nupkg
459+
--publisher-name "Uno.Check"
460+
--description "Uno.Check"
461+
--description-url "https://github.com/${{ env.GITHUB_REPOSITORY }}"
462+
--azure-key-vault-managed-identity true
463+
--azure-key-vault-url "${{ secrets.SIGN_KEY_VAULT_URL }}"
464+
--azure-key-vault-certificate "${{ secrets.SIGN_KEY_VAULT_CERTIFICATE_ID }}"
465+
--verbosity information
443466
444467
- name: Upload Signed Artifacts
445468
uses: actions/upload-artifact@v4

UnoCheck/Checkups/DotNetWorkloadsCheckup.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ public override async Task<DiagnosticResult> Examine(SharedState history)
159159
}
160160

161161
await genericWorkloadManager.Install(RequiredWorkloads);
162+
history.ContributeState(StateKey.EntryPoint, StateKey.ShouldRestartVs, true);
162163
})));
163164
}
164165
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
using System;
2+
using System.Diagnostics;
3+
using System.Threading.Tasks;
4+
using DotNetCheck.Models;
5+
6+
namespace DotNetCheck.Checkups
7+
{
8+
public class VSRestartCheckup : Checkup
9+
{
10+
public override bool IsPlatformSupported(Platform platform)
11+
=> platform == Platform.Windows;
12+
13+
public override string Id => "vsrestart";
14+
15+
public override string Title => "Visual Studio Restart Check";
16+
17+
public override bool ShouldExamine(SharedState history)
18+
{
19+
return history.TryGetState<bool>(StateKey.EntryPoint, StateKey.ShouldRestartVs, out var shouldRestartVs) && shouldRestartVs;
20+
}
21+
22+
public override Task<DiagnosticResult> Examine(SharedState history)
23+
{
24+
const string visualStudioProcessName = "devenv";
25+
try
26+
{
27+
var vsProcesses = Process.GetProcessesByName(visualStudioProcessName);
28+
29+
if (vsProcesses.Length > 0)
30+
{
31+
ReportStatus("Visual Studio is currently running", Status.Warning);
32+
return Task.FromResult(new DiagnosticResult(
33+
Status.Warning,
34+
this,
35+
new Suggestion(
36+
"Restart Visual Studio",
37+
"Some checks requires that Visual Studio be restarted to take effect")));
38+
}
39+
}
40+
catch (Exception ex)
41+
{
42+
Util.Exception(ex);
43+
}
44+
45+
return Task.FromResult(DiagnosticResult.Ok(this));
46+
}
47+
}
48+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using DotNetCheck.Models;
2+
using System.Collections.Generic;
3+
4+
namespace DotNetCheck.Checkups
5+
{
6+
public class VSRestartCheckupContributor : CheckupContributor
7+
{
8+
public override IEnumerable<Checkup> Contribute(Manifest.Manifest manifest, SharedState sharedState)
9+
{
10+
// Only contribute if we're on Windows
11+
if (Util.IsWindows)
12+
{
13+
yield return new VSRestartCheckup();
14+
}
15+
}
16+
}
17+
}

UnoCheck/Models/StateKey.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,7 @@ public static class StateKey
1111
public const string Skips = "Skips";
1212

1313
public const string TargetPlatforms = "target_platforms";
14+
15+
public const string ShouldRestartVs = "ShouldRestartVS";
1416
}
1517
}

UnoCheck/Program.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ static Task<int> Main(string[] args)
3939
);
4040

4141
CheckupManager.RegisterCheckupContributors(
42-
new DotNetSdkCheckupContributor());
42+
new DotNetSdkCheckupContributor(),
43+
new VSRestartCheckupContributor()
44+
);
4345

4446
CheckupManager.RegisterCheckups(
4547
new PSExecutionPolicyCheckup(),

UnoCheck/Solutions/MsInstallerSolution.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ await Policy
9292
if (r.ExitCode == 0)
9393
{
9494
ReportStatus($"Installed {Title ?? Url.ToString()}.");
95+
sharedState.ContributeState(StateKey.EntryPoint, StateKey.ShouldRestartVs, true);
9596
}
9697
else
9798
{

UnoCheck/ToolUpdater.cs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -103,26 +103,29 @@ private static void PerformUpdateAndRelaunch(string version, string argsForRelau
103103

104104
Process.Start(new ProcessStartInfo("cmd.exe", $"/C {cmdText}")
105105
{
106-
UseShellExecute = true,
107-
CreateNoWindow = true,
106+
UseShellExecute = true,
107+
CreateNoWindow = true,
108108
WindowStyle = ProcessWindowStyle.Hidden
109109
});
110110
}
111111
else
112112
{
113113
var shCommand =
114-
$"sleep 2 && " +
114+
$"sleep 1 && " +
115115
$"dotnet tool update --global {ToolInfo.ToolPackageId} --version {version} " +
116-
$"&& {ToolInfo.ToolCommand} {argsForRelaunch}";
117-
var full = $"nohup sh -c \"{shCommand}\" >/dev/null 2>&1 &";
116+
$"&& {ToolInfo.ToolCommand} {argsForRelaunch}".Trim();
118117

119-
Process.Start(new ProcessStartInfo("/bin/sh", $"-c \"{full}\"")
118+
var full = $"\"{shCommand} 2>&1\"";
119+
120+
Process.Start(new ProcessStartInfo("/bin/sh", $"-c {full}")
120121
{
121-
UseShellExecute = false,
122-
CreateNoWindow = true,
122+
UseShellExecute = false,
123+
CreateNoWindow = true,
123124
WindowStyle = ProcessWindowStyle.Hidden
124125
});
125126
}
127+
128+
AnsiConsole.MarkupLine($"[bold green]{Icon.Thinking} Update command executed. Relaunching uno-check...[/]");
126129

127130
Environment.Exit(0);
128131
}

install_locally.sh

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
#!/usr/bin/env bash
2+
#------------------------------------------------------------------------------
3+
# Pack a .NET solution (or current folder), generate a LocalOnly.NuGet.Config
4+
# inside the feed directory (so it won't affect the solution), and install
5+
# (or reinstall) the Uno.Check global tool from that feed.
6+
#
7+
# Usage:
8+
# ./pack-and-install.sh [Solution] [LocalFeed]
9+
#
10+
# Solution: Optional path to a .sln file or project folder.
11+
# If omitted, dotnet pack runs on the current directory.
12+
# LocalFeed: Optional directory to emit nupkg files into.
13+
# If omitted, defaults to 'LocalFeed' in the script folder.
14+
#------------------------------------------------------------------------------
15+
16+
set -euo pipefail
17+
18+
PackageId="Uno.Check"
19+
20+
# Determine script directory
21+
scriptDir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
22+
cd "$scriptDir"
23+
24+
Solution="${1:-}"
25+
LocalFeed="${2:-}"
26+
27+
if [[ -z "$Solution" ]]; then
28+
echo "No solution specified → packing current directory"
29+
packTarget="."
30+
else
31+
packTarget="$Solution"
32+
fi
33+
34+
if [[ -z "$LocalFeed" ]]; then
35+
LocalFeed="LocalFeed"
36+
echo "No feed directory specified → using default '$LocalFeed'"
37+
fi
38+
39+
# Ensure feed directory exists
40+
if [[ ! -d "$LocalFeed" ]]; then
41+
echo "Creating feed directory: $LocalFeed"
42+
mkdir -p "$LocalFeed"
43+
fi
44+
45+
echo "Packing '$packTarget' to '$LocalFeed'..."
46+
dotnet pack "$packTarget" -c Release -o "$LocalFeed"
47+
48+
# Place NuGet.Config inside the feed directory
49+
configFile="$LocalFeed/LocalOnly.NuGet.Config"
50+
feedUri="$(cd "$LocalFeed" && pwd)"
51+
52+
echo "Generating NuGet.Config at '$configFile'..."
53+
cat > "$configFile" <<EOF
54+
<?xml version="1.0" encoding="utf-8"?>
55+
<configuration>
56+
<packageSources>
57+
<!-- only your local folder -->
58+
<add key="LocalFeed" value="$feedUri" />
59+
</packageSources>
60+
</configuration>
61+
EOF
62+
63+
# If Uno.Check is already installed, uninstall it first
64+
if dotnet tool list --global | grep -q "^\s*$PackageId\s"; then
65+
echo "Detected existing installation of '$PackageId'. Uninstalling..."
66+
dotnet tool uninstall --global "$PackageId"
67+
fi
68+
69+
echo "Installing tool '$PackageId' using only '$configFile'..."
70+
dotnet tool install --global "$PackageId" \
71+
--configfile "$configFile" \
72+
--ignore-failed-sources
73+
74+
echo
75+
echo "Done. '$PackageId' is installed from your local feed."
76+
77+
# Prevent the script window from closing immediately
78+
echo
79+
read -p "Press Enter to exit..."

0 commit comments

Comments
 (0)