tool/with_signing_keys.sh reads each keystore's password from its item's hidden field "Password" and hands it to the release tool in its environment (<keystore variable>_PASSWORD), but for a dry run, which asks for no secret; the release tool takes a secret from there where it is set, else asks as before (the Forgejo token from HALKYON_FORGEJO_TOKEN). Typing them guarded nothing the Pass session didn't already open. The release tool checks fdroid, rsync, curl and jq with the other tools, so a dry run says when one is missing, rather than the F-Droid script after the passwords. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
62 lines
2.1 KiB
Dart
62 lines
2.1 KiB
Dart
import 'dart:io';
|
||
|
||
import 'package:test/test.dart';
|
||
|
||
import '../../tool/src/release/apps.dart';
|
||
|
||
/// `tool/with_signing_keys.sh` fetches each app's keys from Proton Pass for a
|
||
/// release: it must know every app released, by the item its key is kept in
|
||
/// and the variable the release tool reads its path from.
|
||
void main() {
|
||
// The test runs in the repository's root, as `dart test` does.
|
||
final script = File('tool/with_signing_keys.sh').readAsStringSync();
|
||
|
||
test('every app released has its key fetched, under the variable the '
|
||
'release tool reads, from the item named for it', () {
|
||
for (final app in releasedApps.values) {
|
||
expect(
|
||
script,
|
||
contains(
|
||
' ${app.id}) app_variable=${app.android.keystoreVariable} '
|
||
"app_item='${app.name} – Android release keystore' ;;",
|
||
),
|
||
reason: app.id,
|
||
);
|
||
}
|
||
});
|
||
|
||
test("the F-Droid index's key comes along for an app listed there", () {
|
||
expect(releasedApps.values.where((app) => app.fdroid != null), isNotEmpty);
|
||
expect(script, contains('HALKYON_FDROID_KEYSTORE='));
|
||
expect(
|
||
script,
|
||
contains("fdroid_item='Halkyon Learn – F-Droid index keystore'"),
|
||
);
|
||
});
|
||
|
||
test('the keys go to a folder in memory, removed however the run ends', () {
|
||
expect(script, contains(r'mktemp -d -p "$XDG_RUNTIME_DIR"'));
|
||
expect(script, contains("trap 'rm -rf \"\$keys\"' EXIT"));
|
||
});
|
||
|
||
test("the keystores' passwords come from the items' field Password, "
|
||
'under the variables the release tool reads them from, but for a dry '
|
||
'run', () {
|
||
final releaser = File('tool/src/release/releaser.dart').readAsStringSync();
|
||
expect(script, contains('select(.name == "Password")'));
|
||
expect(
|
||
script,
|
||
contains(r'export "${app_variable}_PASSWORD=$app_password"'),
|
||
);
|
||
expect(
|
||
releaser,
|
||
contains(r"variable: '${app.android.keystoreVariable}_PASSWORD'"),
|
||
);
|
||
expect(
|
||
script,
|
||
contains(r'export HALKYON_FDROID_KEYSTORE_PASSWORD="$fdroid_password"'),
|
||
);
|
||
expect(releaser, contains("variable: 'HALKYON_FDROID_KEYSTORE_PASSWORD'"));
|
||
expect(script, contains(r'if ! $dry_run; then'));
|
||
});
|
||
}
|