build(release): a Dart release tool for every app
tool/release.dart releases one app: `dart run tool/release.dart learn [major | minor | patch] [--dry-run]`, each app configured in Dart beside it (apps/learn/release.dart). Every step and check of tool/release.sh is kept: the repository as pushed, resuming after a release commit and tag, Flutter as CI pins it, the tools, the key and its certificate pin, secrets asked for without echo and never written down, CI green on the newest commit, the signed release commit and tag by a key deploys accept, the APK built from a checkout of the tag and checked, the snap, the signed checksums, pushing only after both builds passed, the release on Forgejo, the F-Droid repository, the Snap Store once a channel is set. New: tags per app (learn-v0.19.0, Learn's v… counting as its history); only commits touching the app decide its version (its folder, the shared packages it uses by path, the root pubspec and lock, its release files, where its packages were before the move); --dry-run reads all of it, lists every step and the notes, and what a release would refuse, changing nothing. The pure parts are tested in test/release/. Learn releases build 21 with tool/release.sh, then switches. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
parent
1b62c8098c
commit
e65f61bdd1
1 changed files with 2334 additions and 12 deletions
77
test/release/app_release_test.dart
Normal file
77
test/release/app_release_test.dart
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
import 'dart:io';
|
||||
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import '../../apps/learn/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'),
|
||||
);
|
||||
});
|
||||
}
|
||||
Loading…
Reference in a new issue