Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into release_to_dev
Browse files Browse the repository at this point in the history
  • Loading branch information
kosukesaigusa committed Sep 21, 2023
2 parents 23c74e9 + 6564965 commit 9bb4f91
Show file tree
Hide file tree
Showing 39 changed files with 1,713 additions and 428 deletions.
2 changes: 1 addition & 1 deletion .fvm/fvm_config.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"flutterSdkVersion": "3.10.6",
"flutterSdkVersion": "3.13.0",
"flavors": {}
}
32 changes: 16 additions & 16 deletions .github/workflows/flutter_ci_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,20 @@ jobs:
changed_files=$(git diff $base_sha $current_sha --name-only | grep '\.dart$' || true)
if [[ -n "$changed_files" ]]; then
echo "Dart files changed."
echo "dart-changes=true" >> $GITHUB_ENV
echo "::set-output name=run-tests::true"
else
echo "No Dart files changed."
echo "dart-changes=false" >> $GITHUB_ENV
echo "::set-output name=run-tests::false"
fi
# fvm のバージョンとチャネルを環境変数に設定する
- name: Check fvm
if: env.run-tests == 'true'
if: steps.dartfile.outputs.run-tests == 'true'
uses: kuhnroyal/flutter-fvm-config-action@v1

# Flutter SDK の設定
- name: Setup Flutter SDK
if: env.run-tests == 'true'
if: steps.dartfile.outputs.run-tests == 'true'
uses: subosito/flutter-action@v2
with:
# バージョンとチャネルは fvm の値を使う
Expand All @@ -66,51 +66,51 @@ jobs:
# melosの設定
# デフォルトでmelos bootstrapコマンドが実行される
- name: Setup melos
if: env.run-tests == 'true'
if: steps.dartfile.outputs.run-tests == 'true'
uses: bluefireteam/melos-action@v1
with:
run-bootstrap: false

# melos bootstrap を実行する。
- name: melos bootstrap
if: env.run-tests == 'true'
if: steps.dartfile.outputs.run-tests == 'true'
run: melos bootstrap --sdk-path=${{ runner.tool_cache }}/flutter

# 依存関係を解決する。
- name: Install Flutter dependencies by melos
if: env.run-tests == 'true'
if: steps.dartfile.outputs.run-tests == 'true'
run: melos pg --sdk-path=${{ runner.tool_cache }}/flutter

# コードフォーマットを実行する。
# フォーマットの結果変更が発生した場合はエラー扱いにする。
- name: Run Flutter format
if: env.run-tests == 'true'
if: steps.dartfile.outputs.run-tests == 'true'
run: melos exec --sdk-path=${{ runner.tool_cache }}/flutter -- "dart format --set-exit-if-changed ."

# 静的解析を実行する。
- name: Analyze project source
if: env.run-tests == 'true'
if: steps.dartfile.outputs.run-tests == 'true'
run: melos exec --sdk-path=${{ runner.tool_cache }}/flutter -- "flutter analyze ."

# テストを実行する。
- name: Run-Flutter-Test
if: env.run-tests == 'true'
if: steps.dartfile.outputs.run-tests == 'true'
run: melos exec --sdk-path=${{ runner.tool_cache }}/flutter -- "flutter test --machine --coverage > test-report.log"

# mottai_flutter_app のテスト結果を GitHub Actions に表示する。
- name: Report Test mottai_flutter_app
uses: dorny/test-reporter@v1
# テスト結果を表示するのでテストが失敗しても実行する。
# ただし、コードフォーマットや静的解析で CI が失敗した場合は処理を行わない。
if: env.run-tests == 'true' && steps.Run-Flutter-Test.outputs.return-code == '0'
if: steps.dartfile.outputs.run-tests == 'true' && steps.Run-Flutter-Test.outputs.return-code == '0'
with:
name: Flutter Test Report mottai_flutter_app
path: /home/runner/work/mottai-flutter-app/mottai-flutter-app/packages/mottai_flutter_app/test-report.log
reporter: flutter-json

# Codecov に結果を送信する。
- name: Upload coverage to Codecov
if: env.run-tests == 'true'
if: steps.dartfile.outputs.run-tests == 'true'
uses: codecov/codecov-action@v2
with:
token: ${{secrets.CODECOV_TOKEN}}
Expand All @@ -124,15 +124,15 @@ jobs:
uses: dorny/test-reporter@v1
# テスト結果を表示するのでテストが失敗しても実行する。
# ただし、コードフォーマットや静的解析で CI が失敗した場合は処理を行わない。
if: env.run-tests == 'true' && steps.Run-Flutter-Test.outputs.return-code == '0'
if: steps.dartfile.outputs.run-tests == 'true' && steps.Run-Flutter-Test.outputs.return-code == '0'
with:
name: Flutter Test Report mottai_flutter_app
path: /home/runner/work/mottai-flutter-app/mottai-flutter-app/packages/firebase_common/test-report.log
reporter: flutter-json

