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
89 changes: 89 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -190,3 +190,92 @@ jobs:
tests/Filee.App.Tests/bin/Release/net10.0/screenshots/
tests/Filee.Setup.Tests/bin/Release/net10.0/screenshots/
if-no-files-found: ignore

# Windows on ARM64 (#236), built and tested natively: the Explorer menu DLL, Setup, 7-Zip, rhwp and Unhwp's library
# are ARM64 builds, the downloaded engines (Pandoc here) x64 ones under emulation. rhwp and Unhwp come from pinned
# builds of .github/workflows/windows-arm64-native.yml (build/fetch-engines.ps1). Until both are pinned, their tests
# skip and no package is built; once they are, the job also builds the win-arm64 Setup and portable zip to try out.
build-arm64:
name: build (win-arm64)
needs: changes
if: ${{ !cancelled() && needs.changes.outputs.code != 'false' }}
runs-on: windows-11-arm
timeout-minutes: 120
defaults:
run:
shell: pwsh
steps:
- uses: actions/checkout@v7

- uses: actions/setup-dotnet@v6
with:
global-json-file: global.json

- name: ARM64 pins
id: pins
run: |
$missing = @(./build/fetch-engines.ps1 -Runtime win-arm64 -MissingPins)
if ($missing) {
Write-Host "::warning::Not pinned yet for win-arm64: $($missing -join ', '). Their tests skip and no package is built (build/fetch-engines.ps1)."
}
"ready=$(([string](-not $missing)).ToLowerInvariant())" >> $env:GITHUB_OUTPUT

- name: Restore
run: dotnet restore Filee.slnx

- name: Fonts
run: ./build/fetch-fonts.ps1

# The pinned rhwp and Unhwp builds when there are, as for the package; Unhwp's library goes next to the test
# programs through the build.
- name: Fetch engines for engine tests
run: |
$only = @('pandoc', '7zip')
if ('${{ steps.pins.outputs.ready }}' -eq 'true') { $only += @('rhwp', 'unhwp') }
./build/fetch-engines.ps1 -Runtime win-arm64 -Only $only

- name: Build
run: |
$native = @()
if ('${{ steps.pins.outputs.ready }}' -eq 'true') { $native = @("-p:UnhwpNativeLibrary=$((Resolve-Path engines/unhwp/unhwp.dll).Path)") }
dotnet build Filee.slnx --no-restore -c Release @native
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }

# The x64 Zig toolchain the build job saves; it cross-compiles the ARM64 DLL under x64 emulation.
- name: Restore Zig toolchain
uses: actions/cache/restore@v5
with:
path: build/.cache/zig-x86_64-windows-0.16.0
key: zig-0.16.0-x86_64-windows

- name: Build Explorer menu extension
run: ./build/build-explorer-menu.ps1 -Architecture arm64

- name: Test UI on its own
run: dotnet test tests/Filee.App.Tests --no-build -c Release --blame-crash --blame-hang-timeout 5m --logger "console;verbosity=normal" --results-directory TestResults/app

- name: Test
run: dotnet test Filee.slnx --no-build -c Release --filter "FullyQualifiedName!~Filee.App.Tests" --logger "trx" --results-directory TestResults

- name: Check the installer
run: ./build/build-installer.ps1 -CheckOnly -Runtime win-arm64

- name: Build package
if: steps.pins.outputs.ready == 'true'
run: ./build/build-installer.ps1 -Runtime win-arm64 -Portable

