mirror of
https://github.com/Radarr/Radarr.git
synced 2024-10-05 15:47:20 +02:00
New: Musl (alpine linux) compatibility
This commit is contained in:
parent
75eb4e8519
commit
7722c50603
@ -101,6 +101,10 @@ stages:
|
|||||||
artifact: LinuxCoreTests
|
artifact: LinuxCoreTests
|
||||||
displayName: Publish Linux Test Package
|
displayName: Publish Linux Test Package
|
||||||
condition: and(succeeded(), eq(variables['osName'], 'Windows'))
|
condition: and(succeeded(), eq(variables['osName'], 'Windows'))
|
||||||
|
- publish: '$(testsFolder)/netcoreapp3.1/linux-musl-x64/publish'
|
||||||
|
artifact: LinuxMuslCoreTests
|
||||||
|
displayName: Publish Linux Musl Test Package
|
||||||
|
condition: and(succeeded(), eq(variables['osName'], 'Windows'))
|
||||||
- publish: '$(testsFolder)/netcoreapp3.1/osx-x64/publish'
|
- publish: '$(testsFolder)/netcoreapp3.1/osx-x64/publish'
|
||||||
artifact: MacCoreTests
|
artifact: MacCoreTests
|
||||||
displayName: Publish MacOS Test Package
|
displayName: Publish MacOS Test Package
|
||||||
@ -243,6 +247,14 @@ stages:
|
|||||||
tarCompression: 'gz'
|
tarCompression: 'gz'
|
||||||
includeRootFolder: false
|
includeRootFolder: false
|
||||||
rootFolderOrFile: $(artifactsFolder)/linux-x64/netcoreapp3.1
|
rootFolderOrFile: $(artifactsFolder)/linux-x64/netcoreapp3.1
|
||||||
|
- task: ArchiveFiles@2
|
||||||
|
displayName: Create Linux Musl Core tar
|
||||||
|
inputs:
|
||||||
|
archiveFile: '$(Build.ArtifactStagingDirectory)/Radarr.$(buildName).linux-musl-core-x64.tar.gz'
|
||||||
|
archiveType: 'tar'
|
||||||
|
tarCompression: 'gz'
|
||||||
|
includeRootFolder: false
|
||||||
|
rootFolderOrFile: $(artifactsFolder)/linux-musl-x64/netcoreapp3.1
|
||||||
- task: ArchiveFiles@2
|
- task: ArchiveFiles@2
|
||||||
displayName: Create ARM32 Linux Core tar
|
displayName: Create ARM32 Linux Core tar
|
||||||
inputs:
|
inputs:
|
||||||
@ -259,6 +271,14 @@ stages:
|
|||||||
tarCompression: 'gz'
|
tarCompression: 'gz'
|
||||||
includeRootFolder: false
|
includeRootFolder: false
|
||||||
rootFolderOrFile: $(artifactsFolder)/linux-arm64/netcoreapp3.1
|
rootFolderOrFile: $(artifactsFolder)/linux-arm64/netcoreapp3.1
|
||||||
|
- task: ArchiveFiles@2
|
||||||
|
displayName: Create ARM64 Linux Musl Core tar
|
||||||
|
inputs:
|
||||||
|
archiveFile: '$(Build.ArtifactStagingDirectory)/Radarr.$(buildName).linux-musl-core-arm64.tar.gz'
|
||||||
|
archiveType: 'tar'
|
||||||
|
tarCompression: 'gz'
|
||||||
|
includeRootFolder: false
|
||||||
|
rootFolderOrFile: $(artifactsFolder)/linux-musl-arm64/netcoreapp3.1
|
||||||
- publish: $(Build.ArtifactStagingDirectory)
|
- publish: $(Build.ArtifactStagingDirectory)
|
||||||
artifact: 'Packages'
|
artifact: 'Packages'
|
||||||
displayName: Publish Packages
|
displayName: Publish Packages
|
||||||
@ -384,16 +404,24 @@ stages:
|
|||||||
matrix:
|
matrix:
|
||||||
mono508:
|
mono508:
|
||||||
testName: 'Mono 5.8'
|
testName: 'Mono 5.8'
|
||||||
|
artifactName: LinuxTests
|
||||||
containerImage: servarr/testimages:mono-5.8
|
containerImage: servarr/testimages:mono-5.8
|
||||||
mono520:
|
mono520:
|
||||||
testName: 'Mono 5.20'
|
testName: 'Mono 5.20'
|
||||||
|
artifactName: LinuxTests
|
||||||
containerImage: servarr/testimages:mono-5.20
|
containerImage: servarr/testimages:mono-5.20
|
||||||
mono610:
|
mono610:
|
||||||
testName: 'Mono 6.10'
|
testName: 'Mono 6.10'
|
||||||
|
artifactName: LinuxTests
|
||||||
containerImage: servarr/testimages:mono-6.10
|
containerImage: servarr/testimages:mono-6.10
|
||||||
mono612:
|
mono612:
|
||||||
testName: 'Mono 6.12'
|
testName: 'Mono 6.12'
|
||||||
|
artifactName: LinuxTests
|
||||||
containerImage: servarr/testimages:mono-6.12
|
containerImage: servarr/testimages:mono-6.12
|
||||||
|
alpine:
|
||||||
|
testName: 'Musl Net Core'
|
||||||
|
artifactName: LinuxMuslCoreTests
|
||||||
|
containerImage: servarr/testimages:alpine
|
||||||
|
|
||||||
pool:
|
pool:
|
||||||
vmImage: 'ubuntu-18.04'
|
vmImage: 'ubuntu-18.04'
|
||||||
@ -403,8 +431,6 @@ stages:
|
|||||||
timeoutInMinutes: 10
|
timeoutInMinutes: 10
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- bash: mono --version
|
|
||||||
displayName: Check Mono version
|
|
||||||
- task: UseDotNet@2
|
- task: UseDotNet@2
|
||||||
displayName: 'Install .net core'
|
displayName: 'Install .net core'
|
||||||
inputs:
|
inputs:
|
||||||
@ -414,10 +440,14 @@ stages:
|
|||||||
displayName: Download Test Artifact
|
displayName: Download Test Artifact
|
||||||
inputs:
|
inputs:
|
||||||
buildType: 'current'
|
buildType: 'current'
|
||||||
artifactName: LinuxTests
|
artifactName: $(artifactName)
|
||||||
targetPath: $(testsFolder)
|
targetPath: $(testsFolder)
|
||||||
|
- bash: find ${TESTSFOLDER} -name "Radarr.Test.Dummy" -exec chmod a+x {} \;
|
||||||
|
displayName: Make Test Dummy Executable
|
||||||
|
condition: and(succeeded(), ne(variables['osName'], 'Windows'))
|
||||||
- bash: |
|
- bash: |
|
||||||
chmod a+x ${TESTSFOLDER}/test.sh
|
chmod a+x ${TESTSFOLDER}/test.sh
|
||||||
|
ls -lR ${TESTSFOLDER}
|
||||||
${TESTSFOLDER}/test.sh Linux Unit Test
|
${TESTSFOLDER}/test.sh Linux Unit Test
|
||||||
displayName: Run Tests
|
displayName: Run Tests
|
||||||
- task: PublishTestResults@2
|
- task: PublishTestResults@2
|
||||||
@ -527,20 +557,29 @@ stages:
|
|||||||
matrix:
|
matrix:
|
||||||
mono508:
|
mono508:
|
||||||
testName: 'Mono 5.8'
|
testName: 'Mono 5.8'
|
||||||
|
artifactName: LinuxTests
|
||||||
containerImage: servarr/testimages:mono-5.8
|
containerImage: servarr/testimages:mono-5.8
|
||||||
|
pattern: 'Radarr.**.linux.tar.gz'
|
||||||
mono520:
|
mono520:
|
||||||
testName: 'Mono 5.20'
|
testName: 'Mono 5.20'
|
||||||
|
artifactName: LinuxTests
|
||||||
containerImage: servarr/testimages:mono-5.20
|
containerImage: servarr/testimages:mono-5.20
|
||||||
|
pattern: 'Radarr.**.linux.tar.gz'
|
||||||
mono610:
|
mono610:
|
||||||
testName: 'Mono 6.10'
|
testName: 'Mono 6.10'
|
||||||
|
artifactName: LinuxTests
|
||||||
containerImage: servarr/testimages:mono-6.10
|
containerImage: servarr/testimages:mono-6.10
|
||||||
|
pattern: 'Radarr.**.linux.tar.gz'
|
||||||
mono612:
|
mono612:
|
||||||
testName: 'Mono 6.12'
|
testName: 'Mono 6.12'
|
||||||
|
artifactName: LinuxTests
|
||||||
containerImage: servarr/testimages:mono-6.12
|
containerImage: servarr/testimages:mono-6.12
|
||||||
|
pattern: 'Radarr.**.linux.tar.gz'
|
||||||
variables:
|
alpine:
|
||||||
pattern: 'Radarr.**.linux.tar.gz'
|
testName: 'Musl Net Core'
|
||||||
|
artifactName: LinuxCoreTests
|
||||||
|
containerImage: servarr/testimages:alpine
|
||||||
|
pattern: 'Radarr.**.linux-musl-core-x64.tar.gz'
|
||||||
pool:
|
pool:
|
||||||
vmImage: 'ubuntu-18.04'
|
vmImage: 'ubuntu-18.04'
|
||||||
|
|
||||||
@ -549,8 +588,6 @@ stages:
|
|||||||
timeoutInMinutes: 15
|
timeoutInMinutes: 15
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- bash: mono --version
|
|
||||||
displayName: Check Mono version
|
|
||||||
- task: UseDotNet@2
|
- task: UseDotNet@2
|
||||||
displayName: 'Install .net core'
|
displayName: 'Install .net core'
|
||||||
inputs:
|
inputs:
|
||||||
@ -560,7 +597,7 @@ stages:
|
|||||||
displayName: Download Test Artifact
|
displayName: Download Test Artifact
|
||||||
inputs:
|
inputs:
|
||||||
buildType: 'current'
|
buildType: 'current'
|
||||||
artifactName: LinuxTests
|
artifactName: $(artifactName)
|
||||||
targetPath: $(testsFolder)
|
targetPath: $(testsFolder)
|
||||||
- task: DownloadPipelineArtifact@2
|
- task: DownloadPipelineArtifact@2
|
||||||
displayName: Download Build Artifact
|
displayName: Download Build Artifact
|
||||||
|
3
build.sh
3
build.sh
@ -319,6 +319,7 @@ then
|
|||||||
then
|
then
|
||||||
PackageTests "netcoreapp3.1" "win-x64"
|
PackageTests "netcoreapp3.1" "win-x64"
|
||||||
PackageTests "netcoreapp3.1" "linux-x64"
|
PackageTests "netcoreapp3.1" "linux-x64"
|
||||||
|
PackageTests "netcoreapp3.1" "linux-musl-x64"
|
||||||
PackageTests "netcoreapp3.1" "osx-x64"
|
PackageTests "netcoreapp3.1" "osx-x64"
|
||||||
PackageTests "net462" "linux-x64"
|
PackageTests "net462" "linux-x64"
|
||||||
else
|
else
|
||||||
@ -350,7 +351,9 @@ then
|
|||||||
then
|
then
|
||||||
Package "netcoreapp3.1" "win-x64"
|
Package "netcoreapp3.1" "win-x64"
|
||||||
Package "netcoreapp3.1" "linux-x64"
|
Package "netcoreapp3.1" "linux-x64"
|
||||||
|
Package "netcoreapp3.1" "linux-musl-x64"
|
||||||
Package "netcoreapp3.1" "linux-arm64"
|
Package "netcoreapp3.1" "linux-arm64"
|
||||||
|
Package "netcoreapp3.1" "linux-musl-arm64"
|
||||||
Package "netcoreapp3.1" "linux-arm"
|
Package "netcoreapp3.1" "linux-arm"
|
||||||
Package "netcoreapp3.1" "osx-x64"
|
Package "netcoreapp3.1" "osx-x64"
|
||||||
Package "net462" "linux-x64"
|
Package "net462" "linux-x64"
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
|
|
||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
|
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
|
||||||
<RuntimeIdentifiers>win-x64;osx-x64;linux-x64;linux-arm;linux-arm64</RuntimeIdentifiers>
|
<RuntimeIdentifiers>win-x64;osx-x64;linux-x64;linux-musl-x64;linux-arm;linux-arm64;linux-musl-arm64</RuntimeIdentifiers>
|
||||||
<ExcludedRuntimeFrameworkPairs>win-x64:net462;osx-x64:net462;linux-arm:net462;linux-arm64:net462</ExcludedRuntimeFrameworkPairs>
|
<ExcludedRuntimeFrameworkPairs>win-x64:net462;osx-x64:net462;linux-arm:net462;linux-arm64:net462;linux-musl-x64:net462;linux-musl-arm64:net462</ExcludedRuntimeFrameworkPairs>
|
||||||
|
|
||||||
<RadarrRootDir>$(MSBuildThisFileDirectory)..\</RadarrRootDir>
|
<RadarrRootDir>$(MSBuildThisFileDirectory)..\</RadarrRootDir>
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NLog;
|
using NLog;
|
||||||
@ -11,7 +12,7 @@ public class OsInfo : IOsInfo
|
|||||||
public static Os Os { get; }
|
public static Os Os { get; }
|
||||||
|
|
||||||
public static bool IsNotWindows => !IsWindows;
|
public static bool IsNotWindows => !IsWindows;
|
||||||
public static bool IsLinux => Os == Os.Linux;
|
public static bool IsLinux => Os == Os.Linux || Os == Os.LinuxMusl || Os == Os.Bsd;
|
||||||
public static bool IsOsx => Os == Os.Osx;
|
public static bool IsOsx => Os == Os.Osx;
|
||||||
public static bool IsWindows => Os == Os.Windows;
|
public static bool IsWindows => Os == Os.Windows;
|
||||||
|
|
||||||
@ -37,18 +38,7 @@ static OsInfo()
|
|||||||
case PlatformID.MacOSX:
|
case PlatformID.MacOSX:
|
||||||
case PlatformID.Unix:
|
case PlatformID.Unix:
|
||||||
{
|
{
|
||||||
// Sometimes Mac OS reports itself as Unix
|
Os = GetPosixFlavour();
|
||||||
if (Directory.Exists("/System/Library/CoreServices/") &&
|
|
||||||
(File.Exists("/System/Library/CoreServices/SystemVersion.plist") ||
|
|
||||||
File.Exists("/System/Library/CoreServices/ServerVersion.plist")))
|
|
||||||
{
|
|
||||||
Os = Os.Osx;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Os = Os.Linux;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -92,6 +82,48 @@ public OsInfo(IEnumerable<IOsVersionAdapter> versionAdapters, Logger logger)
|
|||||||
IsDocker = true;
|
IsDocker = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static Os GetPosixFlavour()
|
||||||
|
{
|
||||||
|
var output = RunAndCapture("uname", "-s");
|
||||||
|
|
||||||
|
if (output.StartsWith("Darwin"))
|
||||||
|
{
|
||||||
|
return Os.Osx;
|
||||||
|
}
|
||||||
|
else if (output.Contains("BSD"))
|
||||||
|
{
|
||||||
|
return Os.Bsd;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return IsMusl() ? Os.LinuxMusl : Os.Linux;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool IsMusl()
|
||||||
|
{
|
||||||
|
var output = RunAndCapture("ldd", "/bin/ls");
|
||||||
|
return output.Contains("libc.musl");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string RunAndCapture(string filename, string args)
|
||||||
|
{
|
||||||
|
Process p = new Process();
|
||||||
|
p.StartInfo.FileName = filename;
|
||||||
|
p.StartInfo.Arguments = args;
|
||||||
|
p.StartInfo.UseShellExecute = false;
|
||||||
|
p.StartInfo.CreateNoWindow = true;
|
||||||
|
p.StartInfo.RedirectStandardOutput = true;
|
||||||
|
|
||||||
|
p.Start();
|
||||||
|
|
||||||
|
// To avoid deadlocks, always read the output stream first and then wait.
|
||||||
|
string output = p.StandardOutput.ReadToEnd();
|
||||||
|
p.WaitForExit(1000);
|
||||||
|
|
||||||
|
return output;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface IOsInfo
|
public interface IOsInfo
|
||||||
@ -106,6 +138,8 @@ public enum Os
|
|||||||
{
|
{
|
||||||
Windows,
|
Windows,
|
||||||
Linux,
|
Linux,
|
||||||
Osx
|
Osx,
|
||||||
|
LinuxMusl,
|
||||||
|
Bsd
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
-->
|
-->
|
||||||
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1'">
|
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1'">
|
||||||
<PackageReference Include="coverlet.collector" Version="1.2.1" PrivateAssets="all" />
|
<PackageReference Include="coverlet.collector" Version="1.2.1" PrivateAssets="all" />
|
||||||
<PackageReference Include="Mono.Posix.NETStandard" Version="1.0.0" />
|
<PackageReference Include="Mono.Posix.NETStandard" Version="5.20.1-preview" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\NzbDrone.Common.Test\Radarr.Common.Test.csproj" />
|
<ProjectReference Include="..\NzbDrone.Common.Test\Radarr.Common.Test.csproj" />
|
||||||
@ -28,5 +28,5 @@
|
|||||||
<None Update="Files\**\*.*">
|
<None Update="Files\**\*.*">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
See https://github.com/xamarin/XamarinComponents/issues/282
|
See https://github.com/xamarin/XamarinComponents/issues/282
|
||||||
-->
|
-->
|
||||||
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1'">
|
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1'">
|
||||||
<PackageReference Include="Mono.Posix.NETStandard" Version="1.0.0" />
|
<PackageReference Include="Mono.Posix.NETStandard" Version="5.20.1-preview" />
|
||||||
<PackageReference Include="System.IO.FileSystem.AccessControl" Version="4.7.0" />
|
<PackageReference Include="System.IO.FileSystem.AccessControl" Version="4.7.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
BIN
src/Runtimes/linux-musl-x64/libMonoPosixHelper.so
Normal file
BIN
src/Runtimes/linux-musl-x64/libMonoPosixHelper.so
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user