Browse Source

Merge branch 'main' into fix-version

pull/55/head
Ionite 1 year ago committed by GitHub
parent
commit
a833164abb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 55
      Jenkinsfile
  2. 42
      Jenkinsfile-linux
  3. 1
      StabilityMatrix.Avalonia/StabilityMatrix.Avalonia.csproj
  4. 4
      StabilityMatrix.Avalonia/ViewModels/Dialogs/OneClickInstallViewModel.cs
  5. 5
      StabilityMatrix.Core/Helper/SharedFolders.cs
  6. 1
      StabilityMatrix.Core/StabilityMatrix.Core.csproj
  7. 13
      StabilityMatrix.Tests/Models/InstalledPackageTests.cs
  8. 9
      StabilityMatrix.Tests/ReparsePoints/JunctionTests.cs
  9. 2
      StabilityMatrix.Tests/StabilityMatrix.Tests.csproj

55
Jenkinsfile vendored

@ -1,4 +1,4 @@
node("Windows") {
node("Diligence") {
def repoName = "StabilityMatrix"
def author = "ionite34"
def version = ""
@ -11,32 +11,41 @@ node("Windows") {
git branch: env.BRANCH_NAME, credentialsId: 'Ionite', url: "https://github.com/${author}/${repoName}.git"
}
stage('Test') {
bat "dotnet test StabilityMatrix.Tests"
}
try {
stage('Test') {
sh "dotnet test StabilityMatrix.Tests"
}
if (env.BRANCH_NAME == 'main') {
stage('Set Version') {
script {
if (env.TAG_NAME) {
version = env.TAG_NAME.replaceFirst(/^v/, '')
} else {
version = VersionNumber projectStartDate: '2023-06-21', versionNumberString: '${BUILDS_ALL_TIME}', worstResultForIncrement: 'SUCCESS'
if (env.BRANCH_NAME == 'main') {
stage('Set Version') {
script {
if (env.TAG_NAME) {
version = env.TAG_NAME.replaceFirst(/^v/, '')
} else {
version = VersionNumber projectStartDate: '2023-06-21', versionNumberString: '${BUILDS_ALL_TIME}', worstResultForIncrement: 'SUCCESS'
}
}
}
stage('Publish Windows') {
sh "dotnet publish ./StabilityMatrix.Avalonia/StabilityMatrix.Avalonia.csproj -c Release -o out -r win-x64 -p:PublishSingleFile=true -p:VersionPrefix=2.0.0 -p:VersionSuffix=${version} -p:IncludeNativeLibrariesForSelfExtract=true"
}
stage('Publish Linux') {
sh "/home/jenkins/.dotnet/tools/pupnet --runtime linux-x64 --kind appimage --app-version ${version} --clean -y"
}
stage ('Archive Artifacts') {
archiveArtifacts artifacts: 'out/*.exe', followSymlinks: false
archiveArtifacts artifacts: 'out/*.appimage', followSymlinks: false
}
}
stage('Publish') {
bat "dotnet publish .\\StabilityMatrix.Avalonia\\StabilityMatrix.Avalonia.csproj -c Release -o out -r win-x64 -p:PublishSingleFile=true -p:VersionPrefix=2.0.0 -p:VersionSuffix=${version} -p:IncludeNativeLibrariesForSelfExtract=true"
}
stage ('Archive Artifacts') {
archiveArtifacts artifacts: 'out/*.exe', followSymlinks: false
}
} else {
stage('Publish') {
bat "dotnet publish .\\StabilityMatrix.Avalonia\\StabilityMatrix.Avalonia.csproj -c Release -o out -r win-x64 -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true"
} finally {
stage('Cleanup') {
cleanWs()
}
}
}

42
Jenkinsfile-linux

@ -1,42 +0,0 @@
node("Diligence") {
def repoName = "StabilityMatrix"
def author = "ionite34"
def version = ""
stage('Clean') {
deleteDir()
}
stage('Checkout') {
git branch: env.BRANCH_NAME, credentialsId: 'Ionite', url: "https://github.com/${author}/${repoName}.git"
}
// stage('Test') {
// sh "dotnet test StabilityMatrix.Tests"
// }
if (env.BRANCH_NAME == 'main') {
stage('Set Version') {
script {
if (env.TAG_NAME) {
version = env.TAG_NAME.replaceFirst(/^v/, '')
} else {
version = VersionNumber projectStartDate: '2023-06-21', versionNumberString: '${BUILDS_ALL_TIME}', worstResultForIncrement: 'SUCCESS'
}
}
}
stage('Publish') {
sh "/home/jenkins/.dotnet/tools/pupnet --runtime linux-x64 --kind appimage --app-version ${version} --clean -y"
}
stage ('Archive Artifacts') {
archiveArtifacts artifacts: 'out/*.appimage', followSymlinks: false
}
} else {
stage('Publish') {
sh "/home/jenkins/.dotnet/tools/pupnet --runtime linux-x64 --kind appimage --clean -y"
}
}
}

1
StabilityMatrix.Avalonia/StabilityMatrix.Avalonia.csproj

@ -10,6 +10,7 @@
<ApplicationIcon>./Assets/Icon.ico</ApplicationIcon>
<Version>2.0.4-dev.1</Version>
<InformationalVersion>$(Version)</InformationalVersion>
<EnableWindowsTargeting>true</EnableWindowsTargeting>
</PropertyGroup>
<ItemGroup>

4
StabilityMatrix.Avalonia/ViewModels/Dialogs/OneClickInstallViewModel.cs

@ -106,7 +106,7 @@ public partial class OneClickInstallViewModel : ViewModelBase
SubHeaderText = "Getting latest version...";
var latestVersion = await SelectedPackage.GetLatestVersion();
SelectedPackage.InstallLocation =
Path.Combine(libraryDir, "Packages", SelectedPackage.DisplayName);
Path.Combine(libraryDir, "Packages", SelectedPackage.Name);
SelectedPackage.ConsoleOutput += (_, output) => SubSubHeaderText = output.Text;
await DownloadPackage(latestVersion);
@ -118,7 +118,7 @@ public partial class OneClickInstallViewModel : ViewModelBase
var installedPackage = new InstalledPackage
{
DisplayName = SelectedPackage.DisplayName,
LibraryPath = Path.Combine("Packages", SelectedPackage.DisplayName),
LibraryPath = Path.Combine("Packages", SelectedPackage.Name),
Id = Guid.NewGuid(),
PackageName = SelectedPackage.Name,
PackageVersion = latestVersion,

5
StabilityMatrix.Core/Helper/SharedFolders.cs

@ -1,4 +1,5 @@
using NLog;
using System.Globalization;
using NLog;
using StabilityMatrix.Core.Extensions;
using StabilityMatrix.Core.Helper.Factory;
using StabilityMatrix.Core.Models;
@ -30,6 +31,8 @@ public class SharedFolders : ISharedFolders
}
else
{
// Create parent directory if it doesn't exist, since CreateSymbolicLink doesn't seem to
new DirectoryPath(junctionDir).Parent?.Create();
Directory.CreateSymbolicLink(junctionDir, targetDir);
}
}

1
StabilityMatrix.Core/StabilityMatrix.Core.csproj

@ -6,6 +6,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
<EnableWindowsTargeting>true</EnableWindowsTargeting>
</PropertyGroup>
<ItemGroup>

13
StabilityMatrix.Tests/Models/InstalledPackageTests.cs

@ -1,4 +1,5 @@
using StabilityMatrix.Core.Models;
using System.Runtime.InteropServices;
using StabilityMatrix.Core.Models;
namespace StabilityMatrix.Tests.Models;
@ -12,6 +13,16 @@ public class InstalledPackageTests
[DataRow("C:\\User\\AppData\\StabilityMatrix", "C:\\User\\AppData\\StabilityMatrix\\Packages\\abc", "Packages\\abc")]
public void TestGetSubPath(string relativeTo, string path, string? expected)
{
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
relativeTo = relativeTo.Replace("C:\\", $"{Path.DirectorySeparatorChar}")
.Replace('\\', Path.DirectorySeparatorChar);
path = path.Replace("C:\\", $"{Path.DirectorySeparatorChar}")
.Replace('\\', Path.DirectorySeparatorChar);
expected = expected?.Replace("C:\\", $"{Path.DirectorySeparatorChar}")
.Replace('\\', Path.DirectorySeparatorChar);
}
var result = InstalledPackage.GetSubPath(relativeTo, path);
Assert.AreEqual(expected, result);
}

9
StabilityMatrix.Tests/ReparsePoints/JunctionTests.cs

@ -1,4 +1,5 @@
using StabilityMatrix.Core.ReparsePoints;
using System.Runtime.InteropServices;
using StabilityMatrix.Core.ReparsePoints;
namespace StabilityMatrix.Tests.ReparsePoints;
@ -13,6 +14,12 @@ public class JunctionTest
[TestInitialize]
public void Initialize()
{
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
Assert.Inconclusive("Test cannot be run on anything but Windows currently.");
return;
}
tempFolder = Path.GetTempFileName();
File.Delete(tempFolder);
Directory.CreateDirectory(tempFolder);

2
StabilityMatrix.Tests/StabilityMatrix.Tests.csproj

@ -5,7 +5,7 @@
<RuntimeIdentifiers>win-x64;linux-x64;osx-x64;osx-arm64</RuntimeIdentifiers>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<EnableWindowsTargeting>true</EnableWindowsTargeting>
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
</PropertyGroup>

Loading…
Cancel
Save