Skip to content

armgit / Filee

Public Imported from GitHub
0

Free, open-source file converter. Convert 263 formats offline by drag & drop — images, PDF, Word, Excel, PowerPoint, HWP/HWPX, video, audio, e-books and archives. No upload, no Office needed.

Keep CI fast: drop stalled mirrors, cache Zig, one run per branch

KnifeLemon7c6a2ea38f67
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 455b8fc8..578da45f 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -9,6 +9,11 @@ on:
permissions:
contents: read
+# One run per branch or pull request: a newer push cancels the run it replaces.
+concurrency:
+ group: ci-${{ github.event.pull_request.number || github.ref }}
+ cancel-in-progress: true
+
jobs:
build:
runs-on: windows-latest
@@ -29,19 +34,26 @@ jobs:
run: dotnet build Filee.slnx --no-restore -c Release
# Windows 11 Explorer menu (native DLL + unsigned sparse package); its tests load the DLL in-process.
- - name: Cache Zig toolchain
- uses: actions/cache@v4
+ # The toolchain (~100 MB) is saved right after it is downloaded, even if a later step fails, so it is
+ # downloaded once and not on every run. Release builds restore the same cache.
+ - name: Restore Zig toolchain
+ id: zig
+ uses: actions/cache/restore@v4
with:
- path: |
- build/.cache/zig-x86_64-windows-0.16.0
- build/.cache/zig-cache
- key: zig-0.16.0-${{ hashFiles('src/Filee.ExplorerMenu/**') }}
- restore-keys: zig-0.16.0-
+ path: build/.cache/zig-x86_64-windows-0.16.0
+ key: zig-0.16.0-x86_64-windows
- name: Build Explorer menu extension
shell: pwsh
run: ./build/build-explorer-menu.ps1
+ - name: Save Zig toolchain
+ if: steps.zig.outputs.cache-hit != 'true'
+ uses: actions/cache/save@v4
+ with:
+ path: build/.cache/zig-x86_64-windows-0.16.0
+ key: zig-0.16.0-x86_64-windows
+
# rhwp, Pandoc and 7-Zip are small; with them the HWP/HWPX and archive engine tests run too (LibreOffice is
# skipped to save time).
- name: Fetch rhwp, Pandoc and 7-Zip for engine tests
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index a248a89f..f107db0b 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -38,6 +38,12 @@ jobs:
shell: pwsh
run: ./build/fetch-fonts.ps1
+ - name: Restore Zig toolchain
+ uses: actions/cache/restore@v4
+ with:
+ path: build/.cache/zig-x86_64-windows-0.16.0
+ key: zig-0.16.0-x86_64-windows
+
# Windows 11 top-level Explorer menu: FileeExplorerMenu.dll (C, built with a pinned Zig toolchain) and the
# unsigned sparse package FileeExplorerMenu.msix. Built before the tests so they check the real files.
- name: Build Explorer menu extension
diff --git a/build/build-explorer-menu.ps1 b/build/build-explorer-menu.ps1
index e6efe04a..911a6d46 100644
--- a/build/build-explorer-menu.ps1
+++ b/build/build-explorer-menu.ps1
@@ -49,8 +49,10 @@ function Get-Zig {
if ($ok) { break }
Write-Host "get $url"
try {
- # curl.exe (part of Windows) is much faster than Invoke-WebRequest for ~100 MB.
- & curl.exe --fail --location --silent --show-error --retry 2 --max-time 900 --output $zip $url
+ # curl.exe (part of Windows) is much faster than Invoke-WebRequest for ~100 MB. A mirror that stalls (under
+ # 200 KB/s for 30 s) is dropped quickly for the next one instead of holding the build for many minutes.
+ & curl.exe --fail --location --silent --show-error --connect-timeout 20 --speed-limit 200000 --speed-time 30 `
+ --max-time 600 --output $zip $url
if ($LASTEXITCODE -ne 0) { throw "curl exit code $LASTEXITCODE" }
$hash = (Get-FileHash $zip -Algorithm SHA256).Hash
if ($hash -ne $zigSha256) { throw "checksum mismatch (got $hash, size $((Get-Item $zip).Length), expected $zigSize bytes)" }
@@ -67,7 +69,7 @@ function Get-Zig {
$partial = Join-Path $cache "$zigName.partial"
Remove-Item $partial -Recurse -Force -ErrorAction SilentlyContinue
New-Item -ItemType Directory -Force -Path $partial | Out-Null
- & tar.exe -xf $zip -C $partial
+ & (Join-Path $env:SystemRoot 'System32\tar.exe') -xf $zip -C $partial
if ($LASTEXITCODE -ne 0) { throw "tar failed with exit code $LASTEXITCODE" }
Move-Item (Join-Path $partial $zigName) $folder
Remove-Item $partial -Recurse -Force
diff --git a/tests/Filee.Engines.Tests/MarkdownTests.cs b/tests/Filee.Engines.Tests/MarkdownTests.cs
index 8f7d52f5..bacaea10 100644
--- a/tests/Filee.Engines.Tests/MarkdownTests.cs
+++ b/tests/Filee.Engines.Tests/MarkdownTests.cs
@@ -150,20 +150,28 @@ public class MarkdownTests(EngineFixture fx) : IClassFixture<EngineFixture>
{
var reports = new List<double>();
var sink = new SyncProgress(v => { lock (reports) reports.Add(v); });
+ int Count()
+ {
+ lock (reports)
+ return reports.Count;
+ }
using (ProgressEstimate.Start(sink, TimeSpan.FromSeconds(1)))
- await Task.Delay(700, TestContext.Current.CancellationToken);
- int count;
- lock (reports)
- count = reports.Count;
+ {
+ // Timer callbacks run late on a busy machine (CI runners): wait for two reports, up to 10 s.
+ var deadline = DateTime.UtcNow.AddSeconds(10);
+ while (Count() < 2 && DateTime.UtcNow < deadline)
+ await Task.Delay(50, TestContext.Current.CancellationToken);
+ }
+ // A callback that was already running when the estimate was disposed may still report once.
+ await Task.Delay(100, TestContext.Current.CancellationToken);
+ var count = Count();
await Task.Delay(400, TestContext.Current.CancellationToken);
Assert.True(count >= 2, $"only {count} reports");
+ Assert.Equal(count, Count());
lock (reports)
- {
- Assert.Equal(count, reports.Count);
Assert.All(reports, v => Assert.InRange(v, 0.1, 0.9));
- }
}
[Fact]