Skip to content

Commit

Permalink
Merge pull request #16 from OpenHD/dev/update
Browse files Browse the repository at this point in the history
Infrastructure update
  • Loading branch information
buldo authored Dec 7, 2023
2 parents af6194f + de95eb5 commit a348228
Show file tree
Hide file tree
Showing 26 changed files with 4,694 additions and 4,030 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/continuous.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Cache .nuke/temp, ~/.nuget/packages
- name: 'Cache: .nuke/temp, ~/.nuget/packages'
uses: actions/cache@v3
with:
path: |
.nuke/temp
~/.nuget/packages
key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj') }}
- name: Run './build.cmd Clean CloudsmithPublish'
key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj', '**/Directory.Packages.props') }}
- name: 'Run: Clean, CloudsmithPublish'
run: ./build.cmd Clean CloudsmithPublish
env:
CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }}
12 changes: 4 additions & 8 deletions .nuke/build.schema.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Build Schema",
"$ref": "#/definitions/build",
"title": "Build Schema",
"definitions": {
"build": {
"type": "object",
Expand Down Expand Up @@ -83,11 +83,9 @@
"Clean",
"CloudsmithPublish",
"DebPack",
"DownloadFfmpeg",
"PrepareForDebPack",
"Publish",
"Restore",
"UncompressFfmpeg"
"Restore"
]
}
},
Expand All @@ -104,11 +102,9 @@
"Clean",
"CloudsmithPublish",
"DebPack",
"DownloadFfmpeg",
"PrepareForDebPack",
"Publish",
"Restore",
"UncompressFfmpeg"
"Restore"
]
}
},
Expand All @@ -125,4 +121,4 @@
}
}
}
}
}
7 changes: 6 additions & 1 deletion build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ $TempDirectory = "$PSScriptRoot\\.nuke\temp"

$DotNetGlobalFile = "$PSScriptRoot\\global.json"
$DotNetInstallUrl = "https://dot.net/v1/dotnet-install.ps1"
$DotNetChannel = "Current"
$DotNetChannel = "STS"

$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE = 1
$env:DOTNET_CLI_TELEMETRY_OPTOUT = 1
Expand Down Expand Up @@ -65,5 +65,10 @@ else {

Write-Output "Microsoft (R) .NET SDK version $(& $env:DOTNET_EXE --version)"

if (Test-Path env:NUKE_ENTERPRISE_TOKEN) {
& $env:DOTNET_EXE nuget remove source "nuke-enterprise" > $null
& $env:DOTNET_EXE nuget add source "https://f.feedz.io/nuke/enterprise/nuget" --name "nuke-enterprise" --username "PAT" --password $env:NUKE_ENTERPRISE_TOKEN > $null
}

ExecSafe { & $env:DOTNET_EXE build $BuildProjectFile /nodeReuse:false /p:UseSharedCompilation=false -nologo -clp:NoSummary --verbosity quiet }
ExecSafe { & $env:DOTNET_EXE run --project $BuildProjectFile --no-build -- $BuildArguments }
9 changes: 8 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ SCRIPT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)

pip install --user cloudsmith-cli

###########################################################################

###########################################################################
# CONFIGURATION
###########################################################################
Expand All @@ -20,7 +22,7 @@ TEMP_DIRECTORY="$SCRIPT_DIR//.nuke/temp"

DOTNET_GLOBAL_FILE="$SCRIPT_DIR//global.json"
DOTNET_INSTALL_URL="https://dot.net/v1/dotnet-install.sh"
DOTNET_CHANNEL="latest"
DOTNET_CHANNEL="STS"

export DOTNET_CLI_TELEMETRY_OPTOUT=1
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
Expand Down Expand Up @@ -64,5 +66,10 @@ fi

echo "Microsoft (R) .NET SDK version $("$DOTNET_EXE" --version)"

if [[ ! -z ${NUKE_ENTERPRISE_TOKEN+x} && "$NUKE_ENTERPRISE_TOKEN" != "" ]]; then
"$DOTNET_EXE" nuget remove source "nuke-enterprise" &>/dev/null || true
"$DOTNET_EXE" nuget add source "https://f.feedz.io/nuke/enterprise/nuget" --name "nuke-enterprise" --username "PAT" --password "$NUKE_ENTERPRISE_TOKEN" --store-password-in-clear-text &>/dev/null || true
fi

"$DOTNET_EXE" build "$BUILD_PROJECT_FILE" /nodeReuse:false /p:UseSharedCompilation=false -nologo -clp:NoSummary --verbosity quiet
"$DOTNET_EXE" run --project "$BUILD_PROJECT_FILE" --no-build -- "$@"
27 changes: 6 additions & 21 deletions build/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,14 @@ public Build()
OutputPath = RootDirectory / "out";
PublishPath = OutputPath / "publish";
DebBuildPath = OutputPath / "deb";
DownloadsPath = OutputPath / "downloads";
}

