-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into refactor-scubadiver
- Loading branch information
Showing
27 changed files
with
625 additions
and
297 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
name: Test | ||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
types: [opened, synchronize] | ||
paths: | ||
- '.github/workflows/test.yml' | ||
- '**/*.cs' | ||
- '**/*.sln' | ||
- '**/*.csproj' | ||
- '**/*.props' | ||
- '**/*.targets' | ||
- '**/packages.lock.json' | ||
workflow_dispatch: | ||
concurrency: | ||
group: ci-${{ github.workflow }} | ||
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | ||
jobs: | ||
test: | ||
runs-on: windows-latest | ||
name: "Run SDK Tests" | ||
timeout-minutes: 15 | ||
steps: | ||
# Creates a dev drive using ReFS. | ||
# | ||
# This step creates a 10GB VHDX file, mounts it, initializes the disk, | ||
# creates a partition, and formats the volume using ReFS. The drive letter | ||
# is stored in the DEV_DRIVE environment variable for later use. | ||
- name: Create dev drive using ReFS | ||
run: | | ||
$VHD_PATH = "${{ github.workspace }}/dev.vhdx" | ||
$Volume = New-VHD -Path $VHD_PATH -SizeBytes 10GB -Fixed | | ||
Mount-VHD -Passthru | | ||
Initialize-Disk -Passthru | | ||
New-Partition -AssignDriveLetter -UseMaximumSize | | ||
Format-Volume -FileSystem ReFS -Confirm:$false -Force | ||
Write-Output "WORKSPACE=$($Volume.DriveLetter):/workspace" >> $env:GITHUB_ENV | ||
# Checks out the repository to the dev drive. | ||
# | ||
# This is a patch of the actions/checkout action to allow for `path` to | ||
# point to another drive. By default, this is restricted to paths relative | ||
# to the $GITHUB_WORKSPACE directory, which is slower than a ReFS VHDX. | ||
- name: Checkout latest repository commit | ||
uses: Qonfused/checkout@4.2.2 | ||
with: | ||
path: ${{ env.WORKSPACE }} | ||
show-progress: false | ||
fetch-depth: 0 # Disable shallow clone for Nerdbank.GitVersioning | ||
|
||
# Setup the .NET environment | ||
- name: Install .NET Core | ||
uses: actions/setup-dotnet@v4 | ||
|
||
# Setup NuGet environment | ||
- name: Setup NuGet | ||
uses: NuGet/setup-nuget@v2 | ||
|
||
- name: Restore NuGet Cache | ||
id: nuget-cache | ||
uses: actions/cache@v4 | ||
with: | ||
path: ${{ env.WORKSPACE }}/packages | ||
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-nuget- | ||
- name: Restore NuGet packages | ||
if: steps.nuget-cache.outputs.cache-hit != 'true' | ||
run: | | ||
nuget restore ` | ||
-Verbosity quiet ` | ||
-NonInteractive -UseLockFile ` | ||
-OutputDirectory "${{ env.WORKSPACE }}/packages" | ||
working-directory: ${{ env.WORKSPACE }} | ||
|
||
# Build the SDK | ||
- name: Build SDK Solution | ||
run: dotnet build | ||
working-directory: ${{ env.WORKSPACE }} | ||
|
||
# Create .env file for integration tests | ||
- name: Create .env file | ||
run: | | ||
echo "USERNAME=${{ secrets.USERNAME }}" > .env | ||
echo "PASSWORD=${{ secrets.PASSWORD }}" >> .env | ||
working-directory: ${{ env.WORKSPACE }} | ||
|
||
# Run the test suite | ||
# | ||
# Run tests with a retry mechanism to handle transient test failures from | ||
# slow Windows runners. This is a workaround for intermittent crashes | ||
# caused by small Windows Server 2022 runners' service instability. | ||
- name: Run tests | ||
uses: nick-fields/retry@v3 | ||
with: | ||
timeout_minutes: 10 | ||
max_attempts: 3 | ||
command: dotnet test "${{ env.WORKSPACE }}" --no-build -clp:NoSummary |
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
!dist/ |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net48</TargetFramework> | ||
<LangVersion>Latest</LangVersion> | ||
<Nullable>enable</Nullable> | ||
<OutputType>Exe</OutputType> | ||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo> | ||
<AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects> | ||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies> | ||
<IsPackable>false</IsPackable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="FrameworkExtract.System.Deployment" /> | ||
</ItemGroup> | ||
|
||
<!-- Merge the Launcher executable with System.Deployment.dll --> | ||
<PropertyGroup> | ||
<ILRepackTargetsFile> | ||
$(MSBuildThisFileDirectory)..\ILRepack\ILRepack.targets | ||
</ILRepackTargetsFile> | ||
<ILRepackTarget>Launcher</ILRepackTarget> | ||
<ILRepackOutput>$(SolutionDir)dist\$(Configuration)\$(ILRepackTarget).exe</ILRepackOutput> | ||
</PropertyGroup> | ||
|
||
<Target Name="BuildArtifactDirectory" | ||
AfterTargets="AfterBuild;MergeReferenceAssemblies"> | ||
<Copy SourceFiles="$(OutputPath)Launcher.exe" | ||
DestinationFolder="$(MSBuildThisFileDirectory)\dist" /> | ||
<!-- Write a build timestamp to the dist/ directory --> | ||
<PropertyGroup> | ||
<BuildTimestamp>$([System.DateTime]::UtcNow.ToString("o"))</BuildTimestamp> | ||
</PropertyGroup> | ||
<WriteLinesToFile File="$(MSBuildThisFileDirectory)\dist\build.timestamp" | ||
Lines="$(BuildTimestamp)" | ||
Overwrite="true" /> | ||
</Target> | ||
|
||
</Project> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/** @file | ||
Copyright (c) 2024, Cory Bennett. All rights reserved. | ||
SPDX-License-Identifier: Apache-2.0 | ||
**/ | ||
|
||
using System; | ||
using System.Threading; | ||
using System.Deployment.Application; | ||
|
||
|
||
namespace Launcher; | ||
|
||
public class Program | ||
{ | ||
public static void Main(string[] args) | ||
{ | ||
try | ||
{ | ||
string manifestUri = args[0]; | ||
InPlaceHostingManager iphm = new(new Uri(manifestUri), false); | ||
AutoResetEvent waitHandle = new(false); | ||
|
||
// Download the deployment manifest. | ||
iphm.GetManifestCompleted += (sender, e) => | ||
{ | ||
if (e.Error != null) | ||
throw new Exception( | ||
"Could not download manifest. Error: " + e.Error.Message); | ||
|
||
waitHandle.Set(); | ||
}; | ||
iphm.GetManifestAsync(); | ||
waitHandle.WaitOne(); | ||
|
||
// Verify and grant permissions specified in the application manifest. | ||
iphm.AssertApplicationRequirements(true); | ||
|
||
// Download the deployment manifest. | ||
iphm.DownloadApplicationCompleted += (sender, e) => | ||
{ | ||
if (e.Error != null) | ||
throw new Exception( | ||
"Could not download application. Error: " + e.Error.Message); | ||
|
||
waitHandle.Set(); | ||
}; | ||
iphm.DownloadApplicationAsync(); | ||
waitHandle.WaitOne(); | ||
|
||
Environment.Exit(0); | ||
} | ||
catch (Exception ex) | ||
{ | ||
// Send the exception message to STDERR | ||
Console.Error.WriteLine(ex.Message); | ||
Environment.Exit(1); | ||
} | ||
} | ||
} |
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
2024-10-22T09:01:36.1196273Z |
Oops, something went wrong.