From 03a637cbc0611b0205a622db108fa34b130929c9 Mon Sep 17 00:00:00 2001 From: g1obalworlds <77709487+g1obalworlds@users.noreply.github.com> Date: Mon, 26 Oct 2026 17:00:22 -0700 Subject: [PATCH 01/23] supply-chain: name the repository for the SBOM upload The attest job has no checkout, so `gh release upload` had no git remote to find the repository from and failed with "not a git repository" after the attestations were already published. Pass GH_REPO, as draft-release does. --- .github/workflows/supply-chain.yml | 2 ++ tests/test_supply_chain.py | 29 +++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/.github/workflows/supply-chain.yml b/.github/workflows/supply-chain.yml index d08d302..47b168c 100644 --- a/.github/workflows/supply-chain.yml +++ b/.github/workflows/supply-chain.yml @@ -72,6 +72,8 @@ jobs: - name: Attach the SBOM to the draft release env: GH_TOKEN: ${{ github.token }} + # No checkout here, so gh has no git remote to find the repository from. + GH_REPO: ${{ github.repository }} VERSION: ${{ inputs.version }} run: | tag="v${VERSION#v}" diff --git a/tests/test_supply_chain.py b/tests/test_supply_chain.py index 420000b..1c53f5c 100644 --- a/tests/test_supply_chain.py +++ b/tests/test_supply_chain.py @@ -1,5 +1,6 @@ """The supply-chain workflow stays opt-in so current release callers keep working.""" +import os from pathlib import Path import subprocess import tempfile @@ -107,6 +108,34 @@ class SupplyChainOptInTests(unittest.TestCase): self.assertIn("::error::no release files were downloaded", result.stdout) self.assertEqual(subjects, {}) + def test_sbom_upload_names_the_repository_without_a_checkout(self): + # The job has no checkout, so gh cannot read the repository from a git remote; like the + # real gh, the fixture fails unless GH_REPO or --repo names it. + steps = self.supply["jobs"]["attest"]["steps"] + self.assertFalse(any(step.get("uses", "").startswith("actions/checkout@") for step in steps)) + attach = next(step for step in steps if step.get("name") == "Attach the SBOM to the draft release") + context = {"${{ github.token }}": "token", "${{ github.repository }}": "storytold/photocraft", + "${{ inputs.version }}": "1.2.3"} + with tempfile.TemporaryDirectory(prefix="supply-chain-test-") as directory: + work = Path(directory) + (work / "bin").mkdir() + gh = work / "bin/gh" + gh.write_text('#!/bin/sh\n' + 'repo="${GH_REPO:-}"\n' + 'for arg; do case "$prev" in --repo|-R) repo="$arg" ;; esac; prev="$arg"; done\n' + 'if [ -z "$repo" ]; then\n' + ' echo "failed to run git: fatal: not a git repository" >&2; exit 1\n' + 'fi\n' + 'echo "$repo $*" > "$GH_LOG"\n') + gh.chmod(0o755) + env = {name: context[value] for name, value in attach["env"].items()} + env.update(PATH=f"{work / 'bin'}{os.pathsep}{os.environ['PATH']}", GH_LOG=str(work / "gh.log")) + result = subprocess.run(["bash", "-e", "-c", attach["run"]], cwd=work, env=env, + text=True, capture_output=True, timeout=15) + self.assertEqual(result.returncode, 0, result) + self.assertEqual((work / "gh.log").read_text().split(), + ["storytold/photocraft", "release", "upload", "v1.2.3", "sbom.cyclonedx.json", "--clobber"]) + if __name__ == "__main__": unittest.main() From 0e8822f2954f2a7d2c5c710a74e4489636105217 Mon Sep 17 00:00:00 2001 From: g1obalworlds <77709487+g1obalworlds@users.noreply.github.com> Date: Mon, 26 Oct 2026 17:16:25 -0700 Subject: [PATCH 02/23] sonarcloud: leave test code out of sharded coverage, as cargo llvm-cov does cargo llvm-cov adds its own exclusions to --ignore-filename-regex: tests/, examples/ and benches/ directories and tests.rs / *_tests.rs files. The sharded merge (the default since #87) calls llvm-cov export directly with only (vendor|xtask)/, so integration tests and src/**/tests.rs reached lcov.info as almost fully covered source, and coverage moved when a caller switched between shards: 1 and the default. Put those exclusions in the shared regex; the unsharded run already applies them. --- .github/workflows/sonarcloud.yml | 5 ++++- tests/test_sonarcloud.py | 21 +++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 39f7301..9d086f5 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -49,7 +49,10 @@ permissions: contents: read env: - COVERAGE_IGNORE: '(^|/)(vendor|xtask)/' + # Vendored code and xtask, plus the test code cargo llvm-cov leaves out on its own (tests/, + # examples/, benches/, tests.rs, *_tests.rs): the sharded merge calls llvm-cov export directly, + # which would otherwise report that test code as covered source. + COVERAGE_IGNORE: '(^|/)(vendor|xtask|tests|examples|benches)/|/(tests\.rs|[0-9a-zA-Z_-]+[_-]tests\.rs)$' jobs: plan: diff --git a/tests/test_sonarcloud.py b/tests/test_sonarcloud.py index d704db7..f3a49ba 100644 --- a/tests/test_sonarcloud.py +++ b/tests/test_sonarcloud.py @@ -1,6 +1,7 @@ """Exercise the reusable SonarCloud workflow's project-key trust boundary.""" import os +import re from pathlib import Path import subprocess import tempfile @@ -228,6 +229,26 @@ class SonarCloudTests(unittest.TestCase): self.assertTrue(any('rustc-release.txt' in step.get('with', {}).get('path', '') for step in build)) + def test_sharded_export_leaves_out_the_test_code_cargo_llvm_cov_does(self): + # cargo llvm-cov adds these exclusions to --ignore-filename-regex on its own; the sharded + # merge calls llvm-cov export directly, so the shared regex has to carry them. + workflow = yaml.load( + (ROOT / '.github/workflows/sonarcloud.yml').read_text(), Loader=yaml.BaseLoader) + ignore = re.compile(workflow['env']['COVERAGE_IGNORE']) + combine = next(step for step in workflow['jobs']['sonarcloud']['steps'] + if step.get('name') == 'Combine shard coverage') + self.assertIn('-ignore-filename-regex="$COVERAGE_IGNORE"', combine['run']) + ws = '/home/runner/work/app/app' + for path in ('tests/it.rs', 'crates/fonts-tests/tests/fonts.rs', 'crates/ui/src/i18n/tests.rs', + 'crates/ui/src/parser_tests.rs', 'crates/ui/src/io-tests.rs', + 'examples/demo.rs', 'benches/render.rs', 'vendor/zlib/lib.rs', 'xtask/src/main.rs'): + with self.subTest(excluded=path): + self.assertTrue(ignore.search(f'{ws}/{path}')) + for path in ('src/lib.rs', 'crates/fonts-tests/src/lib.rs', 'crates/ui/src/contests.rs', + 'crates/ui/src/testsuite.rs', 'apps/app-cli/src/main.rs'): + with self.subTest(kept=path): + self.assertFalse(ignore.search(f'{ws}/{path}')) + def test_shard_masks_only_test_failures(self): workflow = yaml.load( (ROOT / '.github/workflows/sonarcloud.yml').read_text(), Loader=yaml.BaseLoader) From 8bb4e5ab95443171104ad88113fe1ef9b0e5ce3f Mon Sep 17 00:00:00 2001 From: Jeremy Date: Tue, 27 Oct 2026 19:45:39 +0000 Subject: [PATCH 03/23] fix(ci): separate ARM64 install paths and scope (#100) * fix(ci): separate ARM64 install paths and installation scope * test(ci): exercise ARM64 installer contract fixtures on Windows --- .github/workflows/windows-arm64.yml | 39 +++++++++-- README.md | 9 +++ tests/test_windows_arm64.py | 70 +++++++++++++++++--- tests/test_windows_install_contract.py | 92 ++++++++++++++++++++++++++ 4 files changed, 196 insertions(+), 14 deletions(-) create mode 100644 tests/test_windows_install_contract.py diff --git a/.github/workflows/windows-arm64.yml b/.github/workflows/windows-arm64.yml index 049d727..c6f20dc 100644 --- a/.github/workflows/windows-arm64.yml +++ b/.github/workflows/windows-arm64.yml @@ -11,6 +11,16 @@ on: description: "Installation folder name inside ProgramFiles or LocalAppData (e.g. PhotoCraft)" type: string required: true + install-relative-path: + description: "Install path below LocalAppData (per-user) or ProgramFiles (per-machine), independent of app-dir" + type: string + required: false + default: "" + install-scope: + description: "Explicit perUser or perMachine context; empty preserves legacy installer defaults" + type: string + required: false + default: "" main-binary: description: "Name of the main executable file" type: string @@ -89,6 +99,8 @@ jobs: MAIN_BINARY: ${{ inputs.main-binary }} CLI_BINARY: ${{ inputs.cli-binary }} IS_PER_USER: ${{ inputs.is-per-user }} + INSTALL_RELATIVE_PATH: ${{ inputs.install-relative-path }} + INSTALL_SCOPE: ${{ inputs.install-scope }} run: | $ErrorActionPreference = 'Stop' $mainExeName = if ($env:MAIN_BINARY -ne '') { $env:MAIN_BINARY } else { "$env:APP_NAME.exe" } @@ -99,6 +111,25 @@ jobs: throw 'app-dir and executable names must be nonempty names without paths, invalid Windows filename characters, or trailing dots/spaces' } } + # Keep display/registry/shortcut names separate from the nested install path. + $scope = [string]$env:INSTALL_SCOPE + if ($scope -notin '', 'perUser', 'perMachine') { throw 'install-scope must be perUser or perMachine' } + if ($env:IS_PER_USER -eq 'true' -and $scope -eq 'perMachine') { throw 'A per-user-only installer cannot request machine scope' } + $perUser = $scope -eq 'perUser' -or ($scope -eq '' -and $env:IS_PER_USER -eq 'true') + $relativePath = [string]$env:INSTALL_RELATIVE_PATH + if (-not $relativePath) { $relativePath = if ($perUser) { "Programs\$env:APP_DIR" } else { $env:APP_DIR } } + # Split with StringSplitOptions.None so leading, trailing and doubled separators fail. + $parts = $relativePath.Split([char[]]@('/', '\'), [StringSplitOptions]::None) + foreach ($part in $parts) { + if ([string]::IsNullOrEmpty($part) -or $part -in '.', '..' -or $part -match '[<>:"|?*\x00-\x1F]' -or $part -match '[. ]\z') { + throw 'install-relative-path must contain only safe relative Windows path components' + } + } + $installDirectory = if ($perUser) { $env:LOCALAPPDATA } else { $env:ProgramFiles } + foreach ($part in $parts) { $installDirectory = Join-Path $installDirectory $part } + $scopeProperties = @() + if ($scope -eq 'perUser') { $scopeProperties = @('ALLUSERS=2', 'MSIINSTALLPERUSER=1') } + if ($scope -eq 'perMachine') { $scopeProperties = @('ALLUSERS=1', 'MSIINSTALLPERUSER=""') } $msi = (Get-ChildItem dist/*.msi | Select-Object -First 1).FullName if ($env:IS_PER_USER -eq "true") { @@ -106,7 +137,7 @@ jobs: $deskLnk = Join-Path ([Environment]::GetFolderPath('Desktop')) "$env:APP_DIR.lnk" $key = "HKCU:\Software\Learning Machines LLC\$env:APP_DIR" function Install([string[]] $props) { - $p = Start-Process msiexec.exe -ArgumentList (@('/i', "`"$msi`"", '/qn', '/l*v', 'install.log') + $props) -Wait -PassThru + $p = Start-Process msiexec.exe -ArgumentList (@('/i', "`"$msi`"", '/qn', '/l*v', 'install.log') + $scopeProperties + $props) -Wait -PassThru if ($p.ExitCode -ne 0) { Get-Content install.log -Tail 60; throw "msiexec /i exited $($p.ExitCode)" } } function Uninstall([string] $exe) { @@ -119,7 +150,7 @@ jobs: function Expect([bool] $ok, [string] $what) { if (-not $ok) { Get-Content install.log -Tail 60; throw $what }; Write-Output "ok $what" } Install @() - $exe = Join-Path $env:LOCALAPPDATA "Programs\$env:APP_DIR\$mainExeName" + $exe = Join-Path $installDirectory $mainExeName Expect (Test-Path -LiteralPath $exe) "installed in default folder: $exe" $bytes = [System.IO.File]::ReadAllBytes($exe) $machine = [BitConverter]::ToUInt16($bytes, [BitConverter]::ToInt32($bytes, 0x3C) + 4) @@ -137,9 +168,9 @@ jobs: Uninstall $exe Expect (-not (Test-Path -LiteralPath $dir)) 'uninstall removed chosen folder' } else { - $p = Start-Process msiexec.exe -ArgumentList '/i', "`"$msi`"", '/qn', '/l*v', 'install.log' -Wait -PassThru + $p = Start-Process msiexec.exe -ArgumentList (@('/i', "`"$msi`"", '/qn', '/l*v', 'install.log') + $scopeProperties) -Wait -PassThru if ($p.ExitCode -ne 0) { Get-Content install.log -Tail 60; throw "msiexec /i exited $($p.ExitCode)" } - $dir = Join-Path $env:ProgramFiles $env:APP_DIR + $dir = $installDirectory $exeList = @($mainExeName) if ($cliExeName -ne '' -and $cliExeName -ne $mainExeName) { diff --git a/README.md b/README.md index 8542c1c..19ae05c 100644 --- a/README.md +++ b/README.md @@ -145,6 +145,15 @@ jobs: ### 3. `windows-arm64.yml` Cross-compiles ARM64 MSI on x64 Windows runner, then installs, verifies native ARM64 architecture (`0xAA64`), smoke tests the CLI, and uninstalls on a Windows 11 ARM64 runner. +`app-dir` stays a single display/shortcut/registration name. Set `install-relative-path` +separately for nested folders, for example `Programs/ArtCraft/PhotoCraft` below LocalAppData +with `install-scope: perUser`, or `ArtCraft/PhotoCraft` below ProgramFiles with +`install-scope: perMachine`. An empty scope retains the legacy installer defaults and +`is-per-user` behaviour. Explicit scope is passed to msiexec as well as used for path checks. +For the launcher's per-user-only installer, keep `is-per-user: true` to retain its shortcut, +registry and custom-folder checks. Path components are validated before starting msiexec. + + #### Caller Example: ```yaml name: Windows ARM64 diff --git a/tests/test_windows_arm64.py b/tests/test_windows_arm64.py index 2c06e03..9250bfd 100644 --- a/tests/test_windows_arm64.py +++ b/tests/test_windows_arm64.py @@ -21,20 +21,26 @@ STEP = next(step for step in DATA['jobs']['install']['steps'] if 'run' in step) INSTALLER = r''' import json, os, sys from pathlib import Path -args = sys.argv[1:] +args = json.loads(Path('process-arguments.json').read_text(encoding='utf-8-sig')) with open('processes.jsonl', 'a') as log: log.write(json.dumps(args) + '\n') if args[0] == '/i': Path('install.log').touch() - per_user = os.environ['TEST_PER_USER'] == 'true' - directory = Path(os.environ['LOCALAPPDATA']) / 'Programs' if per_user else Path(os.environ['ProgramFiles']) - directory /= os.environ['TEST_APP_DIR'] + launcher = os.environ['TEST_PER_USER'] == 'true' + scope = os.environ.get('TEST_SCOPE', '') + per_user = scope == 'perUser' or (not scope and launcher) + expected = ['ALLUSERS=2', 'MSIINSTALLPERUSER=1'] if scope == 'perUser' else ['ALLUSERS=1', 'MSIINSTALLPERUSER=""'] if scope else [] + if any(value not in args for value in expected): + raise SystemExit('explicit install scope was not passed to msiexec') + relative = os.environ.get('TEST_INSTALL_PATH', '') or ('Programs/' if per_user else '') + os.environ['TEST_APP_DIR'] + directory = Path.cwd() / ('local' if per_user else 'program-files') + directory = directory.joinpath(*relative.replace(chr(92), '/').split('/')) custom = next((arg for arg in args if arg.startswith('INSTALLFOLDER=')), None) if custom: directory = Path(custom[len('INSTALLFOLDER='):].strip('"').rstrip('\\')) directory.mkdir(parents=True) names = [os.environ['TEST_MAIN_BINARY']] - if not per_user: + if not launcher: names.append(os.environ['TEST_CLI_BINARY']) files = [directory / name for name in set(names)] for path in files: @@ -43,7 +49,7 @@ if args[0] == '/i': data[68:70] = (0xaa64).to_bytes(2, 'little') path.write_bytes(data) path.chmod(0o755) - if per_user: + if launcher: for folder in ('programs', 'desktop'): if folder == 'desktop' and 'INSTALLDESKTOPSHORTCUT=0' in args: continue @@ -59,10 +65,14 @@ else: ''' PRELUDE = r''' +[Console]::OutputEncoding = [Text.UTF8Encoding]::new($false) +$OutputEncoding = [Console]::OutputEncoding function Start-Process { param($FilePath, [string[]] $ArgumentList, [switch] $Wait, [switch] $PassThru) if ($FilePath -ne 'msiexec.exe') { throw "unexpected process $FilePath" } - & $env:TEST_PYTHON fixture.py @ArgumentList + # Preserve the Start-Process argument array across the Python fixture boundary. + ConvertTo-Json -InputObject @($ArgumentList) -Compress | Set-Content process-arguments.json -Encoding UTF8 + & $env:TEST_PYTHON fixture.py if ($LASTEXITCODE -ne 0) { throw 'fixture installer failed' } [pscustomobject]@{ ExitCode = 0 } } @@ -76,11 +86,16 @@ function Get-ItemProperty { ''' -@unittest.skipUnless(shutil.which('pwsh') and os.name == 'posix', 'requires PowerShell on POSIX') +SHELL = shutil.which('pwsh') or shutil.which('powershell') + + +@unittest.skipUnless(SHELL, 'requires PowerShell') class WindowsArm64Tests(unittest.TestCase): def run_install(self, per_user=False, **overrides): + """Exercise the workflow with fixture process and filesystem boundaries.""" inputs = {'app-name': 'pdfcraft', 'app-dir': 'PDFCraft', 'main-binary': '', 'cli-binary': '', 'is-per-user': str(per_user).lower(), + 'install-relative-path': '', 'install-scope': '', **overrides} with tempfile.TemporaryDirectory() as directory: root = Path(directory) @@ -91,6 +106,7 @@ class WindowsArm64Tests(unittest.TestCase): env = {**os.environ, 'LOCALAPPDATA': str(root / 'local'), 'ProgramFiles': str(root / 'program-files'), 'TEST_PYTHON': sys.executable, 'TEST_PER_USER': inputs['is-per-user'], 'TEST_APP_DIR': inputs['app-dir'], + 'TEST_SCOPE': inputs['install-scope'], 'TEST_INSTALL_PATH': inputs['install-relative-path'], 'TEST_MAIN_BINARY': inputs['main-binary'] or inputs['app-name'] + '.exe', 'TEST_CLI_BINARY': inputs['cli-binary'] or inputs['app-name'] + '-cli.exe'} script = STEP['run'] @@ -107,14 +123,30 @@ class WindowsArm64Tests(unittest.TestCase): for folder in ('Programs', 'Desktop'): script = script.replace(f"([Environment]::GetFolderPath('{folder}'))", f"'{root / folder.lower()}'") - (root / 'install.ps1').write_text(PRELUDE + script) - result = subprocess.run(['pwsh', '-NoLogo', '-NoProfile', '-File', 'install.ps1'], + # The POSIX fixture is a shell executable. On Windows mock only that + # native CLI boundary; retain path checks, invocation and exit handling. + prelude = PRELUDE + if os.name == 'nt': + prelude += r""" +$env:ProgramFiles = Join-Path $PWD 'program-files' +function Invoke-FixtureCli([string] $Path, [string] $Argument) { + if (-not (Test-Path -LiteralPath $Path) -or $Argument -ne '--version') { throw 'invalid fixture CLI call' } + Set-Content cli-ran 'called' + $global:LASTEXITCODE = 0 + 'fixture 1.0' +} +""" + script = script.replace('$out = & $cli --version 2>&1 | Out-String', + "$out = Invoke-FixtureCli $cli '--version' | Out-String") + (root / 'install.ps1').write_text(prelude + script, encoding='utf-8-sig') + result = subprocess.run([SHELL, '-NoLogo', '-NoProfile', '-File', 'install.ps1'], cwd=root, env=env, capture_output=True, text=True, timeout=20) log = root / 'processes.jsonl' processes = [json.loads(line) for line in log.read_text().splitlines()] if log.exists() else [] return result, processes, (root / 'injected').exists(), (root / 'cli-ran').exists() def test_defaults_and_custom_names_in_both_branches(self): + """Defaults and custom names in both branches.""" for per_user in (False, True): for inputs in ({}, {'app-name': 'craft-launcher', 'app-dir': 'ArtCraft Launcher', 'main-binary': 'artcraft-launcher.exe', 'cli-binary': 'artcraft-cli.exe'}, @@ -127,7 +159,24 @@ class WindowsArm64Tests(unittest.TestCase): self.assertFalse(injected) self.assertEqual(cli_ran, not per_user) + def test_explicit_context_and_nested_path_reach_the_installer(self): + """Explicit context and nested path reach the installer.""" + for launcher, scope, relative in ( + (False, 'perUser', 'Programs/ArtCraft/PhotoCraft'), + (False, 'perMachine', 'ArtCraft/PhotoCraft'), + (True, 'perUser', 'Programs/ArtCraft/Launcher'), + ): + with self.subTest(launcher=launcher, scope=scope): + result, processes, injected, cli_ran = self.run_install( + launcher, **{'install-scope': scope, 'install-relative-path': relative}) + self.assertEqual(result.returncode, 0, result.stderr) + self.assertEqual([args[0] for args in processes], + ['/i', '/x', '/i', '/x'] if launcher else ['/i', '/x']) + self.assertEqual(cli_ran, not launcher) + self.assertFalse(injected) + def test_powershell_syntax_in_names_stays_literal(self): + """Powershell syntax in names stays literal.""" for value in ("Craft'; New-Item injected; #", 'Craft$(New-Item injected)', 'Craft`$(New-Item injected)', "Craft's [ARM64] é"): for name in ('app-name', 'app-dir', 'main-binary', 'cli-binary'): @@ -138,6 +187,7 @@ class WindowsArm64Tests(unittest.TestCase): self.assertFalse(injected) def test_invalid_names_fail_before_installing(self): + """Invalid names fail before installing.""" for value in ('../outside', '..\\outside', 'C:outside', 'C:\\outside', '\\\\host\\share', '.', '..', 'trailing.', 'trailing ', 'bad*', 'bad?', 'bad|', 'bad<', 'bad>', 'bad\x01', 'bad\nNew-Item injected', 'bad"; New-Item injected; #'): diff --git a/tests/test_windows_install_contract.py b/tests/test_windows_install_contract.py new file mode 100644 index 0000000..d40e3f7 --- /dev/null +++ b/tests/test_windows_install_contract.py @@ -0,0 +1,92 @@ +"""Run the workflow's real input resolution without starting an installer.""" +import json +import os +from pathlib import Path +import shutil +import subprocess +import tempfile +import unittest + +import yaml + +ROOT = Path(__file__).resolve().parents[1] +DATA = yaml.load((ROOT / '.github/workflows/windows-arm64.yml').read_text(), Loader=yaml.BaseLoader) +STEP = next(step for step in DATA['jobs']['install']['steps'] if 'run' in step) +SHELL = shutil.which('pwsh') or shutil.which('powershell') + + +@unittest.skipUnless(SHELL, 'requires PowerShell') +class InstallContractTests(unittest.TestCase): + def resolve(self, relative='', scope='', launcher=False, app='PhotoCraft'): + """Resolve only the workflow input contract without invoking msiexec.""" + inputs = {'app-name': 'photocraft', 'app-dir': app, 'main-binary': 'photocraft.exe', + 'cli-binary': 'photocraft-cli.exe', 'is-per-user': str(launcher).lower(), + 'install-relative-path': relative, 'install-scope': scope} + env = {key: value for key, value in os.environ.items() + if key.lower() not in ('localappdata', 'programfiles')} + for name, expression in STEP['env'].items(): + for key, value in inputs.items(): + expression = expression.replace('${{ inputs.' + key + ' }}', value) + env[name] = expression + with tempfile.TemporaryDirectory() as directory: + env['LOCALAPPDATA'] = str(Path(directory) / 'local') + env['ProgramFiles'] = str(Path(directory) / 'machine') + env['TEST_PROGRAM_FILES'] = env['ProgramFiles'] + prefix = STEP['run'].split('$msi =', 1)[0] + # Windows PowerShell resets ProgramFiles for its own process architecture. + script = '$env:ProgramFiles = $env:TEST_PROGRAM_FILES\n' + prefix + '\n@{directory=$installDirectory; properties=@($scopeProperties); perUser=$perUser} | ConvertTo-Json -Compress\n' + file = Path(directory) / 'contract.ps1' + file.write_text(script, encoding='utf-8') + result = subprocess.run([SHELL, '-NoProfile', '-File', str(file)], env=env, + capture_output=True, text=True, timeout=20) + data = json.loads(result.stdout) if result.returncode == 0 else None + return result, data, env + + def test_nested_per_user_path_and_explicit_scope(self): + """Nested per user path and explicit scope.""" + result, data, env = self.resolve('Programs/ArtCraft/PhotoCraft', 'perUser') + self.assertEqual(result.returncode, 0, result.stderr) + self.assertIsInstance(data['directory'], str, 'The workflow must resolve the requested install directory.') + self.assertEqual(Path(data['directory']), Path(env['LOCALAPPDATA']) / 'Programs/ArtCraft/PhotoCraft') + self.assertTrue(data['perUser']) + self.assertEqual(data['properties'], ['ALLUSERS=2', 'MSIINSTALLPERUSER=1']) + + def test_machine_scope_and_legacy_defaults(self): + """Machine scope and legacy defaults.""" + for launcher, scope, relative, suffix, user in ( + (False, '', '', 'PhotoCraft', False), + (True, '', '', 'Programs/PhotoCraft', True), + (False, 'perMachine', 'ArtCraft/PhotoCraft', 'ArtCraft/PhotoCraft', False), + ): + with self.subTest(launcher=launcher, scope=scope): + result, data, env = self.resolve(relative, scope, launcher) + self.assertEqual(result.returncode, 0, result.stderr) + self.assertEqual(Path(data['directory']), Path(env['LOCALAPPDATA' if user else 'ProgramFiles']) / suffix) + self.assertEqual(data['perUser'], user) + self.assertEqual(data['properties'], [] if not scope else ['ALLUSERS=1', 'MSIINSTALLPERUSER=""']) + + def test_invalid_relative_paths_and_scope_fail_before_install(self): + """Invalid relative paths and scope fail before install.""" + for relative in ('../outside', 'ArtCraft/../outside', '/absolute', 'C:relative', + 'C:/absolute', '//host/share', 'ArtCraft//PhotoCraft', + 'ArtCraft/./PhotoCraft', 'ArtCraft/trailing.', 'ArtCraft/trailing ', + 'ArtCraft/bad*', 'ArtCraft/bad"', 'ArtCraft/bad\nname'): + with self.subTest(relative=relative): + result, _, _ = self.resolve(relative, 'perUser') + self.assertNotEqual(result.returncode, 0) + result, _, _ = self.resolve('ArtCraft/PhotoCraft', 'invalid') + self.assertNotEqual(result.returncode, 0) + result, _, _ = self.resolve('', 'perMachine', True) + self.assertNotEqual(result.returncode, 0) + + def test_path_metacharacters_stay_literal(self): + """Path metacharacters stay literal.""" + for name in ("Craft's [ARM64]", 'Craft$(Write-Output injected)', 'Craft`name'): + with self.subTest(name=name): + result, data, env = self.resolve('Programs/ArtCraft/' + name, 'perUser') + self.assertEqual(result.returncode, 0, result.stderr) + self.assertEqual(Path(data['directory']), Path(env['LOCALAPPDATA']) / 'Programs/ArtCraft' / name) + + +if __name__ == '__main__': + unittest.main() From d5a8872113f1fd03695cf39ce3368c9bb4736d93 Mon Sep 17 00:00:00 2001 From: Zinadin Zidan Date: Wed, 28 Oct 2026 03:37:59 +0600 Subject: [PATCH 04/23] fix(arch-package): depend on libxkbcommon-x11, without which the window can't open The apps build winit's X11 backend, and the Craft apps' winit (storytold/winit a517b38) loads libxkbcommon-x11 when it sets up the keyboard on X11 or XWayland: without it the app panics at start ("Library libxkbcommon-x11.so could not be loaded"). Arch ships it as its own package, apart from libxkbcommon, and the package only depended on libxkbcommon, so on a system without it (a fresh install, a minimal or Wayland-first desktop) every Craft app's Arch package started and couldn't open its window. PhotoCraft hit the same panic on its deb (photocraft#201) and fixed its own nfpm.yaml; the shared Arch package never got it. libxkbcommon-x11 is now in depends. A test checks the generated PKGBUILD. Checked on a clean archlinux container with a Craft app's release tarball, under Xvfb: the package built by main installs without libxkbcommon-x11 and the window fails with that error; the one built with this change pulls in libxkbcommon-x11 1.13.2 and the window runs. The unit tests pass on Ubuntu 24.04 as in test-freebsd.yml (155, 28 skipped), and test_arch passes on Arch with makepkg, end-to-end build included; shellcheck is clean. Co-Authored-By: Claude Opus 5.5 --- actions/arch-package/arch-package.sh | 5 ++++- tests/test_arch.py | 23 +++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/actions/arch-package/arch-package.sh b/actions/arch-package/arch-package.sh index fb1d89c..93fcfcc 100755 --- a/actions/arch-package/arch-package.sh +++ b/actions/arch-package/arch-package.sh @@ -181,6 +181,9 @@ COMPRESSZST=(zstd -c -T0 --ultra -20 -) EOF # Write PKGBUILD +# libxkbcommon-x11 is a hard dependency next to libxkbcommon: the apps build winit's X11 backend, +# which loads it at startup on X11 and XWayland, and panics without it ("Library +# libxkbcommon-x11.so could not be loaded"; photocraft#201). Arch packages it separately. cat > "$work/PKGBUILD" < Date: Wed, 28 Oct 2026 03:53:01 +0600 Subject: [PATCH 05/23] test(arch-package): a docstring for the libxkbcommon-x11 test The test's explanation was a comment; it's the method's docstring now, as CodeRabbit's docstring-coverage check asks. No change to what it checks. Co-Authored-By: Claude Opus 5.5 --- tests/test_arch.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/test_arch.py b/tests/test_arch.py index b31ca8c..b901c66 100644 --- a/tests/test_arch.py +++ b/tests/test_arch.py @@ -211,9 +211,12 @@ exit 0 self.assertIn("provides=(myapp=1.2.3-2)", pkgbuild) def test_pkgbuild_depends_on_the_x11_keyboard_library(self): - # winit's X11 backend loads libxkbcommon-x11 at startup and panics without it, and Arch - # ships it apart from libxkbcommon: a package without it could not open its window on - # X11 or XWayland. + """The PKGBUILD depends on libxkbcommon-x11 as well as libxkbcommon. + + winit's X11 backend loads libxkbcommon-x11 at startup and panics without it, and Arch + ships it apart from libxkbcommon: a package without it could not open its window on + X11 or XWayland. + """ with tempfile.TemporaryDirectory() as tmpdir: tmp_path = Path(tmpdir) tarball = self._create_fixture_tarball(tmp_path) From 41e0b4e0977a2c72a3b8847f52d097583109098e Mon Sep 17 00:00:00 2001 From: aiongg <67543387+aiongg@users.noreply.github.com> Date: Wed, 28 Oct 2026 14:10:16 -0400 Subject: [PATCH 06/23] fix(freebsd): install cmake-core, which the quarterly package set still has (#103) The aarch64 job uses FreeBSD's quarterly packages, which since 2026-10-28 have no `cmake` meta-package, only `cmake-core`. `pkg install cmake` failed and stopped every app's release build. `cmake-core` is in both the quarterly and latest sets. --- .github/workflows/freebsd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/freebsd.yml b/.github/workflows/freebsd.yml index c01ac31..3cf787e 100644 --- a/.github/workflows/freebsd.yml +++ b/.github/workflows/freebsd.yml @@ -110,7 +110,7 @@ jobs: printf 'FreeBSD-ports: { url: "https://pkg.FreeBSD.org/${ABI}/quarterly" }\n' > /usr/local/etc/pkg/repos/FreeBSD.conf pkg update -f -q fi - pkg install -y bash git curl pkgconf cmake python3 libxkbcommon wayland libX11 libXcursor libXrandr libXi libxcb mesa-libs vulkan-loader gtk3 fontconfig freetype2 alsa-lib dejavu + pkg install -y bash git curl pkgconf cmake-core python3 libxkbcommon wayland libX11 libXcursor libXrandr libXi libxcb mesa-libs vulkan-loader gtk3 fontconfig freetype2 alsa-lib dejavu # aarch64-unknown-freebsd is a tier-3 Rust target: rustup publishes no toolchain # or standard library for it ("installer for platform not found"), so use # FreeBSD's lang/rust package. From fa5ef18780cf5e7d5d3b8de068de56cffc83cac5 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Wed, 28 Oct 2026 15:49:07 -0400 Subject: [PATCH 07/23] Build FreeBSD aarch64 release archives by default (#104) * ci(release): build FreeBSD aarch64 archives by default app packaging/freebsd/package.sh scripts now honor CARGO_BUILD_TARGET, so aarch64 is no longer opt-in: freebsd-architectures defaults to '["x86_64","aarch64"]'. Callers can still narrow it to x86_64 only. * docs(readme): FreeBSD aarch64 is in the default freebsd-architectures --- .github/workflows/release.yml | 6 +++--- README.md | 18 +++++++++--------- tests/test_freebsd.py | 4 ++-- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1136be8..e5473b6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -70,10 +70,10 @@ on: freebsd-architectures: # aarch64 is cross-compiled in the x86_64 VM, so packaging/freebsd/package.sh must build # with CARGO_BUILD_TARGET and name its archive after it, not after uname -m (#39). - description: 'JSON array of FreeBSD release architectures; add "aarch64" once packaging/freebsd/package.sh honors CARGO_BUILD_TARGET' + description: 'JSON array of FreeBSD release architectures; packaging/freebsd/package.sh must honor CARGO_BUILD_TARGET for each listed architecture' type: string required: false - default: '["x86_64"]' + default: '["x86_64","aarch64"]' has-server: description: "Whether to build and release the headless Linux server" type: boolean @@ -700,7 +700,7 @@ jobs: strategy: fail-fast: false matrix: - # aarch64 is opt-in until each app's package.sh can package a cross build (#39). + # aarch64 is in the default freebsd-architectures; callers can narrow it (#39). arch: ${{ fromJSON(inputs.freebsd-architectures) }} env: APP_NAME: ${{ inputs.app-name }} diff --git a/README.md b/README.md index 19ae05c..c3134e2 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Full multi-platform release pipeline for Craft apps: - **Windows** (x64, x86, ARM64 MSI installer with WiX v5, CLI, Azure Trusted Signing) - **Linux** (x86_64, aarch64 AppImage, deb, rpm, tar.gz via nfpm) - **Flatpak** (x86_64, aarch64 bundle generation) -- **FreeBSD** (FreeBSD 15.1-STABLE VM build & packaging for x86_64; aarch64 is cross-compiled in the same x86_64 VM and opt-in through `freebsd-architectures`, see #39) +- **FreeBSD** (FreeBSD 15.1-STABLE VM build & packaging for x86_64 and aarch64; aarch64 is cross-compiled in the same x86_64 VM and set by default through `freebsd-architectures`, see #39) - **Arch Linux** (x86_64, aarch64 `.pkg.tar.zst` built via `makepkg` from release tarball, named by bundle id; set `has-arch: false` to skip) - **WebAssembly** (wasm32-unknown-unknown with Trunk) - **Linux RISC-V 64** (cross-compilation for riscv64gc-unknown-linux-gnu, producing deb, rpm, and tar.gz via SHA256-verified nfpm; built on Ubuntu 24.04, so it sets `GLIBC_FLOOR=2.39` for the app's `nfpm.yaml` to declare, see #44) @@ -196,14 +196,14 @@ cross-compiled in it with stable Rust (the standard library comes from FreeBSD's aarch64 `lang/rust` package, against an arm64 sysroot built from `base.txz`). Its tests are built but not run, and its package check is skipped. -The release workflow builds FreeBSD aarch64 the same way, but only when the caller -sets `freebsd-architectures: '["x86_64","aarch64"]'` (the default is `'["x86_64"]'`). -Opt in only once the app's `packaging/freebsd/package.sh` builds with -`CARGO_BUILD_TARGET`, reads binaries from -`$CARGO_TARGET_DIR/$CARGO_BUILD_TARGET/release` and names its archive -`*-freebsd-aarch64.tar.gz`: the guest's `uname -m` is always `amd64`. The release -job fails if an archive does not match its matrix architecture. Apps without a -`package.sh` use the built-in packager, which already handles the cross target. +The release workflow builds FreeBSD for `freebsd-architectures`, which defaults to +`'["x86_64","aarch64"]'`; callers can narrow it, for example `'["x86_64"]'`. An app's +`packaging/freebsd/package.sh` must build with `CARGO_BUILD_TARGET`, read binaries +from `$CARGO_TARGET_DIR/$CARGO_BUILD_TARGET/release` and name its archive +`*-freebsd-.tar.gz` for each listed architecture: the guest's `uname -m` is +always `amd64`. The release job fails if an archive does not match its matrix +architecture. Apps without a `package.sh` use the built-in packager, which already +handles the cross target. The optional `architectures` input overrides the check matrix with a JSON array, for example `'["aarch64"]'` for a dedicated ARM check or diff --git a/tests/test_freebsd.py b/tests/test_freebsd.py index 36e26eb..44b04ee 100644 --- a/tests/test_freebsd.py +++ b/tests/test_freebsd.py @@ -373,9 +373,9 @@ fi release_data = yaml.load(release_path.read_text(), Loader=yaml.BaseLoader) job = release_data["jobs"]["freebsd"] self.assertEqual(job["strategy"]["matrix"]["arch"], "${{ fromJSON(inputs.freebsd-architectures) }}") - # aarch64 is opt-in until each app's package.sh can package a cross build (#39). + # aarch64 is in the default now that app package.sh scripts honor CARGO_BUILD_TARGET (#39). default = release_data["on"]["workflow_call"]["inputs"]["freebsd-architectures"]["default"] - self.assertEqual(json.loads(default), ["x86_64"]) + self.assertEqual(json.loads(default), ["x86_64", "aarch64"]) def test_release_workflow_cross_compiles_aarch64_like_ci(self): release = yaml.load((ROOT / ".github/workflows/release.yml").read_text(), Loader=yaml.BaseLoader) From 2959c0cdc87a319c7e1300d33b948dc6174e41f5 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Thu, 29 Oct 2026 20:25:40 -0400 Subject: [PATCH 08/23] docs: app workflows only call these shared workflows; app-specific checks move here App repos' .github/workflows/ should only call craft-common-actions at @main, so CI is the same across the Craft apps. gate.yml and the README said app-only jobs (fuzzing, corpora, web builds, Windows installer probes) stay in the caller; they now belong here as shared workflows or inputs, and move without being dropped. --- .github/workflows/gate.yml | 5 +++-- README.md | 10 ++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/gate.yml b/.github/workflows/gate.yml index 24e6ee4..fbd59a9 100644 --- a/.github/workflows/gate.yml +++ b/.github/workflows/gate.yml @@ -1,8 +1,9 @@ name: "Gate" # The quality gate the craft apps run on pull requests and pushes to main: one job per runner in -# `os`, each running `command` (by default `cargo xtask ci`) with the suite's shared setup. App-only -# jobs (fuzzing, corpora, web builds) stay in the app's own workflow next to the call. +# `os`, each running `command` (by default `cargo xtask ci`) with the suite's shared setup. +# App-specific checks (fuzzing, corpora, web builds) belong here too, as shared workflows or +# inputs: an app's workflows only call this repository's workflows. on: workflow_call: inputs: diff --git a/README.md b/README.md index c3134e2..eb0d219 100644 --- a/README.md +++ b/README.md @@ -493,8 +493,14 @@ Keep app-specific packaging assertions in the caller repository and pass their Bash script to `packaging-lint.yml` with `extra-checks-script: packaging/check-app-specific.sh`. It runs after the shared lint action, with the checkout and lint tools available. A missing or failing -requested script fails the job. Native Windows installer probes remain separate -caller jobs; Linux static lint does not replace them. +requested script fails the job. Linux static lint does not replace native Windows +installer probes; those belong in a shared workflow here as well. + +An app's `.github/workflows/` only calls this repository's workflows at `@main`, +with inputs and secrets: no caller jobs with their own `runs-on`/`steps`. App-specific +checks (fuzzing, corpora, web builds, installer probes) become shared workflows or +inputs here. Jobs that apps still run themselves move here without being dropped: +an app removes one only once a shared workflow runs it. ## Job time limits From 2b3fb9dc05036f73c77d18f753a3aa9da55fa386 Mon Sep 17 00:00:00 2001 From: FredApps <153173854+FredApps@users.noreply.github.com> Date: Fri, 30 Oct 2026 12:47:08 +0100 Subject: [PATCH 09/23] ci: preserve dependency cache reuse across root manifest updates (#108) * ci: preserve dependency cache reuse across root manifest updates * docs: align gate cache overview with profile keys and dispatch opt-in --- .github/workflows/gate.yml | 35 ++++++++++++++++++++++++++++++----- README.md | 23 ++++++++++++++++++++--- tests/test_gate.py | 36 +++++++++++++++++++++++++++++++++--- 3 files changed, 83 insertions(+), 11 deletions(-) diff --git a/.github/workflows/gate.yml b/.github/workflows/gate.yml index 24e6ee4..6f44091 100644 --- a/.github/workflows/gate.yml +++ b/.github/workflows/gate.yml @@ -81,6 +81,11 @@ on: type: string required: false default: "v1" + cache-save-on-dispatch: + description: "Allow manually dispatched branch runs to save their branch-scoped dependency cache; pull requests never write" + type: boolean + required: false + default: false timeout-minutes: description: "Timeout of each leg" type: number @@ -197,14 +202,34 @@ jobs: with: tool: ${{ inputs.tools }} - # Only the default branch writes, so PR caches never evict its entry; a failing gate still - # saves. rust-cache hashes only the members' manifests, so the root Cargo.toml goes in the key - # or a profile change in a virtual root keeps restoring the old cache. + # Root workspace profiles are not among rust-cache's member manifests. Hash only + # those profiles here: a dependency/version/comment change must not discard the + # fallback cache for every other dependency. rust-cache still hashes the lockfile, + # toolchain, member manifests and build environment, and Cargo checks fingerprints. + - name: Cache profile key + id: cache-profile + shell: bash + run: | + python - <<'PYTHON' + import hashlib + import json + import os + import tomllib + from pathlib import Path + manifest = tomllib.loads(Path("Cargo.toml").read_text(encoding="utf-8")) + profiles = json.dumps(manifest.get("profile", {}), sort_keys=True, separators=(",", ":")) + key = hashlib.sha256(profiles.encode("utf-8")).hexdigest() + with open(os.environ["GITHUB_OUTPUT"], "a", encoding="utf-8") as output: + output.write(f"key={key}\n") + PYTHON + + # Default-branch writes remain the default. Maintainers can explicitly opt manual + # branch runs into branch-scoped writes; pull-request runs never save a cache. - uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3 with: prefix-key: ${{ inputs.cache-version }}-rust - key: ${{ hashFiles('Cargo.toml') }} - save-if: ${{ github.event_name != 'pull_request' && github.ref_name == github.event.repository.default_branch }} + key: ${{ steps.cache-profile.outputs.key }} + save-if: ${{ github.event_name != 'pull_request' && (github.ref_name == github.event.repository.default_branch || (inputs.cache-save-on-dispatch && github.event_name == 'workflow_dispatch')) }} cache-on-failure: true - name: Gate diff --git a/README.md b/README.md index c3134e2..4c2ce96 100644 --- a/README.md +++ b/README.md @@ -352,9 +352,12 @@ The quality gate for an app's pull requests and pushes to main. It runs `command - prebuilt cargo tools from `tools` (by default `cargo-nextest@0.9.150`); - `CARGO_PROFILE_DEV_DEBUG=line-tables-only` (set `dev-debug: ""` to keep the repository's profile) and the caller's `env`, `linux-env` and `windows-env` lines, each `KEY=VALUE`; -- a rust-cache dependency cache that only the default branch saves, so pull requests restore - main's entry and never evict it. The key includes the root `Cargo.toml`, since rust-cache hashes - only the members' manifests. Bump `cache-version` to start afresh. +- a rust-cache dependency cache saved by the default branch by default. Pull requests only + restore caches; callers may opt manual branch runs into branch-scoped writes with + `cache-save-on-dispatch: true`. The restore prefix includes the canonical root `[profile]` + table; dependency, version and comment edits do not discard reusable dependency artifacts. + rust-cache still keys on lockfiles, member manifests, toolchain and build environment, and + Cargo validates restored fingerprints. Bump `cache-version` to start afresh. After the gate, the job fails if `Cargo.lock` changed. Legs run with `fail-fast: false`; each has `timeout-minutes` (default 60). Jobs only some apps need, such as fuzzing or web builds, stay in @@ -559,3 +562,17 @@ The tests execute the FreeBSD run template under the host's POSIX shell with fixture build/test commands and real tar archives. They cover failures in each custom test group, default build/test failures, missing/corrupt packages and font environment propagation. They do not replace native FreeBSD caller runs. + +### Gate cache reuse + +The gate cache key includes the canonical root `[profile]` table, including per-package +profile overrides. Dependency and version edits no longer change the restore prefix; +`rust-cache` still keys on the lockfile, toolchain, environment and member manifests, +and Cargo validates restored fingerprints. The first run after adopting this key +is cold. + +Only the default branch saves by default. A caller may set +`cache-save-on-dispatch: true` for repeated manual integration testing. This permits +`workflow_dispatch` runs to save a cache scoped by GitHub to that branch, never a +pull-request run. Use this selectively to avoid storage churn; sibling branches cannot +restore each other's caches. Do not pass the input until this workflow change has landed. diff --git a/tests/test_gate.py b/tests/test_gate.py index 14dce95..cbb8bdc 100644 --- a/tests/test_gate.py +++ b/tests/test_gate.py @@ -1,4 +1,4 @@ -"""The shared gate workflow: pinned actions, a cache only the default branch writes, and caller +"""The shared gate workflow: pinned actions, a cache with explicit manual-branch opt-in, and caller input that reaches the shell only through the environment.""" from pathlib import Path import os @@ -27,12 +27,13 @@ class GateWorkflowTests(unittest.TestCase): if not OWN_ACTION.match(s['uses']): self.assertRegex(s['uses'], r'@[0-9a-f]{40}$') - def test_only_pushes_to_the_default_branch_save_the_cache(self): + def test_manual_branch_saves_require_explicit_opt_in(self): cache = next(s for s in STEPS if 'rust-cache' in s.get('uses', '')) condition = re.sub(r'\s+', ' ', cache['with']['save-if']) self.assertIn("github.event_name != 'pull_request'", condition) self.assertIn('github.ref_name == github.event.repository.default_branch', condition) - self.assertNotIn('||', condition) + self.assertIn("inputs.cache-save-on-dispatch && github.event_name == 'workflow_dispatch'", condition) + self.assertEqual(WORKFLOW['on']['workflow_call']['inputs']['cache-save-on-dispatch']['default'], 'false') def test_inputs_reach_scripts_only_through_env(self): for s in STEPS: @@ -71,5 +72,34 @@ class CallerEnvironmentTests(unittest.TestCase): self.assertEqual(self.run_step(ALL=f'GOOD=1\n{line}')[0], 1) +class ProfileCacheTests(unittest.TestCase): + def key(self, manifest): + with tempfile.TemporaryDirectory() as directory: + Path(directory, 'Cargo.toml').write_text(manifest) + output = Path(directory, 'output') + subprocess.run(['bash', '-euo', 'pipefail', '-c', step('Cache profile key')['run']], + cwd=directory, check=True, capture_output=True, + env={**os.environ, 'GITHUB_OUTPUT': str(output)}) + return output.read_text() + + def test_dependency_revision_does_not_discard_fallback(self): + profile = '[profile.dev]\nopt-level = 1\n' + self.assertEqual(self.key('[workspace.dependencies]\na = "1"\n' + profile), + self.key('[workspace.dependencies]\na = "2"\n' + profile)) + + def test_profile_changes_invalidate(self): + self.assertNotEqual(self.key('[profile.dev]\nopt-level = 1'), + self.key('[profile.dev]\nopt-level = 2')) + self.assertNotEqual(self.key('[profile.dev.package.foo]\nopt-level = 1'), + self.key('[profile.dev.package.foo]\nopt-level = 2')) + + def test_order_and_comments_do_not_invalidate(self): + self.assertEqual(self.key('[profile.dev]\ndebug = false\nopt-level = 1'), + self.key('# comment\n[profile.dev]\nopt-level = 1\ndebug = false')) + + def test_no_profiles_is_supported(self): + self.assertRegex(self.key('[workspace]\nmembers = []'), r'^key=[a-f0-9]{64}\n$') + + if __name__ == '__main__': unittest.main() From 3cb27117d099d77a6b91879dbdbbf8490ffd3d92 Mon Sep 17 00:00:00 2001 From: Kristian Myram Date: Fri, 30 Oct 2026 14:36:32 +0000 Subject: [PATCH 10/23] Release: support automatic contributor snapshot refresh --- .github/workflows/refresh-contributors.yml | 50 +++++++++ .github/workflows/release.yml | 47 +++++++++ .github/workflows/test-freebsd.yml | 2 + README.md | 34 +++++++ tests/test_contributor_refresh.py | 113 +++++++++++++++++++++ 5 files changed, 246 insertions(+) create mode 100644 .github/workflows/refresh-contributors.yml create mode 100644 tests/test_contributor_refresh.py diff --git a/.github/workflows/refresh-contributors.yml b/.github/workflows/refresh-contributors.yml new file mode 100644 index 0000000..8d10500 --- /dev/null +++ b/.github/workflows/refresh-contributors.yml @@ -0,0 +1,50 @@ +name: Refresh release contributors + +on: + workflow_call: + outputs: + artifact-name: + description: Contributor snapshot to pass to the release workflow + value: ${{ jobs.refresh.outputs.artifact-name }} + +permissions: + contents: read + pull-requests: read + +jobs: + refresh: + runs-on: ubuntu-24.04 + timeout-minutes: 15 + outputs: + artifact-name: release-contributors-${{ github.run_id }}-${{ github.run_attempt }} + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + fetch-depth: 0 + persist-credentials: false + - name: Refresh contributor credits for this release commit + env: + GH_TOKEN: ${{ github.token }} + run: | + set -euo pipefail + python3 scripts/refresh-contributors.py --repo "$GITHUB_REPOSITORY" + python3 - <<'PY' + import json + import os + from pathlib import Path + + credits = json.loads(Path("contributors/contributors.json").read_text()) + if credits.get("head") != os.environ["GITHUB_SHA"]: + raise SystemExit("Contributor snapshot does not match the release commit") + if credits.get("repo") != os.environ["GITHUB_REPOSITORY"]: + raise SystemExit("Contributor snapshot does not match the release repository") + if not credits.get("contributors"): + raise SystemExit("Contributor snapshot is empty") + PY + - name: Save the refreshed snapshot for all release builds + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + with: + name: release-contributors-${{ github.run_id }}-${{ github.run_attempt }} + path: contributors/contributors.json + if-no-files-found: error + retention-days: 7 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e5473b6..91145d9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -27,6 +27,11 @@ on: type: string required: false default: "" + contributors-artifact: + description: "Optional contributor snapshot artifact from refresh-contributors.yml in this workflow run; installed before every source build" + type: string + required: false + default: "" has-web: description: "Whether to build the WebAssembly (wasm) release" type: boolean @@ -264,6 +269,12 @@ jobs: exit 1 fi - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - name: Load refreshed contributor credits + if: inputs.contributors-artifact != '' + uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 + with: + name: ${{ inputs.contributors-artifact }} + path: contributors - name: Check out craft-fonts if: inputs.craft-fonts-ref != '' uses: storytold/craft-common-actions/actions/checkout-craft-fonts@main @@ -404,6 +415,12 @@ jobs: exit 1 fi - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - name: Load refreshed contributor credits + if: inputs.contributors-artifact != '' + uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 + with: + name: ${{ inputs.contributors-artifact }} + path: contributors - name: Check out craft-fonts if: inputs.craft-fonts-ref != '' uses: storytold/craft-common-actions/actions/checkout-craft-fonts@main @@ -509,6 +526,12 @@ jobs: INPUT_VERSION: ${{ inputs.version }} steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - name: Load refreshed contributor credits + if: inputs.contributors-artifact != '' + uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 + with: + name: ${{ inputs.contributors-artifact }} + path: contributors - name: Check out craft-fonts if: inputs.craft-fonts-ref != '' uses: storytold/craft-common-actions/actions/checkout-craft-fonts@main @@ -771,6 +794,12 @@ jobs: ;; esac - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - name: Load refreshed contributor credits + if: inputs.contributors-artifact != '' + uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 + with: + name: ${{ inputs.contributors-artifact }} + path: contributors - name: Check out craft-fonts if: inputs.craft-fonts-ref != '' uses: storytold/craft-common-actions/actions/checkout-craft-fonts@main @@ -1014,6 +1043,12 @@ jobs: INPUT_VERSION: ${{ inputs.version }} steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - name: Load refreshed contributor credits + if: inputs.contributors-artifact != '' + uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 + with: + name: ${{ inputs.contributors-artifact }} + path: contributors - uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # v1 with: toolchain: stable @@ -1112,6 +1147,12 @@ jobs: INPUT_VERSION: ${{ inputs.version }} steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - name: Load refreshed contributor credits + if: inputs.contributors-artifact != '' + uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 + with: + name: ${{ inputs.contributors-artifact }} + path: contributors - name: Check out craft-fonts if: inputs.craft-fonts-ref != '' uses: storytold/craft-common-actions/actions/checkout-craft-fonts@main @@ -1183,6 +1224,12 @@ jobs: FIGCRAFT_BUILD_SHA: ${{ github.sha }} steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - name: Load refreshed contributor credits + if: inputs.contributors-artifact != '' + uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 + with: + name: ${{ inputs.contributors-artifact }} + path: contributors - name: Check out craft-i18n uses: storytold/craft-common-actions/actions/checkout-craft-i18n@main - uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # v1 diff --git a/.github/workflows/test-freebsd.yml b/.github/workflows/test-freebsd.yml index 805dcf0..86a0255 100644 --- a/.github/workflows/test-freebsd.yml +++ b/.github/workflows/test-freebsd.yml @@ -5,6 +5,7 @@ on: paths: - .github/workflows/freebsd.yml - .github/workflows/release.yml + - .github/workflows/refresh-contributors.yml - .github/workflows/gate.yml - actions/freebsd-cargo-cache/** - actions/checkout-craft-i18n/** @@ -17,6 +18,7 @@ on: paths: - .github/workflows/freebsd.yml - .github/workflows/release.yml + - .github/workflows/refresh-contributors.yml - .github/workflows/gate.yml - actions/freebsd-cargo-cache/** - actions/checkout-craft-i18n/** diff --git a/README.md b/README.md index 4c2ce96..b48e841 100644 --- a/README.md +++ b/README.md @@ -65,6 +65,40 @@ jobs: AZURE_CERT_PROFILE: ${{ secrets.AZURE_CERT_PROFILE }} ``` +#### Automatic contributor credits (opt-in) + +Apps with `scripts/refresh-contributors.py` can refresh bundled credits once before a release. +Call the read-only preparatory workflow, then pass its output to the release workflow: + +```yaml +jobs: + credits: + permissions: + contents: read + pull-requests: read + uses: storytold/craft-common-actions/.github/workflows/refresh-contributors.yml@main + release: + needs: credits + permissions: + contents: write + uses: storytold/craft-common-actions/.github/workflows/release.yml@main + with: + app-name: effectcraft + app-title: EffectCraft + contributors-artifact: ${{ needs.credits.outputs.artifact-name }} + # Include the app's existing signing secrets here. +``` + +The preparatory workflow checks out full history, runs the app's script with `--repo` set to +`github.repository` and a read-only `GH_TOKEN`, and validates that the resulting nonempty +`contributors/contributors.json` belongs to `github.sha`. It uploads that file only after a +successful refresh. Every source-build job installs the same artifact after checkout, including +FreeBSD before copying the workspace to its VM. Flatpak and Arch inherit the refreshed credits +from the Linux binaries. The generated snapshot is not committed or pushed back to the app. + +An unsuccessful refresh or missing artifact blocks the release. Existing callers that omit +`contributors-artifact` keep their current behavior, permissions, and build paths. + List every signing secret explicitly. The signing jobs run in the caller repo's `release` environment and read the values from there, but only for the names listed here: an unlisted name is empty. On the `release` branch the macOS and Windows jobs fail when their signing secrets are empty, rather than shipping unsigned builds. macOS and Windows packages are signed by the app's own packaging scripts. `release.yml` does not request `id-token` or `attestations`, so existing callers keep building as they do now. diff --git a/tests/test_contributor_refresh.py b/tests/test_contributor_refresh.py new file mode 100644 index 0000000..d81563e --- /dev/null +++ b/tests/test_contributor_refresh.py @@ -0,0 +1,113 @@ +"""Exercise release credit refresh failure handling and artifact distribution.""" +import json +import os +from pathlib import Path +import subprocess +import tempfile +import unittest + +import yaml + +ROOT = Path(__file__).resolve().parents[1] + + +def load(name): + return yaml.load((ROOT / '.github/workflows' / name).read_text(), Loader=yaml.BaseLoader) + + +class ContributorRefreshTests(unittest.TestCase): + def run_refresh(self, mode): + workflow = load('refresh-contributors.yml') + step = next(s for s in workflow['jobs']['refresh']['steps'] if 'run' in s) + with tempfile.TemporaryDirectory() as directory: + root = Path(directory) + (root / 'scripts').mkdir() + (root / 'contributors').mkdir() + (root / 'scripts/refresh-contributors.py').write_text('''import json, os, sys +from pathlib import Path +assert sys.argv[1:] == ['--repo', 'owner/app'] +mode = os.environ['TEST_MODE'] +if mode == 'failed': + raise SystemExit(23) +credits = dict(head=os.environ['GITHUB_SHA'], repo='owner/app', contributors=[dict(login='person')]) +if mode == 'stale': + credits['head'] = 'old-commit' +if mode == 'wrong-repo': + credits['repo'] = 'other/app' +if mode == 'empty': + credits['contributors'] = [] +Path('contributors/contributors.json').write_text(json.dumps(credits)) +''') + result = subprocess.run(['bash', '-c', step['run']], cwd=root, + env=dict(os.environ, GITHUB_REPOSITORY='owner/app', + GITHUB_SHA='release-commit', TEST_MODE=mode), + text=True, capture_output=True, timeout=10) + snapshot = root / 'contributors/contributors.json' + return result, json.loads(snapshot.read_text()) if snapshot.exists() else None + + def test_refresh_runs_against_the_release_repository_and_commit(self): + result, snapshot = self.run_refresh('valid') + self.assertEqual(result.returncode, 0, result.stderr) + self.assertEqual(snapshot['head'], 'release-commit') + + def test_failed_refresh_stops_before_validation_or_upload(self): + result, snapshot = self.run_refresh('failed') + self.assertEqual(result.returncode, 23) + self.assertIsNone(snapshot) + + def test_rejects_stale_wrong_repository_and_empty_snapshots(self): + for mode in ('stale', 'wrong-repo', 'empty'): + with self.subTest(mode=mode): + result, _ = self.run_refresh(mode) + self.assertNotEqual(result.returncode, 0) + self.assertIn('Contributor snapshot', result.stderr) + + def test_refresh_has_full_history_read_only_token_and_required_artifact(self): + workflow = load('refresh-contributors.yml') + self.assertEqual(workflow['permissions'], {'contents': 'read', 'pull-requests': 'read'}) + steps = workflow['jobs']['refresh']['steps'] + checkout = steps[0] + self.assertEqual(checkout['with']['fetch-depth'], '0') + self.assertEqual(checkout['with']['persist-credentials'], 'false') + refresh = next(s for s in steps if 'run' in s) + self.assertEqual(refresh['env']['GH_TOKEN'], '${{ github.token }}') + upload = steps[-1] + self.assertIn('actions/upload-artifact@', upload['uses']) + self.assertEqual(upload['with']['if-no-files-found'], 'error') + self.assertEqual(upload['with']['path'], 'contributors/contributors.json') + self.assertNotIn('continue-on-error', refresh) + self.assertNotIn('continue-on-error', upload) + self.assertEqual(upload['with']['name'], workflow['jobs']['refresh']['outputs']['artifact-name']) + + def test_old_callers_keep_the_same_permissions_and_skip_artifact_download(self): + workflow = load('release.yml') + self.assertEqual(workflow['permissions'], {'contents': 'read'}) + self.assertEqual(workflow['on']['workflow_call']['inputs']['contributors-artifact']['default'], '') + for job in workflow['jobs'].values(): + for step in job.get('steps', []): + if step.get('name') == 'Load refreshed contributor credits': + self.assertEqual(step['if'], "inputs.contributors-artifact != ''") + + def test_every_source_build_consumes_one_snapshot_before_compilation(self): + jobs = load('release.yml')['jobs'] + for name in ('macos', 'windows', 'linux', 'freebsd', 'web', 'linux-riscv64', 'server'): + with self.subTest(job=name): + steps = jobs[name]['steps'] + download = next(i for i, s in enumerate(steps) if s.get('name') == 'Load refreshed contributor credits') + self.assertIn('actions/checkout@', steps[download - 1]['uses']) + settings = steps[download]['with'] + self.assertEqual(settings['name'], '${{ inputs.contributors-artifact }}') + self.assertEqual(settings['path'], 'contributors') + build_steps = [i for i, s in enumerate(steps) + if 'cargo ' in s.get('run', '') or 'packaging/' in s.get('run', '') + or 'vmactions/freebsd-vm@' in s.get('uses', '')] + self.assertTrue(build_steps) + self.assertTrue(all(download < i for i in build_steps)) + self.assertNotIn('continue-on-error', steps[download]) + # These package already-built Linux binaries rather than compiling them again. + for name in ('flatpak', 'arch'): + self.assertIn('linux', jobs[name]['needs']) + + +if __name__ == '__main__': + unittest.main() From 215a7f48c1e01af90b27a0ac2847228d381dc2d8 Mon Sep 17 00:00:00 2001 From: Kristian Myram Date: Fri, 30 Oct 2026 18:00:34 +0100 Subject: [PATCH 11/23] fix(release): exclude contributor snapshots from release assets --- .github/workflows/refresh-contributors.yml | 4 +- README.md | 4 +- tests/test_contributor_refresh.py | 81 ++++++++++++++++++++++ 3 files changed, 86 insertions(+), 3 deletions(-) diff --git a/.github/workflows/refresh-contributors.yml b/.github/workflows/refresh-contributors.yml index 8d10500..e281e05 100644 --- a/.github/workflows/refresh-contributors.yml +++ b/.github/workflows/refresh-contributors.yml @@ -16,7 +16,7 @@ jobs: runs-on: ubuntu-24.04 timeout-minutes: 15 outputs: - artifact-name: release-contributors-${{ github.run_id }}-${{ github.run_attempt }} + artifact-name: contributor-snapshot-${{ github.run_id }}-${{ github.run_attempt }} steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: @@ -44,7 +44,7 @@ jobs: - name: Save the refreshed snapshot for all release builds uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: - name: release-contributors-${{ github.run_id }}-${{ github.run_attempt }} + name: contributor-snapshot-${{ github.run_id }}-${{ github.run_attempt }} path: contributors/contributors.json if-no-files-found: error retention-days: 7 diff --git a/README.md b/README.md index b48e841..be9b132 100644 --- a/README.md +++ b/README.md @@ -92,7 +92,9 @@ jobs: The preparatory workflow checks out full history, runs the app's script with `--repo` set to `github.repository` and a read-only `GH_TOKEN`, and validates that the resulting nonempty `contributors/contributors.json` belongs to `github.sha`. It uploads that file only after a -successful refresh. Every source-build job installs the same artifact after checkout, including +successful refresh. The intermediate `contributor-snapshot-*` artifact stays outside the +`release-*` collection used for release assets and checksums, including on reruns. +Every source-build job installs the same artifact after checkout, including FreeBSD before copying the workspace to its VM. Flatpak and Arch inherit the refreshed credits from the Linux binaries. The generated snapshot is not committed or pushed back to the app. diff --git a/tests/test_contributor_refresh.py b/tests/test_contributor_refresh.py index d81563e..12e8fc7 100644 --- a/tests/test_contributor_refresh.py +++ b/tests/test_contributor_refresh.py @@ -1,8 +1,11 @@ """Exercise release credit refresh failure handling and artifact distribution.""" +import fnmatch +import hashlib import json import os from pathlib import Path import subprocess +import sys import tempfile import unittest @@ -12,11 +15,13 @@ ROOT = Path(__file__).resolve().parents[1] def load(name): + """Read workflow scalars as strings, including GitHub's `on` key.""" return yaml.load((ROOT / '.github/workflows' / name).read_text(), Loader=yaml.BaseLoader) class ContributorRefreshTests(unittest.TestCase): def run_refresh(self, mode): + """Execute the real validation step with a fixture refresh script.""" workflow = load('refresh-contributors.yml') step = next(s for s in workflow['jobs']['refresh']['steps'] if 'run' in s) with tempfile.TemporaryDirectory() as directory: @@ -46,16 +51,19 @@ Path('contributors/contributors.json').write_text(json.dumps(credits)) return result, json.loads(snapshot.read_text()) if snapshot.exists() else None def test_refresh_runs_against_the_release_repository_and_commit(self): + """Accept credits generated for the caller's exact repository and head.""" result, snapshot = self.run_refresh('valid') self.assertEqual(result.returncode, 0, result.stderr) self.assertEqual(snapshot['head'], 'release-commit') def test_failed_refresh_stops_before_validation_or_upload(self): + """Propagate refresh failures before any snapshot can be uploaded.""" result, snapshot = self.run_refresh('failed') self.assertEqual(result.returncode, 23) self.assertIsNone(snapshot) def test_rejects_stale_wrong_repository_and_empty_snapshots(self): + """Reject unusable credits even when the refresh command succeeds.""" for mode in ('stale', 'wrong-repo', 'empty'): with self.subTest(mode=mode): result, _ = self.run_refresh(mode) @@ -63,6 +71,7 @@ Path('contributors/contributors.json').write_text(json.dumps(credits)) self.assertIn('Contributor snapshot', result.stderr) def test_refresh_has_full_history_read_only_token_and_required_artifact(self): + """Keep refresh read-only and publish the validated file under its output name.""" workflow = load('refresh-contributors.yml') self.assertEqual(workflow['permissions'], {'contents': 'read', 'pull-requests': 'read'}) steps = workflow['jobs']['refresh']['steps'] @@ -80,6 +89,7 @@ Path('contributors/contributors.json').write_text(json.dumps(credits)) self.assertEqual(upload['with']['name'], workflow['jobs']['refresh']['outputs']['artifact-name']) def test_old_callers_keep_the_same_permissions_and_skip_artifact_download(self): + """Leave permissions and checked-in credits unchanged unless callers opt in.""" workflow = load('release.yml') self.assertEqual(workflow['permissions'], {'contents': 'read'}) self.assertEqual(workflow['on']['workflow_call']['inputs']['contributors-artifact']['default'], '') @@ -89,6 +99,7 @@ Path('contributors/contributors.json').write_text(json.dumps(credits)) self.assertEqual(step['if'], "inputs.contributors-artifact != ''") def test_every_source_build_consumes_one_snapshot_before_compilation(self): + """Install the named snapshot before all seven source builds start.""" jobs = load('release.yml')['jobs'] for name in ('macos', 'windows', 'linux', 'freebsd', 'web', 'linux-riscv64', 'server'): with self.subTest(job=name): @@ -108,6 +119,76 @@ Path('contributors/contributors.json').write_text(json.dumps(credits)) for name in ('flatpak', 'arch'): self.assertIn('linux', jobs[name]['needs']) + def test_snapshots_stay_out_of_draft_release_assets_and_checksums(self): + """Exclude both rerun snapshots while collecting, checksumming and uploading packages.""" + refresh = load('refresh-contributors.yml')['jobs']['refresh'] + snapshot_name = refresh['steps'][-1]['with']['name'] + artifacts = { + snapshot_name.replace('${{ github.run_id }}', '123') + .replace('${{ github.run_attempt }}', str(attempt)): + {'contributors.json': f'credits from attempt {attempt}'.encode()} + for attempt in (1, 2) + } + packages = {} + for job, settings in load('release.yml')['jobs'].items(): + for step in settings.get('steps', []): + if step.get('uses', '').startswith('actions/upload-artifact@'): + name = step['with']['name'].replace('${{ matrix.arch }}', 'x86_64') + filename = f'fixture-{job}.tar.gz' + packages[filename] = f'package from {job}'.encode() + artifacts[name] = {filename: packages[filename]} + self.assertTrue(packages, 'The fixture must include real release artifact producers') + + action = yaml.load((ROOT / 'actions/draft-release/action.yml').read_text(), + Loader=yaml.BaseLoader) + steps = action['runs']['steps'] + download = next(s for s in steps if s.get('uses', '').startswith('actions/download-artifact@')) + self.assertEqual(download['with']['merge-multiple'], 'true') + expected_checksums = {name: hashlib.sha256(data).hexdigest() + for name, data in packages.items()} + for is_draft in (False, True): + with self.subTest(existing_draft=is_draft), tempfile.TemporaryDirectory() as directory: + root = Path(directory) + destination = root / download['with']['path'] + destination.mkdir() + # Model the action's actual glob and flattened artifact download. + for name, files in artifacts.items(): + if fnmatch.fnmatchcase(name, download['with']['pattern']): + for filename, data in files.items(): + (destination / filename).write_bytes(data) + tools = root / 'tools' + tools.mkdir() + gh = tools / 'gh' + gh.write_text(f'#!{sys.executable}\n' + '''"""Capture release uploads without contacting GitHub.""" +import json, os, sys +from pathlib import Path +args = sys.argv[1:] +if args[:2] == ['release', 'view']: + if args[args.index('--json') + 1] == 'isDraft': + if os.environ['EXISTING_DRAFT'] != 'true': + raise SystemExit(1) + print('true') +elif args[:2] in (['release', 'create'], ['release', 'upload']): + Path(os.environ['UPLOAD_LOG']).write_text(json.dumps(args)) +''') + gh.chmod(0o755) + env = dict(os.environ, PATH=str(tools) + os.pathsep + os.environ['PATH'], + VERSION='1.2.3', APP_TITLE='Fixture', PRERELEASE='false', + GITHUB_SHA='release-commit', GITHUB_STEP_SUMMARY=str(root / 'summary'), + EXISTING_DRAFT=str(is_draft).lower(), UPLOAD_LOG=str(root / 'upload.json')) + for step in steps: + if 'run' in step: + result = subprocess.run(['bash', '-e', '-o', 'pipefail', '-c', step['run']], + cwd=root / step.get('working-directory', '.'), + env=env, text=True, capture_output=True, timeout=10) + self.assertEqual(result.returncode, 0, result.stderr) + checksums = dict((line.split()[1], line.split()[0]) + for line in (destination / 'SHA256SUMS.txt').read_text().splitlines()) + self.assertEqual(checksums, expected_checksums) + args = json.loads((root / 'upload.json').read_text()) + self.assertEqual(args[:2], ['release', 'upload' if is_draft else 'create']) + self.assertEqual(set(args[args.index('--') + 1:]), set(packages) | {'SHA256SUMS.txt'}) + if __name__ == '__main__': unittest.main() From b97dadbcbea69e2cc6864e93ac0eb19c3dd90776 Mon Sep 17 00:00:00 2001 From: Kristian Myram Date: Fri, 30 Oct 2026 21:28:16 +0100 Subject: [PATCH 12/23] docs(release): clarify contributor refresh caller permissions --- README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index be9b132..28a94fb 100644 --- a/README.md +++ b/README.md @@ -68,9 +68,15 @@ jobs: #### Automatic contributor credits (opt-in) Apps with `scripts/refresh-contributors.py` can refresh bundled credits once before a release. -Call the read-only preparatory workflow, then pass its output to the release workflow: +Grant the caller workflow `contents: write` for release publishing, and keep the preparatory +`credits` job read-only with its job-level override. A called workflow cannot increase the +token permissions granted by its caller; see [reusable-workflow permissions](https://docs.github.com/en/actions/reference/workflows-and-actions/reusing-workflow-configurations#supported-keywords-for-jobs-that-call-a-reusable-workflow). +Call the preparatory workflow, then pass its output to the release workflow: ```yaml +permissions: + contents: write + jobs: credits: permissions: From 5d6a81953e7ef855dd06fe8dd57fb392abb9cdb4 Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Fri, 30 Oct 2026 23:14:08 -0400 Subject: [PATCH 13/23] fix(flatpak): install elfutils so flatpak-builder can eu-strip modules flatpak-builder only Recommends elfutils, which --no-install-recommends skips. Apps whose manifests now build cups-client from source (gridcraft, designcraft, wordcraft, pdfcraft) fail in the Flatpak job with: Failed to execute child process "eu-strip". Co-Authored-By: Claude Opus 5.5 --- .github/workflows/release.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e5473b6..e585177 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -619,7 +619,9 @@ jobs: - name: Install flatpak-builder run: | sudo apt-get update - sudo apt-get install -y --no-install-recommends flatpak flatpak-builder librsvg2-common + # elfutils is only a Recommends of flatpak-builder, but flatpak-builder runs its eu-strip + # on every module it builds with debuginfo, such as the apps' cups-client. + sudo apt-get install -y --no-install-recommends flatpak flatpak-builder elfutils librsvg2-common sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0 - name: Build the Flatpak bundle env: From 5cd19d05cb07bb389d82d0e200d9ee5f418f332f Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Sat, 31 Oct 2026 15:33:04 -0400 Subject: [PATCH 14/23] ci(flatpak): publish Flatpak OCI layout to GHCR alongside Flatpak builds (#113) --- .github/workflows/flatpak-oci.yml | 74 +++++++++++++++++++++++++++++++ .github/workflows/release.yml | 16 ++++++- 2 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/flatpak-oci.yml diff --git a/.github/workflows/flatpak-oci.yml b/.github/workflows/flatpak-oci.yml new file mode 100644 index 0000000..05e72e9 --- /dev/null +++ b/.github/workflows/flatpak-oci.yml @@ -0,0 +1,74 @@ +name: "Flatpak OCI" + +# Reusable workflow to package and publish a Flatpak application as an OCI image to GHCR. +# Pairs with the Flatpak Registry Index Protocol implemented in artcraft-services. +on: + workflow_call: + inputs: + app-name: + description: "Application repository name (e.g. pdfcraft, cadcraft)" + type: string + required: true + version: + description: "Release version string (e.g. 0.16.1)" + type: string + required: true + registry: + description: "Target container registry repository (defaults to ghcr.io/)" + type: string + required: false + default: "" + +permissions: + contents: read + packages: write + +jobs: + publish-oci: + name: Publish OCI ${{ matrix.arch }} + runs-on: ${{ matrix.runner }} + strategy: + fail-fast: false + matrix: + include: + - { arch: x86_64, runner: ubuntu-24.04 } + - { arch: aarch64, runner: ubuntu-24.04-arm } + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + + - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 + with: + name: release-linux-${{ matrix.arch }} + path: dist/linux + + - name: Install Flatpak and Skopeo + run: | + sudo apt-get update + sudo apt-get install -y --no-install-recommends flatpak flatpak-builder librsvg2-common skopeo + sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0 + + - name: Add Flathub Remote + run: flatpak remote-add --user --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo + + - name: Publish Flatpak OCI layout to GHCR + env: + RELEASE_VERSION: ${{ inputs.version }} + ARCH: ${{ matrix.arch }} + REGISTRY: ${{ inputs.registry || format('ghcr.io/{0}', github.repository) }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + shopt -s nullglob + tarballs=() + for f in dist/linux/*-"${RELEASE_VERSION}"-linux-"${ARCH}".tar.gz; do + case "${f##*/}" in *-cli-*|*-server-*) ;; *) tarballs+=("$f") ;; esac + done + if [ "${#tarballs[@]}" -ne 1 ]; then + echo "::error::expected one app tarball for ${RELEASE_VERSION} in release-linux-${ARCH}, found ${#tarballs[@]}: ${tarballs[*]}" + exit 1 + fi + tarball="${tarballs[0]}" + if [ -x packaging/linux/flatpak-oci.sh ]; then + packaging/linux/flatpak-oci.sh --push "$tarball" + else + echo "::warning::packaging/linux/flatpak-oci.sh not found or not executable" + fi diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e5473b6..b071975 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -555,6 +555,9 @@ jobs: name: Flatpak ${{ matrix.arch }} needs: [version, linux] runs-on: ${{ matrix.runner }} + permissions: + contents: read + packages: write strategy: fail-fast: false matrix: @@ -619,7 +622,7 @@ jobs: - name: Install flatpak-builder run: | sudo apt-get update - sudo apt-get install -y --no-install-recommends flatpak flatpak-builder librsvg2-common + sudo apt-get install -y --no-install-recommends flatpak flatpak-builder librsvg2-common skopeo sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0 - name: Build the Flatpak bundle env: @@ -640,6 +643,17 @@ jobs: fi tarball="${tarballs[0]}" packaging/linux/flatpak-bundle.sh "$tarball" + - name: Publish Flatpak OCI layout to GHCR + if: github.event_name != 'pull_request' + env: + RELEASE_VERSION: ${{ needs.version.outputs.version }} + ARCH: ${{ matrix.arch }} + REGISTRY: ghcr.io/${{ github.repository }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + if [ -x packaging/linux/flatpak-oci.sh ]; then + packaging/linux/flatpak-oci.sh --push "$tarball" + fi - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: name: release-flatpak-${{ matrix.arch }} From 09f920c3f494642ec47a98cc19eee671027ff74f Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Sat, 31 Oct 2026 15:43:24 -0400 Subject: [PATCH 15/23] feat: add Flatpak OCI repository scaffolding script and tests (#115) --- scripts/scaffold-flatpak-oci.sh | 236 +++++++++++++++++++++++++++++ tests/test_scaffold_flatpak_oci.py | 100 ++++++++++++ 2 files changed, 336 insertions(+) create mode 100755 scripts/scaffold-flatpak-oci.sh create mode 100644 tests/test_scaffold_flatpak_oci.py diff --git a/scripts/scaffold-flatpak-oci.sh b/scripts/scaffold-flatpak-oci.sh new file mode 100755 index 0000000..fa13076 --- /dev/null +++ b/scripts/scaffold-flatpak-oci.sh @@ -0,0 +1,236 @@ +#!/usr/bin/env bash +# scaffold-flatpak-oci.sh: Scaffold Flatpak OCI export (--oci) and GHCR publishing helper +# across Craft applications in the Storytold ecosystem. +# +# Usage: +# scripts/scaffold-flatpak-oci.sh [OPTIONS] [REPO_PATH...] +# +# Options: +# --all [DIR] Scan DIR (default: parent directory of this repo) and scaffold +# every repository containing packaging/linux/flatpak-bundle.sh. +# --verify Verify scaffolding across targets without modifying files. +# -h, --help Show this message. +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +ROOT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)" + +VERIFY_ONLY=0 +SCAN_ALL=0 +TARGET_DIR="$(cd "$ROOT_DIR/.." && pwd)" +TARGETS=() + +while [[ $# -gt 0 ]]; do + case "$1" in + --verify) + VERIFY_ONLY=1 + shift + ;; + --all) + SCAN_ALL=1 + shift + if [[ $# -gt 0 && ! "$1" =~ ^- ]]; then + TARGET_DIR="$1" + shift + fi + ;; + -h | --help) + sed -n '2,13p' "$0" + exit 0 + ;; + -*) + echo "unknown option: $1" >&2 + exit 2 + ;; + *) + TARGETS+=("$1") + shift + ;; + esac +done + +if [[ "$SCAN_ALL" -eq 1 ]]; then + shopt -s nullglob + for candidate in "$TARGET_DIR"/*; do + if [[ -d "$candidate" && -f "$candidate/packaging/linux/flatpak-bundle.sh" ]]; then + TARGETS+=("$candidate") + fi + done +fi + +if [[ ${#TARGETS[@]} -eq 0 ]]; then + echo "error: no target repositories specified (use --all or pass repo paths)" >&2 + exit 1 +fi + +scaffold_repo() { + local repo="$1" + local bundle_sh="$repo/packaging/linux/flatpak-bundle.sh" + local oci_sh="$repo/packaging/linux/flatpak-oci.sh" + + if [[ ! -f "$bundle_sh" ]]; then + echo "[-] $(basename "$repo"): no packaging/linux/flatpak-bundle.sh found, skipping" + return 0 + fi + + local app_id + app_id="$(grep -m1 '^APP_ID=' "$bundle_sh" | cut -d= -f2- | tr -d '"' | tr -d "'" || true)" + if [[ -z "$app_id" ]]; then + echo "[!] $(basename "$repo"): could not find APP_ID in $bundle_sh" + return 1 + fi + + local pkg + pkg="$(grep -m1 '^PKG=' "$bundle_sh" | cut -d= -f2- | tr -d '"' | tr -d "'" || true)" + if [[ -z "$pkg" ]]; then + pkg="$(basename "$repo")" + fi + + local has_oci_flag=0 + if grep -F -q -- '--oci' "$bundle_sh"; then + has_oci_flag=1 + fi + + local has_oci_script=0 + if [[ -f "$oci_sh" ]]; then + has_oci_script=1 + fi + + if [[ "$VERIFY_ONLY" -eq 1 ]]; then + if [[ "$has_oci_flag" -eq 1 && "$has_oci_script" -eq 1 ]]; then + echo "[✓] $(basename "$repo") ($app_id): fully scaffolded for Flatpak OCI" + else + echo "[✗] $(basename "$repo") ($app_id): missing (flag=$has_oci_flag, script=$has_oci_script)" + fi + return 0 + fi + + # 1. Update flatpak-bundle.sh if --oci is missing + if [[ "$has_oci_flag" -eq 0 ]]; then + echo "[+] $(basename "$repo"): adding --oci support to flatpak-bundle.sh" + python3 - "$bundle_sh" << 'EOF' +import sys + +path = sys.argv[1] +with open(path, 'r', encoding='utf-8') as f: + content = f.read() + +# Add OCI=0 after TEST=1 if not present +if "OCI=0" not in content and "TEST=1" in content: + content = content.replace("TEST=1\n", "TEST=1\nOCI=0\n", 1) + +# Add --oci option parsing +if "--oci)" not in content: + needle = '--no-test) TEST=0; shift ;;' + if needle in content: + content = content.replace(needle, needle + '\n --oci) OCI=1; shift ;;', 1) + +# Add OCI bundle export block after flatpak build-bundle +oci_block = """ +if [[ "$OCI" = 1 ]]; then + OUT_OCI="$DIST/$BASENAME-oci" + rm -rf "$OUT_OCI" + flatpak build-bundle --oci "$WORK/repo" "$OUT_OCI" "$APP_ID" stable + echo "wrote OCI layout to $OUT_OCI" +fi +""" + +if 'flatpak build-bundle --oci' not in content: + lines = content.split('\n') + new_lines = [] + inserted = False + for line in lines: + new_lines.append(line) + if not inserted and line.startswith('flatpak build-bundle ') and 'stable' in line: + # Look for the echo "wrote $OUT" line or append after + pass + if not inserted and 'echo "wrote $OUT"' in line: + new_lines.append(oci_block.strip('\n')) + inserted = True + content = '\n'.join(new_lines) + +with open(path, 'w', encoding='utf-8') as f: + f.write(content) +EOF + bash -n "$bundle_sh" || { echo "error: syntax error in modified $bundle_sh" >&2; return 1; } + fi + + # 2. Create flatpak-oci.sh if missing + if [[ "$has_oci_script" -eq 0 ]]; then + echo "[+] $(basename "$repo"): creating packaging/linux/flatpak-oci.sh" + cat > "$oci_sh" << EOF +#!/usr/bin/env bash +# Build $pkg as an OCI container layout and push it to GitHub Container Registry (GHCR) +# for consumption by Flatpak OCI clients (flatpak-oci-specs). +# +# Usage: +# packaging/linux/flatpak-oci.sh [--push] [TARBALL] +# +# Environment variables: +# REGISTRY Target registry image (default: ghcr.io/storytold/$pkg) +# TAG Target image tag (default: \$VERSION-\$ARCH, also tags stable-\$ARCH) +# GITHUB_TOKEN Token for GHCR authentication when --push is used +set -euo pipefail +# shellcheck source=../env.sh +. "\$(dirname "\${BASH_SOURCE[0]}")/../env.sh" +HERE="\$ROOT/packaging/linux" + +PUSH=0 +TARBALL="" +while [[ \$# -gt 0 ]]; do + case "\$1" in + --push) PUSH=1; shift ;; + -h | --help) sed -n '2,12p' "\$0"; exit 0 ;; + -*) echo "unknown argument: \$1" >&2; exit 2 ;; + *) TARBALL="\$1"; shift ;; + esac +done + +ARCH="\$(uname -m)" +case "\$ARCH" in + x86_64) ;; + aarch64 | arm64) ARCH=aarch64 ;; + *) echo "unsupported architecture \$ARCH" >&2; exit 2 ;; +esac + +BASENAME="$pkg-\$VERSION-linux-\$ARCH" +OUT_OCI="\$DIST/\$BASENAME-oci" + +echo "==> Building Flatpak OCI layout for \$BASENAME" +"\$HERE/flatpak-bundle.sh" --oci --no-test "\${TARBALL:-}" + +[[ -d "\$OUT_OCI" ]] || { echo "error: \$OUT_OCI layout not generated" >&2; exit 1; } + +REGISTRY="\${REGISTRY:-ghcr.io/storytold/$pkg}" +TAG="\${TAG:-\$VERSION-\$ARCH}" + +echo "==> OCI layout ready at \$OUT_OCI (Target: \$REGISTRY:\$TAG)" + +if [[ "\$PUSH" = 1 ]]; then + command -v skopeo >/dev/null || { echo "error: skopeo is required to push OCI images (apt install skopeo)" >&2; exit 1; } + + AUTH_ARGS=() + if [[ -n "\${GITHUB_TOKEN:-}" ]]; then + AUTH_ARGS=(--dest-creds "\${GITHUB_ACTOR:-storytold}:\$GITHUB_TOKEN") + fi + + echo "==> Pushing to \$REGISTRY:\$TAG" + skopeo copy --format oci "\${AUTH_ARGS[@]}" "oci:\$OUT_OCI" "docker://\$REGISTRY:\$TAG" + + # Also update architecture-specific stable tag + echo "==> Pushing to \$REGISTRY:stable-\$ARCH" + skopeo copy --format oci "\${AUTH_ARGS[@]}" "oci:\$OUT_OCI" "docker://\$REGISTRY:stable-\$ARCH" + + echo "==> Push complete" +fi +EOF + chmod +x "$oci_sh" + bash -n "$oci_sh" || { echo "error: syntax error in $oci_sh" >&2; return 1; } + fi + + echo "[✓] $(basename "$repo") ($app_id): Flatpak OCI ready" +} + +for target in "${TARGETS[@]}"; do + scaffold_repo "$target" +done diff --git a/tests/test_scaffold_flatpak_oci.py b/tests/test_scaffold_flatpak_oci.py new file mode 100644 index 0000000..6da69a4 --- /dev/null +++ b/tests/test_scaffold_flatpak_oci.py @@ -0,0 +1,100 @@ +"""Tests for the Flatpak OCI scaffolding tool.""" +from pathlib import Path +import os +import subprocess +import tempfile +import unittest + +ROOT = Path(__file__).resolve().parents[1] +SCRIPT = ROOT / "scripts/scaffold-flatpak-oci.sh" + +SAMPLE_BUNDLE_SH = """#!/usr/bin/env bash +set -euo pipefail +HERE="$ROOT/packaging/linux" +APP_ID=ai.storyteller.sampleapp +PKG=sampleapp +FLATHUB=https://dl.flathub.org/repo/flathub.flatpakrepo + +TEST=1 +TARBALL="" +while [[ $# -gt 0 ]]; do + case "$1" in + --no-test) TEST=0; shift ;; + -h | --help) sed -n '2,14p' "$0"; exit 0 ;; + -*) echo "unknown argument: $1" >&2; exit 2 ;; + *) TARBALL="$1"; shift ;; + esac +done + +ARCH="$(uname -m)" +BASENAME="$PKG-$VERSION-linux-$ARCH" +WORK="/tmp/bundle" +OUT="$DIST/$BASENAME.flatpak" +flatpak build-bundle --runtime-repo="$FLATHUB" "$WORK/repo" "$OUT" "$APP_ID" stable +echo "wrote $OUT" + +if [[ "$TEST" = 1 ]]; then + echo "test" +fi +""" + + +class ScaffoldFlatpakOciTests(unittest.TestCase): + def setUp(self): + self.temp_dir = tempfile.TemporaryDirectory() + self.repo_dir = Path(self.temp_dir.name) / "sampleapp" + self.packaging_dir = self.repo_dir / "packaging/linux" + self.packaging_dir.mkdir(parents=True) + self.bundle_file = self.packaging_dir / "flatpak-bundle.sh" + self.bundle_file.write_text(SAMPLE_BUNDLE_SH, encoding="utf-8") + self.bundle_file.chmod(0o755) + + def tearDown(self): + self.temp_dir.cleanup() + + def test_scaffolding_adds_oci_support(self): + # Initial verify should show missing + res = subprocess.run( + [str(SCRIPT), "--verify", str(self.repo_dir)], + capture_output=True, + text=True, + check=True, + ) + self.assertIn("missing (flag=0, script=0)", res.stdout) + + # Run scaffolding + res_scaffold = subprocess.run( + [str(SCRIPT), str(self.repo_dir)], + capture_output=True, + text=True, + check=True, + ) + self.assertIn("Flatpak OCI ready", res_scaffold.stdout) + + # Check bundle_sh has --oci flag and export block + updated_bundle = self.bundle_file.read_text(encoding="utf-8") + self.assertIn("OCI=0", updated_bundle) + self.assertIn("--oci) OCI=1; shift ;;", updated_bundle) + self.assertIn("flatpak build-bundle --oci", updated_bundle) + + # Check flatpak-oci.sh is created and executable + oci_script = self.packaging_dir / "flatpak-oci.sh" + self.assertTrue(oci_script.exists()) + self.assertTrue(os.access(oci_script, os.X_OK)) + + oci_content = oci_script.read_text(encoding="utf-8") + self.assertIn("ghcr.io/storytold/sampleapp", oci_content) + self.assertIn("skopeo copy", oci_content) + + # Final verify should pass + res_final = subprocess.run( + [str(SCRIPT), "--verify", str(self.repo_dir)], + capture_output=True, + text=True, + check=True, + ) + self.assertIn("fully scaffolded for Flatpak OCI", res_final.stdout) + + +if __name__ == "__main__": + unittest.main() From 84ad8817112de53102bf0881e870607e96c22434 Mon Sep 17 00:00:00 2001 From: FredApps <153173854+FredApps@users.noreply.github.com> Date: Sun, 1 Nov 2026 01:39:08 +0100 Subject: [PATCH 16/23] ci(windows-arm64): only main saves the packaging cache (#116) Pull requests that touch Windows packaging saved their own windows-arm64-package cache (about 0.7 GB), visible only to that pull request. Every app repository is at the 10 GB cache limit, so each one evicted a cache main's gate restores. The nightly run on main still saves it. Co-authored-by: FredApps Co-authored-by: Claude Opus 5.5 --- .github/workflows/windows-arm64.yml | 4 ++++ tests/test_windows_arm64.py | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/.github/workflows/windows-arm64.yml b/.github/workflows/windows-arm64.yml index c6f20dc..4fadd6e 100644 --- a/.github/workflows/windows-arm64.yml +++ b/.github/workflows/windows-arm64.yml @@ -62,9 +62,13 @@ jobs: with: toolchain: stable targets: aarch64-pc-windows-msvc + # The nightly run on main saves; pull requests and `release` restore it. A pull request's + # cache (about 0.7 GB) is visible to that pull request alone, and the apps' caches sit at + # the 10 GB limit, so each one evicted a cache main's gate restores. - uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3 with: key: windows-arm64-package + save-if: ${{ github.ref == 'refs/heads/main' }} - name: Install WiX uses: storytold/craft-common-actions/actions/install-wix@main with: diff --git a/tests/test_windows_arm64.py b/tests/test_windows_arm64.py index 9250bfd..8c1931a 100644 --- a/tests/test_windows_arm64.py +++ b/tests/test_windows_arm64.py @@ -206,5 +206,11 @@ function Invoke-FixtureCli([string] $Path, [string] $Argument) { self.assertEqual(processes, []) +class PackageCacheTests(unittest.TestCase): + def test_only_main_saves_the_package_cache(self): + cache = next(step for step in DATA['jobs']['package']['steps'] if 'rust-cache' in step.get('uses', '')) + self.assertEqual(cache['with']['save-if'], "${{ github.ref == 'refs/heads/main' }}") + + if __name__ == '__main__': unittest.main() From e031880d475ab2b374e7e3183fca0e04350051a9 Mon Sep 17 00:00:00 2001 From: FredApps <153173854+FredApps@users.noreply.github.com> Date: Sun, 1 Nov 2026 02:05:24 +0100 Subject: [PATCH 17/23] fix(install-apt-packages): time-limit and retry mirror downloads (#117) * fix(install-apt-packages): time-limit and retry mirror downloads A SonarCloud job in vectorcraft (run 41253493430) sat in this step for 58 minutes: the Azure Ubuntu mirror timed out, apt fell back to archive.ubuntu.com, then a connection went silent and apt printed nothing until the run was cancelled. Acquire::http::Timeout doesn't end a connection that stays open, so the job's 90-minute timeout was the only bound. apt-get update and a new --download-only pass now each run under timeout(1), 300 s per attempt, up to 3 attempts. The install itself then works from downloaded files only, so dpkg is never killed mid-configure. Acquire::https::Timeout is set alongside the http one for the HTTPS fallback. Co-Authored-By: Claude Opus 5.5 * fix(install-apt-packages): retry an update that fetched only some indexes apt-get update warns and exits 0 when an index fails to download, so the retry never ran for it. APT::Update::Error-Mode=any makes that a failure, which is retried. If indexes are still missing after the last attempt the step continues with a warning, as it did before: they often belong to a repository the packages don't need, and a package that needs one fails the download. Co-Authored-By: Claude Opus 5.5 --------- Co-authored-by: FredApps Co-authored-by: Claude Opus 5.5 --- actions/install-apt-packages/action.yml | 37 ++++++++++++-- tests/test_install_apt_packages.py | 64 +++++++++++++++++++++++++ 2 files changed, 98 insertions(+), 3 deletions(-) diff --git a/actions/install-apt-packages/action.yml b/actions/install-apt-packages/action.yml index 78fefae..9c1e9e6 100644 --- a/actions/install-apt-packages/action.yml +++ b/actions/install-apt-packages/action.yml @@ -54,6 +54,9 @@ runs: shell: bash env: PACKAGE_LIST: ${{ steps.key.outputs.list }} + # Seconds one attempt at a mirror download may take, and how many attempts are made. + APT_NETWORK_TIMEOUT: "300" + APT_NETWORK_ATTEMPTS: "3" run: | set -euo pipefail debs="$HOME/.cache/craft-apt-debs" @@ -63,10 +66,38 @@ runs: # A slow or stalled mirror connection is retried instead of holding the job for minutes. # The cache directory belongs to the runner user, so downloads run as root rather than as # apt's _apt sandbox user, which could not write there. - opts=(-o Acquire::Retries=3 -o Acquire::http::Timeout=30 -o "Dir::Cache::Archives=$debs" - -o APT::Keep-Downloaded-Packages=true -o APT::Sandbox::User=root) - sudo apt-get "${opts[@]}" update + opts=(-o Acquire::Retries=3 -o Acquire::http::Timeout=30 -o Acquire::https::Timeout=30 + -o "Dir::Cache::Archives=$debs" -o APT::Keep-Downloaded-Packages=true + -o APT::Sandbox::User=root) + # Acquire timeouts don't end a connection that stays open and sends nothing: one such + # stall held a job for 58 minutes until its own timeout. So each mirror download also has + # a wall-clock limit and is retried. Only downloads are limited; dpkg is never killed. + network() { + local attempt status + for ((attempt = 1; ; attempt++)); do + status=0 + sudo timeout --kill-after=30 "$APT_NETWORK_TIMEOUT" apt-get "${opts[@]}" "$@" || status=$? + if [ "$status" -eq 0 ] || [ "$attempt" -ge "$APT_NETWORK_ATTEMPTS" ]; then + return "$status" + fi + echo "::warning::install-apt-packages: apt-get $1 attempt $attempt exited $status (124: over ${APT_NETWORK_TIMEOUT}s); retrying" + sleep 5 + done + } + # Error-Mode=any: an index that failed to download fails the update, so it is retried + # (apt-get update otherwise warns and exits 0). Indexes still missing after the last + # attempt are only a warning, as before: often they belong to a repository the packages + # don't need, and a package that does need one fails the download below. + if ! network update -o APT::Update::Error-Mode=any; then + echo "::warning::install-apt-packages: apt-get update failed $APT_NETWORK_ATTEMPTS times; continuing with the indexes it has" + fi # shellcheck disable=SC2086 # the list is split into package names on purpose + if ! network install -y --no-install-recommends --download-only -- $PACKAGE_LIST; then + echo "::error::install-apt-packages: downloading the packages failed $APT_NETWORK_ATTEMPTS times" + exit 1 + fi + # Everything is downloaded: this only unpacks and configures, with no mirror to wait on. + # shellcheck disable=SC2086 sudo apt-get "${opts[@]}" install -y --no-install-recommends -- $PACKAGE_LIST sudo apt-get "${opts[@]}" autoclean sudo chown -R "$(id -u):$(id -g)" "$debs" diff --git a/tests/test_install_apt_packages.py b/tests/test_install_apt_packages.py index 4c6178f..f507f51 100644 --- a/tests/test_install_apt_packages.py +++ b/tests/test_install_apt_packages.py @@ -94,5 +94,69 @@ class InstallAptPackagesTests(unittest.TestCase): self.assertIn("::error::install-apt-packages:", res.stdout + res.stderr) + +# apt-get that logs its operation and stalls (sends nothing, never exits) while STALLS says so. +FAKE_APT = """#!/bin/bash +op=update +for arg in "$@"; do case "$arg" in update|install|autoclean) op=$arg ;; --download-only) op=download ;; esac; done +echo "$op" >> "$APT_LOG" +n=$(grep -c "^$op$" "$APT_LOG") +if [ "$op" = "${STALL_OP:-}" ] && [ "$n" -le "${STALLS:-0}" ]; then exec /usr/bin/sleep 60; fi +""" + + +class StalledMirrorTests(unittest.TestCase): + """The install step against a fake apt-get, with a one-second limit per mirror download.""" + + def run_install(self, stall_op='', stalls=0): + install_step = next(s for s in steps() if s.get('name') == 'Install packages') + self.assertEqual(install_step['env']['APT_NETWORK_TIMEOUT'], '300') + with tempfile.TemporaryDirectory() as tmpdir: + bin_dir = Path(tmpdir) / 'bin' + bin_dir.mkdir() + for name, body in [('apt-get', FAKE_APT), ('sudo', '#!/bin/bash\nexec "$@"\n'), ('sleep', '#!/bin/bash\n')]: + (bin_dir / name).write_text(body, newline='\n') + (bin_dir / name).chmod(0o755) + log = Path(tmpdir) / 'apt.log' + log.touch() + res = subprocess.run( + ['bash', '--noprofile', '--norc', '-e', '-o', 'pipefail', '-c', install_step['run']], + env={**os.environ, 'PATH': f"{bin_dir}{os.pathsep}{os.environ['PATH']}", 'HOME': tmpdir, + 'PACKAGE_LIST': 'curl git ', 'APT_NETWORK_TIMEOUT': '1', 'APT_NETWORK_ATTEMPTS': '3', + 'APT_LOG': str(log), 'STALL_OP': stall_op, 'STALLS': str(stalls)}, + capture_output=True, + text=True, + timeout=120, + ) + return res, log.read_text().split() + + def test_a_stalled_update_is_retried(self): + res, ops = self.run_install('update', stalls=1) + self.assertEqual(res.returncode, 0, res.stdout + res.stderr) + self.assertEqual(ops, ['update', 'update', 'download', 'install', 'autoclean']) + self.assertIn('apt-get update attempt 1 exited 124', res.stdout) + + def test_a_stalled_download_is_retried(self): + res, ops = self.run_install('download', stalls=2) + self.assertEqual(res.returncode, 0, res.stdout + res.stderr) + self.assertEqual(ops, ['update', 'download', 'download', 'download', 'install', 'autoclean']) + + def test_an_update_that_keeps_failing_continues_with_a_warning(self): + res, ops = self.run_install('update', stalls=99) + self.assertEqual(res.returncode, 0, res.stdout + res.stderr) + self.assertEqual(ops, ['update', 'update', 'update', 'download', 'install', 'autoclean']) + self.assertIn('::warning::install-apt-packages: apt-get update failed 3 times', res.stdout) + + def test_a_download_that_keeps_stalling_fails_before_installing(self): + res, ops = self.run_install('download', stalls=99) + self.assertNotEqual(res.returncode, 0) + self.assertEqual(ops, ['update', 'download', 'download', 'download']) + self.assertIn('::error::install-apt-packages: downloading the packages failed 3 times', res.stdout) + + def test_a_partly_failed_update_is_an_error_so_it_is_retried(self): + install_step = next(s for s in steps() if s.get('name') == 'Install packages') + self.assertIn('network update -o APT::Update::Error-Mode=any', install_step['run']) + + if __name__ == '__main__': unittest.main() From c1f5c18c013edbb7e04380541de638cedb29f884 Mon Sep 17 00:00:00 2001 From: FredApps Date: Sun, 1 Nov 2026 04:26:35 +0100 Subject: [PATCH 18/23] feat(gate): packages is optional; an empty list installs none Calls with nothing to install from apt (a Windows-only check, a wasm build) had to pass a package list the gate would ignore or install for nothing. packages now defaults to empty, and the apt step runs only on Linux legs that name packages. The README describes such second gate calls, with their own command and cache-version, instead of keeping web builds in the app's own workflow: the apps' CI rules now allow only calls to shared workflows (#118). Co-Authored-By: Claude Opus 5.5 --- .github/workflows/gate.yml | 7 ++++--- README.md | 17 ++++++++++++++--- tests/test_gate.py | 8 ++++++++ 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/.github/workflows/gate.yml b/.github/workflows/gate.yml index 6f44091..04a6069 100644 --- a/.github/workflows/gate.yml +++ b/.github/workflows/gate.yml @@ -7,9 +7,10 @@ on: workflow_call: inputs: packages: - description: "Ubuntu packages the build needs, separated by spaces or newlines; installed on Linux legs through the cached install-apt-packages action" + description: "Ubuntu packages the build needs, separated by spaces or newlines; installed on Linux legs through the cached install-apt-packages action. Empty installs none (Windows-only calls, wasm builds)" type: string - required: true + required: false + default: "" command: description: "The gate, run with bash from the repository root" type: string @@ -172,7 +173,7 @@ jobs: /opt/hostedtoolcache/CodeQL /dev/null 2>&1 & - name: Install Linux build dependencies - if: runner.os == 'Linux' + if: runner.os == 'Linux' && inputs.packages != '' uses: storytold/craft-common-actions/actions/install-apt-packages@main with: packages: ${{ inputs.packages }} diff --git a/README.md b/README.md index 4c2ce96..630bde0 100644 --- a/README.md +++ b/README.md @@ -347,7 +347,7 @@ The quality gate for an app's pull requests and pushes to main. It runs `command - the app and craft-fonts (at the suite's pin, with `CRAFT_FONTS_REQUIRED=1`) checked out without persisted credentials, and craft-i18n when the app has `craft-i18n.rev`; -- `packages` installed through `actions/install-apt-packages` on Linux legs; +- `packages` installed through `actions/install-apt-packages` on Linux legs (none when empty); - the channel from `rust-toolchain.toml`, or `toolchain`, with clippy, rustfmt and `targets`; - prebuilt cargo tools from `tools` (by default `cargo-nextest@0.9.150`); - `CARGO_PROFILE_DEV_DEBUG=line-tables-only` (set `dev-debug: ""` to keep the repository's @@ -360,8 +360,19 @@ The quality gate for an app's pull requests and pushes to main. It runs `command Cargo validates restored fingerprints. Bump `cache-version` to start afresh. After the gate, the job fails if `Cargo.lock` changed. Legs run with `fail-fast: false`; each has -`timeout-minutes` (default 60). Jobs only some apps need, such as fuzzing or web builds, stay in -the app's own workflow next to the call. +`timeout-minutes` (default 60). A job only some apps need, such as a web build or a Windows-only +check, can be a second call with its own `command`, `os`, `tools` and `targets`, and its own +`cache-version` so its cache (another profile or target) doesn't share the main gate's key: + +```yaml + web: + uses: storytold/craft-common-actions/.github/workflows/gate.yml@main + with: + cache-version: v1-web + craft-fonts-ref: "" + tools: trunk@0.21.14 + command: packaging/web/package.sh +``` #### Caller Example: ```yaml diff --git a/tests/test_gate.py b/tests/test_gate.py index cbb8bdc..848c5cb 100644 --- a/tests/test_gate.py +++ b/tests/test_gate.py @@ -35,6 +35,14 @@ class GateWorkflowTests(unittest.TestCase): self.assertIn("inputs.cache-save-on-dispatch && github.event_name == 'workflow_dispatch'", condition) self.assertEqual(WORKFLOW['on']['workflow_call']['inputs']['cache-save-on-dispatch']['default'], 'false') + def test_packages_are_optional_and_empty_installs_none(self): + packages = WORKFLOW['on']['workflow_call']['inputs']['packages'] + self.assertEqual(packages['required'], 'false') + self.assertEqual(packages['default'], '') + condition = step('Install Linux build dependencies')['if'] + self.assertIn("runner.os == 'Linux'", condition) + self.assertIn("inputs.packages != ''", condition) + def test_inputs_reach_scripts_only_through_env(self): for s in STEPS: if 'run' in s: From 0cb1ecf84c375aca0272153dd2a466888c2932d8 Mon Sep 17 00:00:00 2001 From: FredApps Date: Sun, 1 Nov 2026 04:46:49 +0100 Subject: [PATCH 19/23] docs(gate): spell out os and targets in the second-call example Co-Authored-By: Claude Opus 5.5 --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 630bde0..663551c 100644 --- a/README.md +++ b/README.md @@ -369,6 +369,8 @@ check, can be a second call with its own `command`, `os`, `tools` and `targets`, uses: storytold/craft-common-actions/.github/workflows/gate.yml@main with: cache-version: v1-web + os: '["ubuntu-24.04"]' + targets: wasm32-unknown-unknown craft-fonts-ref: "" tools: trunk@0.21.14 command: packaging/web/package.sh From 37960c37b563a2e5d42117f400cd2ed483d3d4c1 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Sat, 31 Oct 2026 23:50:07 -0400 Subject: [PATCH 20/23] fix: pass Linux tarball to Flatpak OCI publishing (#120) --- .github/workflows/release.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b071975..d83d275 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -625,6 +625,7 @@ jobs: sudo apt-get install -y --no-install-recommends flatpak flatpak-builder librsvg2-common skopeo sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0 - name: Build the Flatpak bundle + id: flatpak_bundle env: RELEASE_VERSION: ${{ needs.version.outputs.version }} ARCH: ${{ matrix.arch }} @@ -643,6 +644,7 @@ jobs: fi tarball="${tarballs[0]}" packaging/linux/flatpak-bundle.sh "$tarball" + printf 'tarball=%s\n' "$tarball" >> "$GITHUB_OUTPUT" - name: Publish Flatpak OCI layout to GHCR if: github.event_name != 'pull_request' env: @@ -650,9 +652,10 @@ jobs: ARCH: ${{ matrix.arch }} REGISTRY: ghcr.io/${{ github.repository }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + TARBALL: ${{ steps.flatpak_bundle.outputs.tarball }} run: | if [ -x packaging/linux/flatpak-oci.sh ]; then - packaging/linux/flatpak-oci.sh --push "$tarball" + packaging/linux/flatpak-oci.sh --push "$TARBALL" fi - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: From c926ea426a5bafbd8fa1b45c962b18d4a4478b69 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Sat, 31 Oct 2026 23:58:50 -0400 Subject: [PATCH 21/23] fix: retry macOS release verification (#121) --- .github/workflows/release.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d83d275..d007116 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -301,7 +301,17 @@ jobs: APPLE_ID: ${{ secrets.APPLE_ID }} APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }} APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} - run: packaging/macos/verify.sh --arch universal + run: | + for attempt in 1 2 3 4; do + if packaging/macos/verify.sh --arch universal; then + exit 0 + fi + if [ "$attempt" -eq 4 ]; then + exit 1 + fi + echo "macOS verification failed (attempt $attempt of 4); retrying in 20 seconds" >&2 + sleep 20 + done - name: Note missing macOS verification if: github.ref == 'refs/heads/release' && hashFiles('packaging/macos/verify.sh') == '' run: echo "::warning::packaging/macos/verify.sh is missing, so this release was not checked for a signature or notarization ticket." From 52dc54c75edf4e8e3355a89dde77b596d7a025e4 Mon Sep 17 00:00:00 2001 From: FredApps <153173854+FredApps@users.noreply.github.com> Date: Sun, 1 Nov 2026 05:32:27 +0100 Subject: [PATCH 22/23] ci: pin install-action v2.87.33, the first that knows cargo-nextest 0.9.150 (#122) v2.87.29 knows nextest only up to 0.9.148, so every gate and coverage run that installs the pinned cargo-nextest@0.9.150 fell back to cargo-binstall@latest: an unpinned download, then a binstall of nextest. v2.87.33 is the oldest release whose manifest has 0.9.150; the releases since v2.87.29 change only tool manifests. Co-authored-by: FredApps Co-authored-by: Claude Opus 5.5 --- .github/workflows/gate.yml | 2 +- .github/workflows/sonarcloud.yml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/gate.yml b/.github/workflows/gate.yml index 6f44091..557f6c0 100644 --- a/.github/workflows/gate.yml +++ b/.github/workflows/gate.yml @@ -198,7 +198,7 @@ jobs: - name: Install cargo tools if: inputs.tools != '' - uses: taiki-e/install-action@8cca0918f8471c33515202b73f56ab27f2bed283 # v2.87.29 + uses: taiki-e/install-action@645d1ab48b3cb8591684a8b730b2ccf4cb3f9568 # v2.87.33 with: tool: ${{ inputs.tools }} diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 39f7301..c5d6628 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -119,7 +119,7 @@ jobs: run: | rustup toolchain install stable --profile minimal --component llvm-tools-preview rustup default stable - - uses: taiki-e/install-action@8cca0918f8471c33515202b73f56ab27f2bed283 # v2.87.29 + - uses: taiki-e/install-action@645d1ab48b3cb8591684a8b730b2ccf4cb3f9568 # v2.87.33 with: tool: cargo-llvm-cov,cargo-nextest@0.9.150 - uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3 @@ -184,7 +184,7 @@ jobs: pkg-config libxkbcommon-dev libwayland-dev libx11-dev libxcursor-dev libxrandr-dev libxi-dev libgtk-3-dev libfontconfig1-dev libfreetype-dev libasound2-dev libgl1-mesa-dev mesa-vulkan-drivers - - uses: taiki-e/install-action@8cca0918f8471c33515202b73f56ab27f2bed283 # v2.87.29 + - uses: taiki-e/install-action@645d1ab48b3cb8591684a8b730b2ccf4cb3f9568 # v2.87.33 with: tool: cargo-nextest@0.9.150 - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 @@ -292,7 +292,7 @@ jobs: run: | rustup toolchain install stable --profile minimal --component llvm-tools-preview rustup default stable - - uses: taiki-e/install-action@8cca0918f8471c33515202b73f56ab27f2bed283 # v2.87.29 + - uses: taiki-e/install-action@645d1ab48b3cb8591684a8b730b2ccf4cb3f9568 # v2.87.33 if: steps.token.outputs.available == 'true' && hashFiles('Cargo.toml') != '' && inputs.shards <= 1 with: tool: cargo-llvm-cov From 7d24ca64b1eeba52c1a97515b1449a25d91b1936 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 1 Nov 2026 04:35:59 +0000 Subject: [PATCH 23/23] ci(deps): bump the actions group across 1 directory with 2 updates Bumps the actions group with 2 updates in the / directory: [taiki-e/install-action](https://github.com/taiki-e/install-action) and [SonarSource/sonarqube-scan-action](https://github.com/sonarsource/sonarqube-scan-action). Updates `taiki-e/install-action` from 2.87.33 to 2.88.0 - [Release notes](https://github.com/taiki-e/install-action/releases) - [Changelog](https://github.com/taiki-e/install-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/taiki-e/install-action/compare/645d1ab48b3cb8591684a8b730b2ccf4cb3f9568...86f7a0ffb25f40114606501a311ebcfaf882ea32) Updates `SonarSource/sonarqube-scan-action` from 8.3.0 to 8.4.0 - [Release notes](https://github.com/sonarsource/sonarqube-scan-action/releases) - [Commits](https://github.com/sonarsource/sonarqube-scan-action/compare/d209202bc7d53ff1cc128f7f907dac145c9d6ae9...4d1dc0c91ee400dcf8a6dddf2f705ac36542e304) --- updated-dependencies: - dependency-name: SonarSource/sonarqube-scan-action dependency-version: 8.4.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: actions - dependency-name: taiki-e/install-action dependency-version: 2.87.32 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: actions ... Signed-off-by: dependabot[bot] --- .github/workflows/gate.yml | 2 +- .github/workflows/sonarcloud.yml | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/gate.yml b/.github/workflows/gate.yml index 557f6c0..58045dc 100644 --- a/.github/workflows/gate.yml +++ b/.github/workflows/gate.yml @@ -198,7 +198,7 @@ jobs: - name: Install cargo tools if: inputs.tools != '' - uses: taiki-e/install-action@645d1ab48b3cb8591684a8b730b2ccf4cb3f9568 # v2.87.33 + uses: taiki-e/install-action@86f7a0ffb25f40114606501a311ebcfaf882ea32 # v2.88.0 with: tool: ${{ inputs.tools }} diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index c5d6628..e1d78e4 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -119,7 +119,7 @@ jobs: run: | rustup toolchain install stable --profile minimal --component llvm-tools-preview rustup default stable - - uses: taiki-e/install-action@645d1ab48b3cb8591684a8b730b2ccf4cb3f9568 # v2.87.33 + - uses: taiki-e/install-action@86f7a0ffb25f40114606501a311ebcfaf882ea32 # v2.88.0 with: tool: cargo-llvm-cov,cargo-nextest@0.9.150 - uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3 @@ -184,7 +184,7 @@ jobs: pkg-config libxkbcommon-dev libwayland-dev libx11-dev libxcursor-dev libxrandr-dev libxi-dev libgtk-3-dev libfontconfig1-dev libfreetype-dev libasound2-dev libgl1-mesa-dev mesa-vulkan-drivers - - uses: taiki-e/install-action@645d1ab48b3cb8591684a8b730b2ccf4cb3f9568 # v2.87.33 + - uses: taiki-e/install-action@86f7a0ffb25f40114606501a311ebcfaf882ea32 # v2.88.0 with: tool: cargo-nextest@0.9.150 - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 @@ -292,7 +292,7 @@ jobs: run: | rustup toolchain install stable --profile minimal --component llvm-tools-preview rustup default stable - - uses: taiki-e/install-action@645d1ab48b3cb8591684a8b730b2ccf4cb3f9568 # v2.87.33 + - uses: taiki-e/install-action@86f7a0ffb25f40114606501a311ebcfaf882ea32 # v2.88.0 if: steps.token.outputs.available == 'true' && hashFiles('Cargo.toml') != '' && inputs.shards <= 1 with: tool: cargo-llvm-cov @@ -405,7 +405,7 @@ jobs: exit "$status" - name: SonarCloud Scan if: steps.token.outputs.available == 'true' - uses: SonarSource/sonarqube-scan-action@d209202bc7d53ff1cc128f7f907dac145c9d6ae9 # v8.3.0 + uses: SonarSource/sonarqube-scan-action@4d1dc0c91ee400dcf8a6dddf2f705ac36542e304 # v8.4.0 env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} SONAR_HOST_URL: https://sonarcloud.io