halkyon/test/release/app_release_test.dart
Tizian 「ティツィアーン」 48951c1e1a
build(train): Train is released as Learn is, with a key of its own, beside it in the F-Droid repository (ADR 0030, D58)
apps/train/release.dart configures the release tool for Train's APK on
train.halkyon.eu; its release builds sign with its own key when the tool
hands it over. Its F-Droid listing declares NonFreeDep for Polar's SDK and
NonFreeNet; the repository's script copies each app's icon. The key's
certificate is pinned once the key is made.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
2026-10-30 17:05:10 +01:00

111 lines
3.3 KiB
Dart

import 'dart:io';
import 'package:test/test.dart';
import '../../apps/learn/release.dart';
import '../../apps/train/release.dart';
import '../../tool/src/release/apps.dart';
import '../../tool/src/release/version.dart';
import 'fixtures.dart';
void main() {
test("an app's release names its files and tags by its id", () {
expect(testApp.tagPrefix, 'notes-v');
expect(testApp.pubspec, 'apps/notes/halkyon_notes_flutter/pubspec.yaml');
expect(testApp.instance, 'notes.halkyon.eu');
expect(
testApp.apkFile(const Version(0, 19, 0)),
'halkyon-notes-0.19.0.apk',
);
expect(
testApp.snapFile(const Version(0, 19, 0)),
'halkyon-notes_0.19.0_amd64.snap',
);
});
test('a configuration that would release something wrong is refused', () {
expect(testApp.problems(), isEmpty);
expect(
testApp.copyWith(id: 'Notes App').problems(),
contains('The id "Notes App" is not lower-case letters and digits.'),
);
expect(
testApp.copyWith(serverUrl: 'http://notes.halkyon.eu/').problems(),
contains("The server URL http://notes.halkyon.eu/ isn't HTTPS."),
);
expect(
testApp.copyWith(serverUrl: 'https://notes.halkyon.eu').problems(),
contains(
"The server URL https://notes.halkyon.eu doesn't end with a slash, "
'as the app is built with it.',
),
);
expect(
testApp
.copyWith(flutterPackage: 'apps/todo/halkyon_todo_flutter')
.problems(),
contains(
"The Flutter package apps/todo/halkyon_todo_flutter isn't in "
'apps/notes.',
),
);
expect(
testApp.copyWith(applicationId: 'notes').problems(),
contains("The application ID notes isn't one Android takes."),
);
});
test("Learn's release is registered, sound, and names files that exist", () {
expect(releasedApps['learn'], same(learnRelease));
expect(learnRelease.problems(), isEmpty);
// The test runs in the repository's root, as `dart test` does.
for (final path in [
learnRelease.pubspec,
learnRelease.android.certificateFile,
...learnRelease.releaseFiles,
]) {
expect(
FileSystemEntity.typeSync(path),
isNot(FileSystemEntityType.notFound),
reason: path,
);
}
expect(
File('${learnRelease.snap!.directory}/snapcraft.yaml').readAsStringSync(),
contains('name: ${learnRelease.snap!.name}\n'),
);
});
test("Train's release is registered, sound, names files that exist, and "
'has a key of its own', () {
expect(releasedApps['train'], same(trainRelease));
expect(trainRelease.problems(), isEmpty);
for (final path in [
trainRelease.pubspec,
trainRelease.android.certificateFile,
...trainRelease.releaseFiles,
]) {
expect(
FileSystemEntity.typeSync(path),
isNot(FileSystemEntityType.notFound),
reason: path,
);
}
expect(trainRelease.snap, isNull);
expect(
trainRelease.android.certificateFile,
isNot(learnRelease.android.certificateFile),
);
expect(
trainRelease.android.defaultKeystore,
isNot(learnRelease.android.defaultKeystore),
);
expect(
File(
'${trainRelease.fdroid!.listing}/metadata/'
'${trainRelease.applicationId}.yml',
).readAsStringSync(),
contains('NonFreeDep'),
);
});
}