Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#
# - To turn off auto-generation set:
#
# [GitHubActions (AutoGenerate = false)]
# [CustomGitHubActions (AutoGenerate = false)]
#
# - To trigger manual generation invoke:
#
Expand All @@ -30,6 +30,11 @@ jobs:
runs-on: windows-latest
timeout-minutes: 20
steps:
- uses: actions/setup-dotnet@v4
with:
dotnet-version: |
8.0
9.0
- uses: actions/checkout@v4
- name: 'Run: Clean, Test, Pack'
run: ./build.cmd Clean Test Pack
Expand All @@ -44,6 +49,11 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/setup-dotnet@v4
with:
dotnet-version: |
8.0
9.0
- uses: actions/checkout@v4
- name: 'Run: Clean, Test, Pack'
run: ./build.cmd Clean Test Pack
Expand Down
12 changes: 11 additions & 1 deletion .github/workflows/PR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#
# - To turn off auto-generation set:
#
# [GitHubActions (AutoGenerate = false)]
# [CustomGitHubActions (AutoGenerate = false)]
#
# - To trigger manual generation invoke:
#
Expand All @@ -28,6 +28,11 @@ jobs:
runs-on: windows-latest
timeout-minutes: 20
steps:
- uses: actions/setup-dotnet@v4
with:
dotnet-version: |
8.0
9.0
- uses: actions/checkout@v4
- name: 'Run: Clean, Test, Pack'
run: ./build.cmd Clean Test Pack
Expand All @@ -42,6 +47,11 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/setup-dotnet@v4
with:
dotnet-version: |
8.0
9.0
- uses: actions/checkout@v4
- name: 'Run: Clean, Test, Pack'
run: ./build.cmd Clean Test Pack
Expand Down
57 changes: 55 additions & 2 deletions build/Build.GitHubAction.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
using Nuke.Common.CI.GitHubActions;
using Nuke.Common.CI.GitHubActions.Configuration;
using Nuke.Common.Execution;
using Nuke.Common.Utilities;
using System.Collections.Generic;

[GitHubActions("CI",
[CustomGitHubActions("CI",
GitHubActionsImage.WindowsLatest,
GitHubActionsImage.UbuntuLatest,
OnPushBranches = ["main", "master", "release*", "poi/*"],
Expand All @@ -9,7 +13,7 @@
CacheKeyFiles = [],
PublishCondition = "runner.os == 'Windows'"
)]
[GitHubActions("PR",
[CustomGitHubActions("PR",
GitHubActionsImage.WindowsLatest,
GitHubActionsImage.UbuntuLatest,
On = [GitHubActionsTrigger.PullRequest],
Expand All @@ -21,3 +25,52 @@
)]
partial class Build;

class CustomGitHubActionsAttribute : GitHubActionsAttribute
{
public CustomGitHubActionsAttribute(string name, GitHubActionsImage image, params GitHubActionsImage[] images) : base(name, image, images)
{
}

protected override GitHubActionsJob GetJobs(GitHubActionsImage image, IReadOnlyCollection<ExecutableTarget> relevantTargets)
{
var job = base.GetJobs(image, relevantTargets);

var newSteps = new List<GitHubActionsStep>(job.Steps);

newSteps.Insert(0, new GitHubActionsSetupDotNetStep(["8.0", "9.0"]));

job.Steps = newSteps.ToArray();
return job;
}
}

class GitHubActionsSetupDotNetStep : GitHubActionsStep
{
public GitHubActionsSetupDotNetStep(string[] versions)
{
Versions = versions;
}

string[] Versions { get; }

public override void Write(CustomFileWriter writer)
{
writer.WriteLine("- uses: actions/setup-dotnet@v4");

using (writer.Indent())
{
writer.WriteLine("with:");
using (writer.Indent())
{
writer.WriteLine("dotnet-version: |");
using (writer.Indent())
{
foreach (var version in Versions)
{
writer.WriteLine(version);
}
}
}
}
}
}
10 changes: 4 additions & 6 deletions main/SS/UserModel/DataFormatter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -331,10 +331,8 @@ private FormatBase GetFormat(double cellValue, int formatIndex, string formatStr
// For now, if we detect 2+ parts, we call out to CellFormat to handle it
// TODO Going forward, we should really merge the logic between the two classes

if (formatStr.IndexOf(';') != -1 &&
(formatStr.IndexOf(';') != formatStr.LastIndexOf(';')
|| rangeConditionalPattern.IsMatch(formatStr)
))
int firstSemiColon = formatStr.IndexOf(';');
if (firstSemiColon != -1 && (firstSemiColon != formatStr.LastIndexOf(';') || rangeConditionalPattern.IsMatch(formatStr)))
{
try
{
Expand All @@ -343,7 +341,7 @@ private FormatBase GetFormat(double cellValue, int formatIndex, string formatStr
// CellFormat requires callers to identify date vs not, so do so
object cellValueO = (cellValue);
if (DateUtil.IsADateFormat(formatIndex, formatStr) &&
// don't try to handle Date value 0, let a 3 or 4-part format take care of it
// don't try to handle Date value 0, let a 3 or 4-part format take care of it
(double)cellValueO != 0.0)
{
cellValueO = DateUtil.GetJavaDate(cellValue);
Expand All @@ -359,7 +357,7 @@ private FormatBase GetFormat(double cellValue, int formatIndex, string formatStr

// Excel supports positive/negative/zero, but java
// doesn't, so we need to do it specially
int firstAt = formatStr.IndexOf(';');
int firstAt = firstSemiColon;
int lastAt = formatStr.LastIndexOf(';');
// p and p;n are ok by default. p;n;z and p;n;z;s need to be fixed.
if (firstAt != -1 && firstAt != lastAt)
Expand Down