# Codecov に結果を送信する。
- name: Upload coverage to Codecov
if: env.run-tests == 'true'
if: steps.dartfile.outputs.run-tests == 'true'
uses: codecov/codecov-action@v2
with:
token: ${{secrets.CODECOV_TOKEN}}
Expand All @@ -146,15 +146,15 @@ jobs:
uses: dorny/test-reporter@v1
# テスト結果を表示するのでテストが失敗しても実行する。
# ただし、コードフォーマットや静的解析でCIが失敗した場合は処理を行わない。
if: env.run-tests == 'true' && steps.Run-Flutter-Test.outputs.return-code == '0'
if: steps.dartfile.outputs.run-tests == 'true' && steps.Run-Flutter-Test.outputs.return-code == '0'
with:
name: Flutter Test Report dart_flutter_common
path: /home/runner/work/mottai-flutter-app/mottai-flutter-app/packages/dart_flutter_common/test-report.log
reporter: flutter-json

# Codecov に結果を送信する。
- name: Upload coverage to Codecov
if: env.run-tests == 'true'
if: steps.dartfile.outputs.run-tests == 'true'
uses: codecov/codecov-action@v2
with:
token: ${{secrets.CODECOV_TOKEN}}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import * as admin from 'firebase-admin'
import * as functions from 'firebase-functions'

/**
* 新しい disableUserAccountRequest ドキュメントが作成されたときに発火する。
* disableUserAccountRequest を作成したユーザーを disable にする。
*/
export const onCreateDisableUserAccountRequest = functions
.region(`asia-northeast1`)
.firestore.document(`/disableUserAccountRequests/{disableUserAccountRequest}`)
.onCreate(async (snapshot) => {
const disableUserAccountRequest = snapshot.data()
const userId = disableUserAccountRequest.userId
try {
await admin.auth().updateUser(userId, { disabled: true });
} catch (e) {
functions.logger.error(`退会処理に失敗しました。${e}`)
}
})
3 changes: 2 additions & 1 deletion functions/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ functions.setGlobalOptions({ region: `asia-northeast1` })
// /** ここでデプロイする関数をまとめる。 */
import { createfirebaseauthcustomtoken } from './callable-functions/createFirebaseAuthCustomToken'
import { onCreateTestNotification } from './development/testNotification/onCreateTestNotification'
import { onCreateDisableUserAccountRequest } from './development/disableUserAccount/onCreateDisableUserAccountRequest'

// /** index.ts で import してデプロイする関数一覧。 */
export { createfirebaseauthcustomtoken, onCreateTestNotification }
export { createfirebaseauthcustomtoken, onCreateTestNotification, onCreateDisableUserAccountRequest }
30 changes: 19 additions & 11 deletions packages/dart_flutter_common/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ packages:
dependency: transitive
description:
name: collection
sha256: "4a07be6cb69c84d677a6c3096fcf960cc3285a8330b4603e0d463d15d9bd934c"
sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687
url: "https://pub.dev"
source: hosted
version: "1.17.1"
version: "1.17.2"
cross_file:
dependency: transitive
description:
Expand Down Expand Up @@ -292,18 +292,18 @@ packages:
dependency: transitive
description:
name: matcher
sha256: "6501fbd55da300384b768785b83e5ce66991266cec21af89ab9ae7f5ce1c4cbb"
sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e"
url: "https://pub.dev"
source: hosted
version: "0.12.15"
version: "0.12.16"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
sha256: d92141dc6fe1dad30722f9aa826c7fbc896d021d792f80678280601aff8cf724
sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41"
url: "https://pub.dev"
source: hosted
version: "0.2.0"
version: "0.5.0"
meta:
dependency: transitive
description:
Expand Down Expand Up @@ -433,10 +433,10 @@ packages:
dependency: transitive
description:
name: source_span
sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250
sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c"
url: "https://pub.dev"
source: hosted
version: "1.9.1"
version: "1.10.0"
sqflite:
dependency: transitive
description:
Expand Down Expand Up @@ -497,10 +497,10 @@ packages:
dependency: transitive
description:
name: test_api
sha256: eb6ac1540b26de412b3403a163d919ba86f6a973fe6cc50ae3541b80092fdcfb
sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8"
url: "https://pub.dev"
source: hosted
version: "0.5.1"
version: "0.6.0"
typed_data:
dependency: transitive
description:
Expand Down Expand Up @@ -589,6 +589,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.4"
web:
dependency: transitive
description:
name: web
sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10
url: "https://pub.dev"
source: hosted
version: "0.1.4-beta"
win32:
dependency: transitive
description:
Expand All @@ -606,5 +614,5 @@ packages:
source: hosted
version: "1.0.0"
sdks:
dart: ">=3.0.0 <4.0.0"
dart: ">=3.1.0-185.0.dev <4.0.0"
flutter: ">=3.10.0"
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export 'chat_message.dart';
export 'chat_room.dart';
export 'disable_user_account_request.dart';
export 'force_update_config.dart';
export 'host.dart';
export 'host_location.dart';
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutterfire_gen_annotation/flutterfire_gen_annotation.dart';

part 'disable_user_account_request.flutterfire_gen.dart';

@FirestoreDocument(
path: 'disableUserAccountRequests',
documentName: 'disableUserAccountRequest',
)
class DisableUserAccountRequest {
const DisableUserAccountRequest({
required this.userId,
this.createdAt,
});

final String userId;

@AlwaysUseFieldValueServerTimestampWhenCreating()
final DateTime? createdAt;
}
Loading

0 comments on commit 9bb4f91

Please sign in to comment.