Skip to content

Commit

Permalink
Merge branch 'release2.6.2' into trigger-release
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyqus committed Aug 31, 2023
2 parents 5c149cd + ce0e0cc commit 878ff71
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 60 deletions.
27 changes: 7 additions & 20 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ on:
branches:
- main
- master
- 'release*'

jobs:
windows-latest:
Expand All @@ -29,37 +30,23 @@ jobs:
timeout-minutes: 20
steps:
- uses: actions/checkout@v3
- name: 'Cache: .nuke/temp, ~/.nuget/packages'
uses: actions/cache@v3
with:
path: |
.nuke/temp
~/.nuget/packages
key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj', '**/Directory.Packages.props') }}
- name: 'Run: Clean, Test, Pack'
run: ./build.cmd Clean Test Pack
- name: 'Publish: artifacts'
- name: 'Publish: publish'
uses: actions/upload-artifact@v3
with:
name: artifacts
path: artifacts
name: publish
path: publish
ubuntu-latest:
name: ubuntu-latest
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v3
- name: 'Cache: .nuke/temp, ~/.nuget/packages'
uses: actions/cache@v3
with:
path: |
.nuke/temp
~/.nuget/packages
key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj', '**/Directory.Packages.props') }}
- name: 'Run: Clean, Test, Pack'
run: ./build.cmd Clean Test Pack
- name: 'Publish: artifacts'
- name: 'Publish: publish'
uses: actions/upload-artifact@v3
with:
name: artifacts
path: artifacts
name: publish
path: publish
26 changes: 6 additions & 20 deletions .github/workflows/PR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,37 +25,23 @@ jobs:
timeout-minutes: 20
steps:
- uses: actions/checkout@v3
- name: 'Cache: .nuke/temp, ~/.nuget/packages'
uses: actions/cache@v3
with:
path: |
.nuke/temp
~/.nuget/packages
key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj', '**/Directory.Packages.props') }}
- name: 'Run: Clean, Test, Pack'
run: ./build.cmd Clean Test Pack
- name: 'Publish: artifacts'
- name: 'Publish: publish'
uses: actions/upload-artifact@v3
with:
name: artifacts
path: artifacts
name: publish
path: publish
ubuntu-latest:
name: ubuntu-latest
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v3
- name: 'Cache: .nuke/temp, ~/.nuget/packages'
uses: actions/cache@v3
with:
path: |
.nuke/temp
~/.nuget/packages
key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj', '**/Directory.Packages.props') }}
- name: 'Run: Clean, Test, Pack'
run: ./build.cmd Clean Test Pack
- name: 'Publish: artifacts'
- name: 'Publish: publish'
uses: actions/upload-artifact@v3
with:
name: artifacts
path: artifacts
name: publish
path: publish
8 changes: 5 additions & 3 deletions build/Build.GitHubAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@
[GitHubActions("CI",
GitHubActionsImage.WindowsLatest,
GitHubActionsImage.UbuntuLatest,
OnPushBranches = new[] { "main", "master" },
OnPushBranches = new[] { "main", "master", "release*" },
InvokedTargets = new[] { nameof(Clean), nameof(Test), nameof(Pack) },
TimeoutMinutes = 20
TimeoutMinutes = 20,
CacheKeyFiles = new string[0]
)]
[GitHubActions("PR",
GitHubActionsImage.WindowsLatest,
GitHubActionsImage.UbuntuLatest,
On = new [] { GitHubActionsTrigger.PullRequest },
InvokedTargets = new[] { nameof(Clean), nameof(Test), nameof(Pack) },
TimeoutMinutes = 20
TimeoutMinutes = 20,
CacheKeyFiles = new string[0]
)]
partial class Build
{
Expand Down
80 changes: 63 additions & 17 deletions build/Build.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
using System;
using System.Linq;
using System.Runtime.InteropServices;
using Nuke.Common;
using Nuke.Common.CI.GitHubActions;
using Nuke.Common.Git;
using Nuke.Common.IO;
using Nuke.Common.ProjectModel;
using Nuke.Common.Tooling;
using Nuke.Common.Tools.DotNet;
using Nuke.Common.Utilities.Collections;

using static Nuke.Common.Tools.DotNet.DotNetTasks;

partial class Build : NukeBuild
Expand All @@ -22,20 +26,47 @@ partial class Build : NukeBuild
readonly Configuration Configuration = IsLocalBuild ? Configuration.Debug : Configuration.Release;

[Solution] Solution Solution;
[GitRepository] readonly GitRepository GitRepository;

static AbsolutePath SourceDirectory => RootDirectory / "src";

static AbsolutePath ArtifactsDirectory => RootDirectory / "artifacts";
static AbsolutePath ArtifactsDirectory => RootDirectory / "publish";

string TagVersion => GitRepository.Tags.SingleOrDefault(x => x.StartsWith("v"))?[1..];

string BranchVersion => GitRepository.Branch?.StartsWith("release") == true
? GitRepository.Branch[7..]
: null;

// either from tag or branch
string PublishVersion => TagVersion ?? BranchVersion;

bool IsPublishBuild => !string.IsNullOrWhiteSpace(PublishVersion);

string VersionSuffix;

static bool IsRunningOnWindows => RuntimeInformation.IsOSPlatform(OSPlatform.Windows);

[Secret]
[Parameter("GitHub API token")]
readonly string GitHubToken;

protected override void OnBuildInitialized()
{
VersionSuffix = !IsPublishBuild
? $"preview-{DateTime.UtcNow:yyyyMMdd-HHmm}"
: "";

if (IsLocalBuild)
{
VersionSuffix = $"dev-{DateTime.UtcNow:yyyyMMdd-HHmm}";
}

Serilog.Log.Information("BUILD SETUP");
Serilog.Log.Information("\tSolution: {Solution}", Solution);
Serilog.Log.Information("\tConfiguration: {Configuration}", Configuration);
Serilog.Log.Information("\tVersion suffix: {VersionSuffix}", VersionSuffix);
Serilog.Log.Information("\tPublish version: {PublishVersion}", PublishVersion);

Serilog.Log.Information("Build environment:");
Serilog.Log.Information("\tHost: {Host}", Host.GetType());
Expand Down Expand Up @@ -103,11 +134,11 @@ static void DeleteCompilationArtifacts()
.OnlyWhenDynamic(() => RuntimeInformation.IsOSPlatform(OSPlatform.Linux) && Host is GitHubActions)
.Executes(() =>
{
ProcessTasks.StartProcess("sudo", "apt install -y fonts-noto-color-emoji");
ProcessTasks.StartProcess("mkdir", "-p /usr/local/share/fonts");
ProcessTasks.StartProcess("cp", "/usr/share/fonts/truetype/noto/NotoColorEmoji.ttf /usr/local/share/fonts/");
ProcessTasks.StartProcess("chmod", "644 /usr/local/share/fonts/NotoColorEmoji.ttf");
ProcessTasks.StartProcess("fc-cache", "-fv");
static void StartSudoProcess(string arguments) => ProcessTasks.StartProcess("sudo", arguments).WaitForExit();
// replace broken font - the one coming from APT doesn't contain all expected tables
StartSudoProcess("rm /usr/share/fonts/truetype/noto/NotoColorEmoji.ttf");
StartSudoProcess("curl -sS -L -o /usr/share/fonts/truetype/noto/NotoColorEmoji-Regular.ttf https://fonts.gstatic.com/s/notocoloremoji/v25/Yq6P-KqIXTD0t4D9z1ESnKM3-HpFab5s79iz64w.ttf");
});

Target Pack => _ => _
Expand All @@ -120,16 +151,31 @@ static void DeleteCompilationArtifacts()
var packTarget = Solution.GetProject("NPOI.Pack");
DotNetPack(_ =>_
.SetConfiguration(Configuration)
.SetOutputDirectory(ArtifactsDirectory)
.SetDeterministic(IsServerBuild)
.SetContinuousIntegrationBuild(IsServerBuild)
// obsolete missing XML documentation comment, XML comment on not valid language element, XML comment has badly formed XML, no matching tag in XML comment
// need to use escaped separator in order for this to work
.AddProperty("NoWarn", string.Join("%3B", new [] { 169, 612, 618, 1591, 1587, 1570, 1572, 1573, 1574 }))
.SetProperty("EnablePackageValidation", "false")
.SetProject(packTarget)
);
DotNetPack(_ =>
{
var packSettings = _
.SetProject(packTarget)
.SetConfiguration(Configuration)
.SetOutputDirectory(ArtifactsDirectory)
.SetDeterministic(IsServerBuild)
.SetContinuousIntegrationBuild(IsServerBuild)
// obsolete missing XML documentation comment, XML comment on not valid language element, XML comment has badly formed XML, no matching tag in XML comment
// need to use escaped separator in order for this to work
.AddProperty("NoWarn", string.Join("%3B", new[] { 169, 612, 618, 1591, 1587, 1570, 1572, 1573, 1574 }))
.SetProperty("EnablePackageValidation", "false");
if (IsPublishBuild)
{
// force version from tag/branch
packSettings = packSettings
.SetAssemblyVersion(PublishVersion)
.SetFileVersion(PublishVersion)
.SetInformationalVersion(PublishVersion)
.SetVersionSuffix(VersionSuffix)
.SetVersionPrefix(PublishVersion);
}
return packSettings;
});
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ public void isAllColumnsTracked() {
}

[Test]
[Platform("Win")]
public void updateColumnWidths_and_getBestFitColumnWidth() {
tracker.TrackAllColumns();
IRow row1 = sheet.CreateRow(0);
Expand Down

0 comments on commit 878ff71

Please sign in to comment.