Skip to content

Commit

Permalink
fix tests?
Browse files Browse the repository at this point in the history
  • Loading branch information
BorisGerretzen committed Mar 11, 2024
1 parent 0a2a532 commit 001a4ad
Show file tree
Hide file tree
Showing 8 changed files with 81 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ jobs:
~/.nuget/packages
key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj', '**/Directory.Packages.props') }}
- name: 'Run: Pack'
run: ./TorznabClient.Demo/build.cmd Pack
run: ./build.cmd Pack
env:
NugetApiKey: ${{ secrets.NUGET_API_KEY }}
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ jobs:
~/.nuget/packages
key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj', '**/Directory.Packages.props') }}
- name: 'Run: Test'
run: ./TorznabClient.Demo/build.cmd Test
run: ./build.cmd Test
2 changes: 1 addition & 1 deletion TorznabClient.Models.Test/TorznabSerializerCapTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public void DeserializesCapsExample()
Assert.That(groups[0].Name, Is.EqualTo("alt.binaries...."));
Assert.That(groups[0].Description, Is.EqualTo("..."));
Assert.That(groups[0].LastUpdateString, Is.EqualTo("Sat, 09 Dec 2023 00:00:00 +0100"));
Assert.That(groups[0].LastUpdate, Is.EqualTo(new DateTime(2023, 12, 9, 0, 0, 0)));
Assert.That(groups[0].LastUpdate, Is.EqualTo(new DateTime(2023, 12, 9, 0, 0, 0, DateTimeKind.Utc)));
});

Assert.That(deserialized.Genres, Is.Not.Null);
Expand Down
2 changes: 1 addition & 1 deletion TorznabClient.Models.Test/TorznabSerializerResultsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public void TestSingle()
Assert.That(item.Link, Is.EqualTo("..."));
Assert.That(item.Categories, Is.EquivalentTo(new[] { 5000 }));
Assert.That(item.PubDateString, Is.EqualTo("Sat, 09 Dec 2023 00:00:00 +0100"));
Assert.That(item.PubDate, Is.EqualTo(new DateTime(2023, 12, 9, 0, 0, 0)));
Assert.That(item.PubDate, Is.EqualTo(new DateTime(2023, 12, 9, 0, 0, 0, DateTimeKind.Utc)));
Assert.That(item.Enclosure, Is.Not.Null);
Assert.That(item.Enclosure!.Url, Is.EqualTo("..."));
Assert.That(item.Enclosure!.Length, Is.EqualTo(1610612736));
Expand Down
File renamed without changes.
74 changes: 74 additions & 0 deletions build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
[CmdletBinding()]
Param(
[Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)]
[string[]]$BuildArguments
)

Write-Output "PowerShell $($PSVersionTable.PSEdition) version $($PSVersionTable.PSVersion)"

Set-StrictMode -Version 2.0; $ErrorActionPreference = "Stop"; $ConfirmPreference = "None"; trap { Write-Error $_ -ErrorAction Continue; exit 1 }
$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent

###########################################################################
# CONFIGURATION
###########################################################################

$BuildProjectFile = "$PSScriptRoot\build\_build.csproj"
$TempDirectory = "$PSScriptRoot\.nuke\temp"

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

$env:DOTNET_CLI_TELEMETRY_OPTOUT = 1
$env:DOTNET_NOLOGO = 1

###########################################################################
# EXECUTION
###########################################################################

function ExecSafe([scriptblock] $cmd) {
& $cmd
if ($LASTEXITCODE) { exit $LASTEXITCODE }
}

# If dotnet CLI is installed globally and it matches requested version, use for execution
if ($null -ne (Get-Command "dotnet" -ErrorAction SilentlyContinue) -and `
$(dotnet --version) -and $LASTEXITCODE -eq 0) {
$env:DOTNET_EXE = (Get-Command "dotnet").Path
}
else {
# Download install script
$DotNetInstallFile = "$TempDirectory\dotnet-install.ps1"
New-Item -ItemType Directory -Path $TempDirectory -Force | Out-Null
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
(New-Object System.Net.WebClient).DownloadFile($DotNetInstallUrl, $DotNetInstallFile)

# If global.json exists, load expected version
if (Test-Path $DotNetGlobalFile) {
$DotNetGlobal = $(Get-Content $DotNetGlobalFile | Out-String | ConvertFrom-Json)
if ($DotNetGlobal.PSObject.Properties["sdk"] -and $DotNetGlobal.sdk.PSObject.Properties["version"]) {
$DotNetVersion = $DotNetGlobal.sdk.version
}
}

# Install by channel or version
$DotNetDirectory = "$TempDirectory\dotnet-win"
if (!(Test-Path variable:DotNetVersion)) {
ExecSafe { & powershell $DotNetInstallFile -InstallDir $DotNetDirectory -Channel $DotNetChannel -NoPath }
} else {
ExecSafe { & powershell $DotNetInstallFile -InstallDir $DotNetDirectory -Version $DotNetVersion -NoPath }
}
$env:DOTNET_EXE = "$DotNetDirectory\dotnet.exe"
$env:PATH = "$DotNetDirectory;$env:PATH"
}

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 }
6 changes: 3 additions & 3 deletions TorznabClient.Demo/build.sh → build.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ SCRIPT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)
# CONFIGURATION
###########################################################################

BUILD_PROJECT_FILE="$SCRIPT_DIR/../build/_build.csproj"
TEMP_DIRECTORY="$SCRIPT_DIR/../.nuke/temp"
BUILD_PROJECT_FILE="$SCRIPT_DIR/build/_build.csproj"
TEMP_DIRECTORY="$SCRIPT_DIR/.nuke/temp"

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

Expand Down
1 change: 0 additions & 1 deletion build/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ class Build : NukeBuild
.SetConfiguration(Configuration)
.SetAssemblyVersion(GitVersion.AssemblySemVer)
.SetFileVersion(GitVersion.AssemblySemFileVer)
.SetInformationalVersion(GitVersion.InformationalVersion)
.EnableNoRestore()
);
});
Expand Down

0 comments on commit 001a4ad

Please sign in to comment.