public static int Main () => Execute<Build>(x => x.Publish);

[PathExecutable("dpkg-deb")]
[PathVariable("dpkg-deb")]
readonly Tool DpkgDeb;

[PathExecutable("cloudsmith")]
[PathVariable("cloudsmith")]
readonly Tool Cloudsmith;

[Parameter("Configuration to build - Default is 'Debug' (local) or 'Release' (server)")]
Expand Down Expand Up @@ -87,7 +86,7 @@ protected override void OnBuildInitialized()
.Before(Restore)
.Executes(() =>
{
EnsureCleanDirectory(OutputPath);
OutputPath.CreateOrCleanDirectory();
});

Target Restore => _ => _
Expand All @@ -114,7 +113,6 @@ protected override void OnBuildInitialized()

Target PrepareForDebPack => _ => _
.DependsOn(Publish)
.DependsOn(UncompressFfmpeg)
.Executes(() =>
{
foreach (var rid in Rids)
Expand All @@ -123,7 +121,7 @@ protected override void OnBuildInitialized()
var linuxArc = ToLinuxArc(arc);
var packageFolderName = $"{PackageName}_{CurrentVersion}_{linuxArc}";
var debPackDirectory = DebBuildPath / packageFolderName;
EnsureExistingDirectory(debPackDirectory);
debPackDirectory.CreateOrCleanDirectory();

var serviceTargetDirectory = debPackDirectory / "usr" / "local" / "share" / "openhd" / "web-ui";
CopyDirectoryRecursively(
Expand All @@ -132,28 +130,15 @@ protected override void OnBuildInitialized()
excludeFile: info => info.Name == "appsettings.Development.json");

var packSystemDDir = debPackDirectory / "etc" / "systemd" / "system";
EnsureExistingDirectory(packSystemDDir);
packSystemDDir.CreateOrCleanDirectory();
CopyFile(RootDirectory / "openhd-web-ui.service", packSystemDDir / "openhd-web-ui.service");

var debianDirectory = debPackDirectory / "DEBIAN";
EnsureExistingDirectory(debianDirectory);
debianDirectory.CreateOrCleanDirectory();
CreateControlFile(RootDirectory / "control.template", debianDirectory / "control", CurrentVersion, linuxArc);

CopyDebFile(debianDirectory, "postinst");
CopyDebFile(debianDirectory, "preinst");

// Copy ffmpeg
var ffmpegTargetFolder = serviceTargetDirectory / "ffmpeg";

var binDescription = FfmpegBinDescriptions.Single(description => description.Rid == rid);
CopyDirectoryRecursively(DownloadsPath / binDescription.UncompressedDirectoryName, ffmpegTargetFolder);
if (IsUnix)
{
#pragma warning disable CA1416 // Validate platform compatibility
File.SetUnixFileMode(ffmpegTargetFolder / "ffmpeg", (UnixFileMode)509);
File.SetUnixFileMode(ffmpegTargetFolder / "ffprobe", (UnixFileMode)509);
#pragma warning restore CA1416 // Validate platform compatibility
}
}
});

Expand Down
77 changes: 0 additions & 77 deletions build/FfmpegDownload.cs

This file was deleted.

7 changes: 4 additions & 3 deletions build/_build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,23 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace></RootNamespace>
<NoWarn>CS0649;CS0169</NoWarn>
<NukeRootDirectory>..</NukeRootDirectory>
<NukeScriptDirectory>..</NukeScriptDirectory>
<NukeTelemetryVersion>1</NukeTelemetryVersion>
<EnableUnsafeBinaryFormatterSerialization>true</EnableUnsafeBinaryFormatterSerialization>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Nuke.CodeGeneration" Version="6.3.0" />
<PackageReference Include="Nuke.Common" Version="6.3.0" />
<PackageReference Include="Nuke.Common" Version="7.0.6" />
<PackageReference Include="Stubble.Core" Version="1.10.8" />
</ItemGroup>

<ItemGroup>
<PackageDownload Include="GitVersion.Tool" Version="[5.11.1]" />
<PackageDownload Include="GitVersion.Tool" Version="[5.12.0]" />
<PackageDownload Include="minver-cli" Version="[4.3.0]" />
</ItemGroup>

Expand Down
5 changes: 5 additions & 0 deletions global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"sdk": {
"version": "8.0.100"
}
}
15 changes: 0 additions & 15 deletions src/ConversionDemo/ConversionDemo.csproj

This file was deleted.

29 changes: 0 additions & 29 deletions src/ConversionDemo/Program.cs

This file was deleted.

39 changes: 0 additions & 39 deletions src/OpenHdWebUi.FFmpeg/FFmpegHelpers.cs

This file was deleted.

14 changes: 0 additions & 14 deletions src/OpenHdWebUi.FFmpeg/OpenHdWebUi.FFmpeg.csproj

This file was deleted.

Loading

0 comments on commit a348228

Please sign in to comment.