[repo] FabricaRelease: Rosea as a Fabrica app: the release and e2e pipelines, the Aula page's words and pictures, the version check, the APK signed in Custos, domi-rosea:// from the installer, the phone target
This commit is contained in:
@@ -103,6 +103,45 @@ describe('tauri.conf.json', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('domi-rosea://open, from the installer (fabrica-release.md F5)', () => {
|
||||
const windows = JSON.parse(readFileSync(join(SRC_TAURI, 'tauri.windows.conf.json'), 'utf8')) as {
|
||||
bundle: { windows?: { nsis?: { installerHooks?: string; installMode?: string } } };
|
||||
};
|
||||
const hooksPath = windows.bundle.windows?.nsis?.installerHooks ?? '';
|
||||
const hooks = existsSync(join(SRC_TAURI, hooksPath)) ? readFileSync(join(SRC_TAURI, hooksPath), 'utf8') : '';
|
||||
/** The NSIS statements of one macro, comments dropped. */
|
||||
const macro = (name: string): string[] =>
|
||||
(new RegExp(`!macro ${name}\\r?\\n([\\s\\S]*?)!macroend`).exec(hooks)?.[1] ?? '')
|
||||
.split(/\r?\n/)
|
||||
.map((l) => l.trim())
|
||||
.filter((l) => l !== '' && !l.startsWith(';'));
|
||||
|
||||
it('the Windows installer runs the hooks file, and installs for the current user only', () => {
|
||||
expect(hooksPath).toBe('./windows/hooks.nsh');
|
||||
expect(hooks).not.toBe('');
|
||||
const nsis = (conf.bundle as { windows?: { nsis?: { installMode?: string } } }).windows?.nsis;
|
||||
expect(nsis?.installMode).toBe('currentUser');
|
||||
});
|
||||
|
||||
it('registers exactly the domi-rosea scheme under HKCU, opening the installed exe with the address', () => {
|
||||
expect(macro('NSIS_HOOK_POSTINSTALL')).toEqual([
|
||||
'WriteRegStr HKCU "Software\\Classes\\domi-rosea" "" "URL:Rosea Domi"',
|
||||
'WriteRegStr HKCU "Software\\Classes\\domi-rosea" "URL Protocol" ""',
|
||||
`WriteRegStr HKCU "Software\\Classes\\domi-rosea\\DefaultIcon" "" '"$INSTDIR\\\${MAINBINARYNAME}.exe",0'`,
|
||||
`WriteRegStr HKCU "Software\\Classes\\domi-rosea\\shell\\open\\command" "" '"$INSTDIR\\\${MAINBINARYNAME}.exe" "%1"'`
|
||||
]);
|
||||
});
|
||||
|
||||
it('the uninstaller removes that key and nothing else', () => {
|
||||
expect(macro('NSIS_HOOK_POSTUNINSTALL')).toEqual(['DeleteRegKey HKCU "Software\\Classes\\domi-rosea"']);
|
||||
});
|
||||
|
||||
it('writes nowhere else: no machine-wide key, no other hook', () => {
|
||||
expect(hooks).not.toMatch(/HKLM|HKCR|HKEY_/);
|
||||
expect([...hooks.matchAll(/!macro (\w+)/g)].map((m) => m[1])).toEqual(['NSIS_HOOK_POSTINSTALL', 'NSIS_HOOK_POSTUNINSTALL']);
|
||||
});
|
||||
});
|
||||
|
||||
describe('the Rust side (D5)', () => {
|
||||
it('depends on tauri alone: no plugin, no SDK', () => {
|
||||
const cargo = readFileSync(join(SRC_TAURI, 'Cargo.toml'), 'utf8');
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
/**
|
||||
* The release APK is signed in Custos and nowhere else (fabrica-release.md F4): the arguments
|
||||
* name the one key, the exact repository and a tag, and the script never falls back to another
|
||||
* custos-sign or another Custos.
|
||||
*/
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { join } from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { APK_KEY, custosSign, signArgs, signedApkName, UNSIGNED_APK } from '../src/sign-apk.js';
|
||||
|
||||
const COMMIT = 'a'.repeat(40);
|
||||
const pkg = JSON.parse(readFileSync(join(fileURLToPath(new URL('..', import.meta.url)), 'package.json'), 'utf8')) as { scripts: Record<string, string> };
|
||||
|
||||
describe('signArgs', () => {
|
||||
it('asks for rosea-android, scoped to mnovak/Rosea, the release pipeline and a tag', () => {
|
||||
const args = signArgs({ version: '0.1.0', commit: COMMIT, unsigned: 'in.apk', out: 'out.apk' });
|
||||
expect(args).toEqual([
|
||||
'apk', 'in.apk', '--out', 'out.apk', '--key', 'rosea-android', '--repo', 'mnovak/Rosea', '--pipeline', 'release',
|
||||
'--commit', COMMIT, '--trigger', 'tag', '--run', 'rosea-v0.1.0', '--version', '0.1.0', '--step', 'apk'
|
||||
]);
|
||||
expect(APK_KEY).toBe('rosea-android');
|
||||
});
|
||||
|
||||
it('refuses a version or a commit that is not one', () => {
|
||||
expect(() => signArgs({ version: 'v0.1.0', commit: COMMIT, unsigned: 'a', out: 'b' })).toThrow(/not a version/);
|
||||
expect(() => signArgs({ version: '0.1.0', commit: 'HEAD', unsigned: 'a', out: 'b' })).toThrow(/not a commit/);
|
||||
});
|
||||
|
||||
it('names the published APK by app, version and ABI', () => {
|
||||
expect(signedApkName('0.1.0')).toBe('rosea-domi-0.1.0-arm64.apk');
|
||||
});
|
||||
|
||||
it('signs the release build that android.ts verified, never the debug one', () => {
|
||||
expect(UNSIGNED_APK).toContain('/release/');
|
||||
expect(pkg.scripts['build:android-release']).toContain(`verify src-tauri/${UNSIGNED_APK}`);
|
||||
expect(pkg.scripts['build:android-release']).not.toContain('--debug');
|
||||
});
|
||||
});
|
||||
|
||||
describe('custosSign', () => {
|
||||
it('runs the custos-sign CUSTOS_SIGN_EXE names, else the one on PATH', () => {
|
||||
expect(custosSign({ CUSTOS_SIGN_EXE: 'F:\Apps\Custos\custos-sign.exe' }, () => true)).toBe('F:\Apps\Custos\custos-sign.exe');
|
||||
expect(custosSign({}, () => true)).toBe('custos-sign.exe');
|
||||
});
|
||||
|
||||
it('refuses a named custos-sign that is not there, rather than another one', () => {
|
||||
expect(() => custosSign({ CUSTOS_SIGN_EXE: 'X:\nowhere.exe' }, () => false)).toThrow(/not there/);
|
||||
});
|
||||
|
||||
it('refuses another Custos (CUSTOS_PIPE)', () => {
|
||||
expect(() => custosSign({ CUSTOS_PIPE: '\\.\pipe\test' }, () => true)).toThrow(/CUSTOS_PIPE/);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user