- name: Upload package
if: steps.pins.outputs.ready == 'true'
uses: actions/upload-artifact@v7
with:
name: windows-arm64-package
path: Releases/*-win-arm64-*
if-no-files-found: error

- name: Upload test results
if: failure()
uses: actions/upload-artifact@v7
with:
name: test-results-windows-arm64
path: TestResults/
if-no-files-found: ignore
41 changes: 28 additions & 13 deletions .github/workflows/portable.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
name: Linux and macOS packages

# Linux packages are built on Ubuntu 24.04 but must run on Ubuntu 22.04 (glibc 2.35). The rhwp CLI release needs a
# newer glibc, so it is built from pinned source on Ubuntu 22.04 first (linux-native, build/build-linux-native.py) and
# replaces the download in the package. SharpHook (>= 8.0.1) ships libuiohook builds for glibc 2.34 and is packaged as
# is. Every ELF file in a Linux package is then checked against glibc 2.35, and the x64 and arm64 packages are tried on
# Ubuntu 22.04, which also catches a SharpHook or engine update that raises the requirement again.
# newer glibc, so it is built from pinned source on Ubuntu 22.04 first (linux-native, build/build-native.py) and
# replaces the download in the package. Unhwp's NuGet package has no linux-arm64 library: linux-native builds it from
# the package's source too, and the arm64 tests and package use it. SharpHook (>= 8.0.1) ships libuiohook builds for
# glibc 2.34 and is packaged as is. Every ELF file in a Linux package is then checked against glibc 2.35, and the x64
# and arm64 packages are tried on Ubuntu 22.04, which also catches a SharpHook or engine update that raises the
# requirement again.

on:
workflow_call:
Expand Down Expand Up @@ -43,6 +45,7 @@ jobs:
rid: linux-x64
- runner: ubuntu-22.04-arm
rid: linux-arm64
unhwp: true
runs-on: ${{ matrix.runner }}
timeout-minutes: 90
defaults:
Expand All @@ -53,19 +56,19 @@ jobs:
steps:
- uses: actions/checkout@v7

# Fails when engines.json moved to another rhwp version while build/build-linux-native.py still builds the old
# source (also when the build below comes from the cache).
# Fails when engines.json or Directory.Packages.props moved to another rhwp or Unhwp version while
# build/build-native.py still builds the old source (also when the build below comes from the cache).
- name: Check pinned sources
run: python3 build/build-linux-native.py check
run: python3 build/build-native.py check

- name: Restore native builds
id: native-cache
uses: actions/cache@v5
with:
path: build/.cache/linux-native/${{ matrix.rid }}
key: linux-native-${{ matrix.rid }}-ubuntu-22.04-${{ hashFiles('build/build-linux-native.py') }}
key: linux-native-${{ matrix.rid }}-ubuntu-22.04-${{ hashFiles('build/build-native.py') }}

# rhwp's default features are pure Rust: a C toolchain for the linker and build scripts is enough.
# rhwp's default features are pure Rust; Unhwp's zstd-sys compiles C. A C toolchain is enough for both.
- name: Build dependencies
if: steps.native-cache.outputs.cache-hit != 'true'
run: |
Expand All @@ -85,12 +88,16 @@ jobs:
~/.cargo/registry/index
~/.cargo/registry/cache
~/.cargo/git/db
key: cargo-registry-${{ matrix.rid }}-${{ hashFiles('build/build-linux-native.py') }}
key: cargo-registry-${{ matrix.rid }}-${{ hashFiles('build/build-native.py') }}
restore-keys: cargo-registry-${{ matrix.rid }}-

- name: Build rhwp
if: steps.native-cache.outputs.cache-hit != 'true'
run: python3 build/build-linux-native.py rhwp --output "$NATIVE_OUT/rhwp" --work "$RUNNER_TEMP/rhwp"
run: python3 build/build-native.py rhwp --output "$NATIVE_OUT/rhwp" --work "$RUNNER_TEMP/rhwp"

- name: Build Unhwp
if: matrix.unhwp && steps.native-cache.outputs.cache-hit != 'true'
run: python3 build/build-native.py unhwp --output "$NATIVE_OUT/unhwp" --work "$RUNNER_TEMP/unhwp"

- name: Check glibc requirements
run: python3 build/check-elf-glibc.py --max 2.35 --needed "$NATIVE_OUT"
Expand Down Expand Up @@ -150,10 +157,15 @@ jobs:
path: build/.cache/portable-downloads
key: portable-engines-${{ matrix.rid }}-${{ hashFiles('src/Filee.Engines/Infrastructure/engines.json') }}

# linux-arm64: Unhwp from linux-native (see the top), so its tests run there too.
- name: Build and test native projects
run: |
./build/fetch-portable-engines.ps1 -Runtime '${{ matrix.rid }}' -Destination engines
dotnet build Filee.slnx -c Release
$native = @()
if ('${{ matrix.rid }}' -eq 'linux-arm64') {
$native = @("-p:UnhwpNativeLibrary=$(Join-Path $env:RUNNER_TEMP 'linux-native/unhwp/libunhwp.so')")
}
dotnet build Filee.slnx -c Release @native
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
$projects = @('Filee.Core.Tests', 'Filee.Platform.Tests', 'Filee.Engines.Tests', 'Filee.Cli.Tests', 'Filee.App.Tests')
foreach ($project in $projects) {
Expand All @@ -171,7 +183,7 @@ jobs:
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
}

# Linux: rhwp from linux-native instead of the download (see the top).
# Linux: rhwp from linux-native instead of the download, and on arm64 Unhwp's library (see the top).
- name: Build portable package
env:
PACKAGE_VERSION: ${{ inputs.version }}
Expand All @@ -180,6 +192,9 @@ jobs:
if ($IsLinux) {
$native = @{ RhwpOverride = Join-Path $env:RUNNER_TEMP 'linux-native/rhwp' }
}
if ('${{ matrix.rid }}' -eq 'linux-arm64') {
$native.UnhwpOverride = Join-Path $env:RUNNER_TEMP 'linux-native/unhwp/libunhwp.so'
}
./build/build-portable.ps1 -Runtime '${{ matrix.rid }}' -Version $env:PACKAGE_VERSION -SkipFonts @native

- name: Check archive and run native converters
Expand Down
88 changes: 88 additions & 0 deletions .github/workflows/windows-arm64-native.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: Windows ARM64 native

# rhwp has no Windows ARM64 release and Unhwp's NuGet package no win-arm64 library (#236). This builds both on a
# Windows ARM64 runner from their pinned sources (build/build-native.py: the commit of rhwp's release tag, the commit
# Unhwp's nuspec names) with the C runtime linked statically, so they need no Visual C++ Redistributable, and uploads
# them with their SHA-256.
#
# Run it once per rhwp or Unhwp version (Actions > Windows ARM64 native > Run workflow; a pull request that changes the
# build runs it too). Then host the two files of the artifact at the URLs in build/fetch-engines.ps1 ($arm64Pins) and
# fill in their sha256 from SHA256SUMS.txt: build/build-installer.ps1 -Runtime win-arm64 and CI's win-arm64 job use
# them from then on.

on:
workflow_dispatch:
pull_request:
paths:
- .github/workflows/windows-arm64-native.yml
- build/build-native.py

permissions:
contents: read

jobs:
build:
name: rhwp and Unhwp (win-arm64)
runs-on: windows-11-arm
timeout-minutes: 90
defaults:
run:
shell: pwsh
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false

# An ARM64 Python, so build-native.py can load the ARM64 unhwp.dll to check it.
- uses: actions/setup-python@v6
with:
python-version: '3.13'
architecture: arm64

- name: Check pinned sources
run: python build/build-native.py check

- name: Rust
run: |
if (-not (Get-Command rustup -ErrorAction SilentlyContinue)) {
$installer = Join-Path $env:RUNNER_TEMP 'rustup-init.exe'
Invoke-WebRequest https://static.rust-lang.org/rustup/dist/aarch64-pc-windows-msvc/rustup-init.exe -OutFile $installer
& $installer -y --profile minimal --default-toolchain none --no-modify-path
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
Join-Path $env:USERPROFILE '.cargo\bin' >> $env:GITHUB_PATH
}

- name: Build rhwp
run: python build/build-native.py rhwp --output "$env:RUNNER_TEMP/native/rhwp" --work "$env:RUNNER_TEMP/work"

- name: Build Unhwp
run: python build/build-native.py unhwp --output "$env:RUNNER_TEMP/native/unhwp" --work "$env:RUNNER_TEMP/work"

# The file names build/fetch-engines.ps1 pins: rhwp in the layout of its release archives, Unhwp's library as is.
- name: Package
run: |
$version = { param($name) (Select-String -Path build/build-native.py -Pattern "^$name = `"(.+)`"").Matches[0].Groups[1].Value }
$out = New-Item -ItemType Directory -Force (Join-Path $env:RUNNER_TEMP 'out')
$rhwp = Join-Path $out "rhwp-v$(& $version RHWP_VERSION)-windows-aarch64.zip"
$unhwp = Join-Path $out "unhwp-$(& $version UNHWP_VERSION)-win-arm64.dll"
Compress-Archive -Path "$env:RUNNER_TEMP/native/rhwp/*" -DestinationPath $rhwp
Copy-Item "$env:RUNNER_TEMP/native/unhwp/unhwp.dll" $unhwp
# Unhwp's license and the source note go next to the file for whoever hosts it.
Copy-Item "$env:RUNNER_TEMP/native/unhwp/LICENSE" (Join-Path $out 'unhwp-LICENSE.txt')
Copy-Item "$env:RUNNER_TEMP/native/unhwp/SOURCE.txt" (Join-Path $out 'unhwp-SOURCE.txt')
foreach ($file in $rhwp, $unhwp) {
$name = Split-Path $file -Leaf
if (-not (Select-String -Path build/fetch-engines.ps1 -SimpleMatch -Pattern "/$name'")) {
Write-Host "::error::build/fetch-engines.ps1 doesn't pin ${name}: update the url in `$arm64Pins."
exit 1
}
}
Get-ChildItem $out -File | ForEach-Object { "$((Get-FileHash $_.FullName -Algorithm SHA256).Hash.ToLowerInvariant()) $($_.Name)" } |
Set-Content (Join-Path $out 'SHA256SUMS.txt') -Encoding ascii
Get-Content (Join-Path $out 'SHA256SUMS.txt')

- uses: actions/upload-artifact@v7
with:
name: windows-arm64-native
path: ${{ runner.temp }}/out/
if-no-files-found: error
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ install/uninstall scripts. `Filee-<version>-<rid>-SHA256SUMS.txt` verifies the a
and notarization. `-SigningIdentity` can supply a signing identity, but does not perform notarization.

Linux release packages must run on Ubuntu 22.04 (glibc 2.35). CI builds rhwp from source on Ubuntu 22.04
(`build/build-linux-native.py`) and passes it with `-RhwpOverride`; a local package without it needs the glibc of the
machine that built it. Check a package with
(`build/build-native.py`) and passes it with `-RhwpOverride` (and on ARM64 Unhwp's library with `-UnhwpOverride`); a
local package without it needs the glibc of the machine that built it. Check a package with
`python3 build/check-elf-glibc.py --max 2.35 <unpacked package>`. See [docs/ENGINES.md](docs/ENGINES.md#linux-builds-for-older-glibc).

- **Linux:** drag gestures require X11 by default. Install the Avalonia desktop dependencies (fontconfig, FreeType, X11,
Expand Down
9 changes: 7 additions & 2 deletions THIRD-PARTY-NOTICES.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,13 @@ Bundled with the installer:

The Linux packages contain an rhwp built by Filee's CI from the unmodified source of the same release (tag `v0.8.7`,
commit `1a76570e833917d15817415a53c09ad61ab3203f`, `cargo build --release --locked --bin rhwp` on Ubuntu 22.04), so it
runs on older Linux systems than rhwp's own Linux build. It is under the same MIT license; its `LICENSE` is next to it
(`engines/rhwp`). Windows and macOS use rhwp's release builds.
runs on older Linux systems than rhwp's own Linux build. The Windows ARM64 build contains an rhwp built the same way
on Windows ARM64 (with the C runtime linked statically), as rhwp has no ARM64 release. Both are under the same MIT
license; its `LICENSE` is next to them (`engines/rhwp`). Windows x64 and macOS use rhwp's release builds.

Unhwp's NuGet package has no native library for Linux ARM64 and Windows ARM64. Those builds contain one built by
Filee's CI from the unmodified source the package was built from (commit `405b17e137b3ca06299dcbc8a156599ac7027e91`,
`cargo build --release --locked -p unhwp --lib --features ffi`), under Unhwp's MIT license.

7-Zip is Copyright (C) 1999-2026 Igor Pavlov; its `License.txt` is installed next to it (`engines/7zip`). The RAR
decompression code in `7z.dll` is under the unRAR license restriction: it may be used to unpack RAR archives, but not
Expand Down
15 changes: 11 additions & 4 deletions build/build-explorer-menu.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,21 @@

Both files belong next to Filee.exe; the release workflow passes the publish folder as -Destination.

The DLL is loaded into explorer.exe, so it is built for the architecture of the Filee build it ships with
(-Architecture): x64, or arm64 for win-arm64 (the package then says arm64 too). The x64 Zig toolchain cross-compiles
both; on Windows on ARM it runs under x64 emulation.

.EXAMPLE
pwsh build/build-explorer-menu.ps1
pwsh build/build-explorer-menu.ps1 -Destination publish/win-x64 -Version 1.2.0
pwsh build/build-explorer-menu.ps1 -Destination publish/win-arm64 -Architecture arm64
#>
[CmdletBinding()]
param(
[string]$Destination = (Join-Path $PSScriptRoot '.cache\explorer-menu'),
# Written into the DLL's version resource; defaults to <Version> in Directory.Build.props.
[string]$Version
[string]$Version,
[ValidateSet('x64', 'arm64')][string]$Architecture = 'x64'
)

$ErrorActionPreference = 'Stop'
Expand Down Expand Up @@ -95,10 +101,11 @@ $rc = Join-Path $obj 'FileeExplorerMenu.rc'
$defines = "#define FILEE_VERSION_MAJOR $major`r`n#define FILEE_VERSION_MINOR $minor`r`n#define FILEE_VERSION_PATCH $patch`r`n#define FILEE_VERSION_TEXT `"$Version`"`r`n"
Set-Content -Path $rc -Value ($defines + (Get-Content (Join-Path $source 'FileeExplorerMenu.rc') -Raw)) -Encoding utf8NoBOM -NoNewline

Write-Host "build FileeExplorerMenu.dll $Version"
Write-Host "build FileeExplorerMenu.dll $Version ($Architecture)"
$dll = Join-Path $obj 'FileeExplorerMenu.dll'
$target = @{ 'x64' = 'x86_64-windows-gnu'; 'arm64' = 'aarch64-windows-gnu' }[$Architecture]
# -nostdlib: no C runtime inside explorer.exe; the entry point is DllMain itself. -s strips symbols.
& $zig cc -target x86_64-windows-gnu -shared -O2 -s -nostdlib -Wall -Wextra -Werror `
& $zig cc -target $target -shared -O2 -s -nostdlib -Wall -Wextra -Werror `
-isystem (Join-Path (Split-Path $zig) 'lib\libc\include\any-windows-any') `
(Join-Path $source 'FileeExplorerMenu.c') (Join-Path $source 'FileeExplorerMenu.def') $rc `
-lkernel32 -luser32 -lole32 -lshell32 -lshlwapi '-Wl,--entry=DllMain' -o $dll
Expand All @@ -109,7 +116,7 @@ Write-Host "pack FileeExplorerMenu.msix"
$Destination = (Resolve-Path $Destination).Path
Push-Location $root
try {
& dotnet run build/tools/make-explorer-package.cs -- $Destination
& dotnet run build/tools/make-explorer-package.cs -- $Destination $Architecture
if ($LASTEXITCODE -ne 0) { throw "make-explorer-package failed with exit code $LASTEXITCODE" }
}
finally {
Expand Down
Loading
Loading