Skip to content

Commit 64b2cbf

Browse files
ANcpLuaclaude
andcommitted
ci: install Pillow in nuget-publish; deflake FluentApi save test
Two unrelated CI bugs that surfaced after the recent merges: 1) NuGet Publish workflow failed at the "Optimize package icon" step with `ModuleNotFoundError: No module named 'PIL'`. The Python heredoc that trims + centres + resizes the icon imports Pillow but the step never installs it on the ubuntu-latest runner. Add a one-line `pip install` before the heredoc. 2) DocumentTests.FluentApi_ChainsMultipleOperations races on a shared output path. The test calls SaveAsync("fluent-test"), which resolves to <repoRoot>/output/fluent-test.pdf via FileOperations.GetOutputPath. In CI we run the test suite against three TFMs in parallel (net8.0, net9.0, net10.0), so three test-host processes try to create the same file simultaneously and one loses with `IOException: The process cannot access the file ... because it is being used by another process`. Switch to a Guid-suffixed filename so the three TFM hosts each write to their own file. Both fixes are minimal: no production code changes, no test-suite-wide refactor. Other tests with similar deterministic filenames can be fixed the same way if they start flaking. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 63d069b commit 64b2cbf

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

.github/workflows/nuget-publish.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ jobs:
2424

2525
- name: Optimize package icon
2626
run: |
27+
python3 -m pip install --quiet --disable-pip-version-check Pillow
2728
python3 << 'EOF'
2829
from PIL import Image
2930
import os

CreatePdf.NET.Tests/DocumentTests.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,14 +162,18 @@ public async Task SaveAsync_WithFilename_CreatesFile()
162162
[Fact]
163163
public async Task FluentApi_ChainsMultipleOperations()
164164
{
165+
// Unique filename so parallel test-host processes (one per target framework)
166+
// do not race on the same output file.
167+
var filename = $"fluent-test-{Guid.NewGuid():N}";
168+
165169
Func<Task> act = () => Pdf.Create()
166170
.AddText("Title", Dye.Black, TextSize.Large, TextAlignment.Center)
167171
.AddLine()
168172
.AddText("Body text")
169173
.AddLines(2)
170174
.AddPixelText("Pixel text", Dye.Red)
171175
.AddLine()
172-
.SaveAsync("fluent-test");
176+
.SaveAsync(filename);
173177

174178
await act.Should().NotThrowAsync().ConfigureAwait(true);
175179
}

0 commit comments

Comments
 (0)