diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ca1c645..23904a0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,7 +1,8 @@ name: Packages -# Builds the .deb, .rpm, pacman, Flatpak and AppImage packages, installs each one on -# a clean system and starts the app there. Pushing a v* tag (or running the +# Builds the .deb, .rpm, pacman, Flatpak and AppImage packages and the +# MSIX for the Microsoft Store, installs each one on a clean system and +# starts the app there. Pushing a v* tag (or running the # workflow by hand with a tag) also publishes them as a GitHub release. on: push: @@ -9,6 +10,7 @@ on: pull_request: paths: - 'packaging/**' + - 'crates/cr-win/package/**' - 'data/**' - '.github/workflows/release.yml' workflow_dispatch: @@ -277,8 +279,99 @@ jobs: flatpak install --user -y --noninteractive --bundle CoreRules-*.flatpak - run: packaging/smoke-test.sh flatpak run io.github.brahm.CoreRules + # The MSIX package for the Microsoft Store, which signs it. The Store + # wants a version of four numbers with the last 0, without a suffix. + msix: + needs: version + runs-on: windows-2025 + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + - uses: Swatinem/rust-cache@v2 + - run: cargo build --release --locked -p cr-win + - name: Package the MSIX + shell: pwsh + run: | + $version = "${{ needs.version.outputs.version }}" -replace '-.*$', '' + crates/cr-win/package/make-msix.ps1 -Version $version -Out dist + - uses: actions/upload-artifact@v4 + with: + name: msix + path: dist/*.msix + + # Installs the package on a clean Windows with the Windows App Runtime + # it needs, signed here with a certificate of its own publisher that + # only this machine trusts, starts the app from Start and runs the + # Windows App Certification Kit the Store runs. + test-msix: + needs: msix + runs-on: windows-2025 + steps: + - uses: actions/download-artifact@v4 + with: + name: msix + path: dist + - name: Install the Windows App Runtime + shell: pwsh + run: | + Invoke-WebRequest https://aka.ms/windowsappsdk/2.5/2.5.1/windowsappruntimeinstall-x64.exe -OutFile runtime.exe + ./runtime.exe --quiet + if ($LASTEXITCODE -ne 0) { throw "the Windows App Runtime did not install" } + - name: Install the package + shell: pwsh + run: | + $package = Get-Item dist/*.msix + $kit = Get-ChildItem "${env:ProgramFiles(x86)}\Windows Kits\10\bin\*\x64\signtool.exe" | + Sort-Object FullName -Descending | Select-Object -First 1 + $cert = New-SelfSignedCertificate -Type CodeSigningCert ` + -Subject "CN=E77E0DF5-5354-4DC5-B7EC-3E228FF5F8E9" ` + -CertStoreLocation Cert:\CurrentUser\My ` + -TextExtension @("2.5.29.19={text}") + Export-Certificate -Cert $cert -FilePath test.cer | Out-Null + Import-Certificate -FilePath test.cer -CertStoreLocation Cert:\LocalMachine\TrustedPeople | Out-Null + & $kit.FullName sign /fd SHA256 /sha1 $cert.Thumbprint $package.FullName + if ($LASTEXITCODE -ne 0) { throw "signtool failed" } + Add-AppxPackage $package.FullName + Get-AppxPackage WagnerBrahm.CoreRules | Format-List Name, Version, PackageFamilyName, InstallLocation + - name: Start the app + shell: pwsh + run: | + $family = (Get-AppxPackage WagnerBrahm.CoreRules).PackageFamilyName + Start-Process "shell:AppsFolder\$family!CoreRules" + Start-Sleep 20 + $app = Get-Process CoreRules -ErrorAction SilentlyContinue + if (-not $app) { throw "the app is not running 20 seconds after it started" } + if (-not $app.MainWindowHandle) { throw "the app has no window" } + Write-Output "running: $($app.MainWindowTitle)" + Stop-Process -Name CoreRules + - name: Windows App Certification Kit + shell: pwsh + run: | + $appcert = "${env:ProgramFiles(x86)}\Windows Kits\10\App Certification Kit\appcert.exe" + if (-not (Test-Path $appcert)) { throw "appcert.exe not found" } + $package = (Get-Item dist/*.msix).FullName + & $appcert reset + & $appcert test -appxpackagepath $package -reportoutputpath "$PWD\wack.xml" + [xml]$report = Get-Content wack.xml + $failed = $report.REPORT.REQUIREMENTS.REQUIREMENT.TEST | + Where-Object { $_.RESULT.'#cdata-section' -eq 'FAIL' } + # A failed optional test leaves the result a WARNING, which the + # Store takes; what it found shows here, as the report says it. + $failed | ForEach-Object { + Write-Output "FAIL: $($_.NAME)" + $_.MESSAGES.MESSAGE | ForEach-Object { Write-Output " $($_.TEXT)" } + Write-Output $_.OuterXml + } + Write-Output "Overall: $($report.REPORT.OVERALL_RESULT)" + if ($report.REPORT.OVERALL_RESULT -eq 'FAIL') { throw "the package fails certification" } + - uses: actions/upload-artifact@v4 + if: always() + with: + name: wack-report + path: wack.xml + release: - needs: [version, test-deb, refuse-deb, test-rpm, test-arch, test-appimage, test-flatpak] + needs: [version, test-deb, refuse-deb, test-rpm, test-arch, test-appimage, test-flatpak, test-msix] if: needs.version.outputs.tag != '' runs-on: ubuntu-24.04 permissions: @@ -289,6 +382,9 @@ jobs: with: path: dist merge-multiple: true + # The MSIX goes to the Microsoft Store, not the release: unsigned, + # Windows would not install it. + - run: rm -f dist/*.msix dist/wack.xml - run: cd dist && sha256sum * > SHA256SUMS && cat SHA256SUMS - uses: softprops/action-gh-release@v2 with: diff --git a/crates/cr-win/package/Assets/Square150x150Logo.scale-100.png b/crates/cr-win/package/Assets/Square150x150Logo.scale-100.png new file mode 100644 index 0000000..f857ed2 Binary files /dev/null and b/crates/cr-win/package/Assets/Square150x150Logo.scale-100.png differ diff --git a/crates/cr-win/package/Assets/Square150x150Logo.png b/crates/cr-win/package/Assets/Square150x150Logo.scale-200.png similarity index 100% rename from crates/cr-win/package/Assets/Square150x150Logo.png rename to crates/cr-win/package/Assets/Square150x150Logo.scale-200.png diff --git a/crates/cr-win/package/Assets/Square44x44Logo.scale-100.png b/crates/cr-win/package/Assets/Square44x44Logo.scale-100.png new file mode 100644 index 0000000..854c5a8 Binary files /dev/null and b/crates/cr-win/package/Assets/Square44x44Logo.scale-100.png differ diff --git a/crates/cr-win/package/Assets/Square44x44Logo.png b/crates/cr-win/package/Assets/Square44x44Logo.scale-200.png similarity index 100% rename from crates/cr-win/package/Assets/Square44x44Logo.png rename to crates/cr-win/package/Assets/Square44x44Logo.scale-200.png diff --git a/crates/cr-win/package/Assets/StoreLogo.scale-100.png b/crates/cr-win/package/Assets/StoreLogo.scale-100.png new file mode 100644 index 0000000..92cfe52 Binary files /dev/null and b/crates/cr-win/package/Assets/StoreLogo.scale-100.png differ diff --git a/crates/cr-win/package/Assets/StoreLogo.png b/crates/cr-win/package/Assets/StoreLogo.scale-200.png similarity index 100% rename from crates/cr-win/package/Assets/StoreLogo.png rename to crates/cr-win/package/Assets/StoreLogo.scale-200.png diff --git a/crates/cr-win/package/Assets/Wide310x150Logo.scale-100.png b/crates/cr-win/package/Assets/Wide310x150Logo.scale-100.png new file mode 100644 index 0000000..83c6a95 Binary files /dev/null and b/crates/cr-win/package/Assets/Wide310x150Logo.scale-100.png differ diff --git a/crates/cr-win/package/Assets/Wide310x150Logo.png b/crates/cr-win/package/Assets/Wide310x150Logo.scale-200.png similarity index 100% rename from crates/cr-win/package/Assets/Wide310x150Logo.png rename to crates/cr-win/package/Assets/Wide310x150Logo.scale-200.png diff --git a/crates/cr-win/package/make-msix.ps1 b/crates/cr-win/package/make-msix.ps1 index 8dd9780..41660fb 100644 --- a/crates/cr-win/package/make-msix.ps1 +++ b/crates/cr-win/package/make-msix.ps1 @@ -21,11 +21,24 @@ Copy-Item "$PSScriptRoot\Assets\*" "$layout\Assets" $manifest = Get-Content "$PSScriptRoot\AppxManifest.xml" -Raw $manifest.Replace('Version="0.0.0.0"', "Version=""$Version.0""") | Set-Content -NoNewline -Encoding utf8 "$layout\AppxManifest.xml" -$makeappx = Get-ChildItem "${env:ProgramFiles(x86)}\Windows Kits\10\bin\*\x64\makeappx.exe" | - Sort-Object FullName -Descending | Select-Object -First 1 -if (-not $makeappx) { throw "makeappx.exe not found; install the Windows SDK" } +function Find-Kit($name) { + $tool = Get-ChildItem "${env:ProgramFiles(x86)}\Windows Kits\10\bin\*\x64\$name" | + Sort-Object FullName -Descending | Select-Object -First 1 + if (-not $tool) { throw "$name not found; install the Windows SDK" } + $tool.FullName +} +$makeappx = Find-Kit makeappx.exe +# The logos come at 100% and 200% scale; resources.pri tells Windows (and +# the Store's certification) which file a scale takes for each name in the +# manifest. +$makepri = Find-Kit makepri.exe +$config = Join-Path $env:TEMP "corerules-priconfig.xml" +& $makepri createconfig /cf $config /dq en-US /pv 10.0.0 /o | Out-Null +if ($LASTEXITCODE -ne 0) { throw "makepri createconfig failed" } +& $makepri new /pr $layout /cf $config /mn "$layout\AppxManifest.xml" /of "$layout\resources.pri" /o +if ($LASTEXITCODE -ne 0) { throw "makepri failed" } New-Item -ItemType Directory -Force $Out | Out-Null $package = Join-Path $Out "CoreRules_${Version}_x64.msix" -& $makeappx.FullName pack /d $layout /p $package /o +& $makeappx pack /d $layout /p $package /o if ($LASTEXITCODE -ne 0) { throw "makeappx failed" } Write-Output $package diff --git a/docs/roadmap.md b/docs/roadmap.md index 00f5482..b434ae7 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -391,7 +391,7 @@ The phases run in order: Folder… opens its copy instead, as in the GNOME app. With it `NOT_YET_ON_WINDOWS` is empty: every screen of the GNOME app is on Windows (PR #109). - - **Help and details (in progress).** The Windows test of the Help + - **Help and details (done, PR #110).** The Windows test of the Help page with the CD's help files found its side panel too wide for a narrow window, long lines of some topics not wrapped, the book list left blank after a search or a link to another file, and F1 @@ -404,6 +404,13 @@ The phases run in order: in the translations. 5. **Package and Store.** The release workflow builds and tests the MSIX; a beta goes to a closed group through the Microsoft Store. + - **The MSIX in the release workflow (in progress).** The workflow + builds the MSIX with the version of the tag, installs it on a clean + Windows with the Windows App Runtime (signed there with a + certificate of its publisher that only that machine trusts), starts + the app from Start and runs the Windows App Certification Kit. The + MSIX stays among the run's artifacts for the Store, not in the + GitHub release, where Windows would not install it unsigned. 6. **Release with Windows**, once the beta's users confirm it, with the same version and tag as Linux. The Community Add-ons Collection follows as a package the Windows app imports.