Skip to content

Commit

Permalink
Merge pull request #1101 from lahma/install-fonts
Browse files Browse the repository at this point in the history
Install required font on Linux CI run
  • Loading branch information
tonyqus committed Jun 24, 2023
2 parents 8469d3d + 31f9508 commit fac36d0
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
windows-latest:
name: windows-latest
runs-on: windows-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v3
- name: 'Cache: .nuke/temp, ~/.nuget/packages'
Expand All @@ -45,6 +46,7 @@ jobs:
ubuntu-latest:
name: ubuntu-latest
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v3
- name: 'Cache: .nuke/temp, ~/.nuget/packages'
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/PR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jobs:
windows-latest:
name: windows-latest
runs-on: windows-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v3
- name: 'Cache: .nuke/temp, ~/.nuget/packages'
Expand All @@ -41,6 +42,7 @@ jobs:
ubuntu-latest:
name: ubuntu-latest
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v3
- name: 'Cache: .nuke/temp, ~/.nuget/packages'
Expand Down
2 changes: 2 additions & 0 deletions .nuke/build.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
"enum": [
"Clean",
"Compile",
"InstallFonts",
"Pack",
"Restore",
"Test"
Expand All @@ -97,6 +98,7 @@
"enum": [
"Clean",
"Compile",
"InstallFonts",
"Pack",
"Restore",
"Test"
Expand Down
6 changes: 4 additions & 2 deletions build/Build.GitHubAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
GitHubActionsImage.WindowsLatest,
GitHubActionsImage.UbuntuLatest,
OnPushBranches = new[] { "main", "master" },
InvokedTargets = new[] { nameof(Clean), nameof(Test), nameof(Pack) }
InvokedTargets = new[] { nameof(Clean), nameof(Test), nameof(Pack) },
TimeoutMinutes = 20
)]
[GitHubActions("PR",
GitHubActionsImage.WindowsLatest,
GitHubActionsImage.UbuntuLatest,
On = new [] { GitHubActionsTrigger.PullRequest },
InvokedTargets = new[] { nameof(Clean), nameof(Test), nameof(Pack) }
InvokedTargets = new[] { nameof(Clean), nameof(Test), nameof(Pack) },
TimeoutMinutes = 20
)]
partial class Build
{
Expand Down
13 changes: 12 additions & 1 deletion build/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ protected override void OnBuildInitialized()
});

Target Test => _ => _
.DependsOn(Compile)
.DependsOn(Compile, InstallFonts)
.Executes(() =>
{
DotNetTest(_ =>_
Expand All @@ -87,6 +87,17 @@ protected override void OnBuildInitialized()
);
});

Target InstallFonts => _ => _
.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");
});

Target Pack => _ => _
.After(Test)
.Produces(ArtifactsDirectory / "**")
Expand Down
6 changes: 5 additions & 1 deletion testcases/main/HSSF/UserModel/TestHSSFSheet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ namespace TestCases.HSSF.UserModel
using System.IO;
using System;
using System.Configuration;
using System.Runtime.InteropServices;
using NPOI.HSSF.UserModel;
using NPOI.HSSF.Model;
using NPOI.HSSF.Record;
Expand Down Expand Up @@ -853,7 +854,10 @@ public void TestAutoSizeRow()
sheet.AutoSizeRow(row.RowNum);

Assert.AreNotEqual(100, row.Height);
Assert.AreEqual(506, row.Height);

// there's slight difference due to fonts
var expectedRowHeight = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? 506 : 528;
Assert.AreEqual(expectedRowHeight, row.Height);

workbook.Close();
}
Expand Down

0 comments on commit fac36d0

Please sign in to comment.