chore: only run appflowy cloud if it's not exist (#5799)

* chore: only run appflowy cloud if it's not exist

* chore: update

* chore: log error

* chore: fix sign out test

* chore: update test
This commit is contained in:
Nathan.fooo 2024-07-25 07:59:03 +08:00 committed by GitHub
parent 01747f13e8
commit 1e54c2dc7c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 71 additions and 54 deletions

View File

@ -248,10 +248,13 @@ jobs:
env:
BACKEND_VERSION: 0.3.24-amd64
run: |
docker compose down -v --remove-orphans
if [ "$(docker ps --filter name=appflowy-cloud -q)" == "" ]; then
docker compose pull
docker compose up -d
sleep 10
else
echo "Docker container 'appflowy-cloud' is already running."
fi
- name: Checkout source code
uses: actions/checkout@v4

View File

@ -106,11 +106,14 @@ jobs:
- name: Run Docker-Compose
working-directory: AppFlowy-Cloud
env:
BACKEND_VERSION: 0.3.24-amd64
run: |
docker pull appflowyinc/appflowy_cloud:latest
if [ "$(docker ps --filter name=appflowy-cloud -q)" == "" ]; then
docker compose pull
docker compose up -d
sleep 10
else
echo "Docker container 'appflowy-cloud' is already running."
fi
- name: Run rust-lib tests
working-directory: frontend/rust-lib

View File

@ -47,11 +47,11 @@ void main() {
);
await tester.tapButton(find.byType(SignInOutButton));
tester.expectToSeeText(LocaleKeys.button_confirm.tr());
await tester.tapButtonWithName(LocaleKeys.button_confirm.tr());
tester.expectToSeeText(LocaleKeys.button_ok.tr());
await tester.tapButtonWithName(LocaleKeys.button_ok.tr());
// Go to the sign in page again
await tester.pumpAndSettle(const Duration(seconds: 1));
await tester.pumpAndSettle(const Duration(seconds: 5));
tester.expectToSeeGoogleLoginButton();
});

View File

@ -50,10 +50,10 @@ void main() {
await tester.tapEscButton();
// wait 2 seconds for the sync to finish
await tester.pumpAndSettle(const Duration(seconds: 2));
});
await tester.pumpAndSettle(const Duration(seconds: 6));
});
testWidgets('get user icon and name from server', (tester) async {
await tester.initializeAppFlowy(
cloudType: AuthenticatorType.appflowyCloudSelfHost,
@ -72,4 +72,6 @@ void main() {
expect(profileSetting.name, name);
});
});
}

View File

@ -10,6 +10,7 @@ import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart';
import 'package:appflowy_backend/protobuf/flowy-user/protobuf.dart';
import 'package:appflowy_result/appflowy_result.dart';
import 'package:flowy_infra/uuid.dart';
import 'package:flutter/material.dart';
/// Only used for testing.
class AppFlowyCloudMockAuthService implements AuthService {
@ -64,12 +65,18 @@ class AppFlowyCloudMockAuthService implements AuthService {
);
Log.info("UserEventOauthSignIn with payload: $payload");
return UserEventOauthSignIn(payload).send().then((value) {
value.fold((l) => null, (err) => Log.error(err));
value.fold(
(l) => null,
(err) {
debugPrint("Error: $err");
Log.error(err);
},
);
return value;
});
},
(r) {
Log.error(r);
debugPrint("Error: $r");
return FlowyResult.failure(r);
},
);

View File

@ -411,7 +411,8 @@ class _UserProfileSettingState extends State<UserProfileSetting> {
),
const HSpace(16),
if (!isEditing) ...[
Padding(
Flexible(
child: Padding(
padding: const EdgeInsets.only(top: 12),
child: Row(
mainAxisSize: MainAxisSize.min,
@ -437,6 +438,7 @@ class _UserProfileSettingState extends State<UserProfileSetting> {
],
),
),
),
] else ...[
Flexible(
child: SettingsInputField(