Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tml 12 #75

Merged
merged 15 commits into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
apps/web/* @harrytran998
apps/mobile/* @yusaki0998
apps/mobile/* @yusaki0998 @ducpq

packages/* @harrytran998
.github/* @harrytran998
internal/* @harrytran998
.github/* @harrytran998
docker/* @harrytran998
29 changes: 11 additions & 18 deletions .github/workflow/ci.mobile.yml → .github/workflows/ci.mobile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,10 @@ on:
push:
paths:
- "apps/mobile/**"
- ".github/workflows/ci.mobile.yaml"
branches:
- "dev"
- "release/*"

- ".github/workflows/ci.mobile.yml"
branches: ["dev", "release/*"]
pull_request:
paths:
- "apps/mobile/**"
- ".github/workflows/ci.mobile.yaml"
branches:
- "dev"
- "release/*"

env:
FLUTTER_VERSION: "3.19.6"
branches: ["dev", "release/*"]

jobs:
prepare-linux:
Expand Down Expand Up @@ -53,6 +42,7 @@ jobs:
steps:
- name: Checkout source code
uses: actions/checkout@v4
- uses: moonrepo/setup-toolchain@v0

- name: Install flutter
id: flutter
Expand All @@ -61,9 +51,12 @@ jobs:
channel: "stable"
flutter-version: ${{ env.FLUTTER_VERSION }}
cache: true
- name: Install need deps
run: |
dart pub global activate melos

- name: "Run flutter pub get"
run: flutter pub get
- name: "Flutter pub get"
run: moon ci :install --query "projectName=mobile"

- name: "Run flutter unit test"
run: flutter test
- name: "Run unit test"
run: moon ci --color --log debug :test --query "projectName=mobile"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion .husky/pre-push
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/bin/bash

echo "\nStart run units test\n"
make test.unit.run
3 changes: 2 additions & 1 deletion .moon/hooks/commit-msg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ set -eo pipefail
# Automatically generated by moon. DO NOT MODIFY!
# https://moonrepo.dev/docs/guides/vcs-hooks

echo "commit msg"
echo "commit msg"

3 changes: 2 additions & 1 deletion .moon/hooks/pre-commit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ set -eo pipefail
# Automatically generated by moon. DO NOT MODIFY!
# https://moonrepo.dev/docs/guides/vcs-hooks

echo "pre commit msg"
echo "pre commit msg"

3 changes: 2 additions & 1 deletion .moon/hooks/pre-push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ set -eo pipefail
# Automatically generated by moon. DO NOT MODIFY!
# https://moonrepo.dev/docs/guides/vcs-hooks

echo "pre push"
echo "pre push"

3 changes: 2 additions & 1 deletion .moon/hooks/prepare-commit-msg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ set -eo pipefail
# Automatically generated by moon. DO NOT MODIFY!
# https://moonrepo.dev/docs/guides/vcs-hooks

echo "prepare commit msg"
echo "prepare commit msg"

34 changes: 34 additions & 0 deletions .moon/tasks/dart.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
$schema: "https://moonrepo.dev/schemas/tasks.json"

implicitInputs:
- "pubspec.yaml"

fileGroups:
configs:
- "*.{yml,yaml}"
sources:
- "*lib/**/*"
- "*packages/**/*.dart"
tests:
- "*packages/**/test/**/*.dart"
- "*tests/**/*.dart"
- "*lib/contexts/**/test/**/*.dart"

tasks:
install:
command:
- flutter
args: "pub get"
build.ios:
command:
- flutter
args: "build ipa --split-debug-info=./ --obfuscate --verbose"
build.android:
command:
- flutter
args: "build apk --split-per-abi --split-debug-info=./ --obfuscate --verbose"

test:
command:
- melos
args: "test"
26 changes: 26 additions & 0 deletions Makefile.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# You can see detail the tool here
# https://github.com/sagiegurari/cargo-make

extend = [
{ path = "scripts/api.toml" },
{ path = "scripts/generate.toml" },
{ path = "scripts/git.toml" },
{ path = "scripts/migration.toml" },
{ path = "scripts/mobile.toml" },
# { path = "scripts/protobuf.toml" },
# { path = "scripts/docker.toml" },
# { path = "scripts/env.toml" },
{ path = "scripts/tests.toml" },
{ path = "scripts/tool.toml" },
{ path = "scripts/web.toml" },
]

[config]
on_error_task = "catch"

[env]
RUST_LOG = "info"
CARGO_PROFILE = "dev"
CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = true
# CARGO_MAKE_CRATE_FS_NAME = "dart_ffi"
# CARGO_MAKE_CRATE_NAME = "dart-ffi"
7 changes: 6 additions & 1 deletion apps/mobile/melos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,10 @@ scripts:
test:
exec: flutter test
coverage:
exec: flutter test --coverage
run: flutter test --coverage && genhtml coverage/lcov.info -o coverage/html
exec:
failFast: false
select-package:
dir-exists:
- test
run:mobile: melos exec --scope="mobile" -- flutter run
27 changes: 27 additions & 0 deletions apps/mobile/moon.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
type: "application"
language: "dart"

fileGroups:
app:
- "android/**/*"
- "ios/**/*"
- "lib/**/*"
- "linux/**/*"
- "web/**/*"
- "windows/**/*"
- "packages/**/*"
- "pubspec.*"

tasks:
build:
command: "bun script/build.ts"
inputs:
- "@group(app)"
- "@group(sources)"
dev:
command: "vite"
local: true

start:
command: "bun server/index.ts"
local: true
4 changes: 3 additions & 1 deletion apps/mobile/packages/http_client/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ environment:
# Add regular dependencies here.
dependencies:
http: ^1.2.1
mockito: ^5.4.4
logger:
path: ../logger

dev_dependencies:
test: ^1.24.0
flutter_test:
sdk: flutter
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ main() {
final request = baseReq as Request;
expect(copied.hashCode, isNot(equals(request.hashCode)));
expect(copied.url, equals(request.url));
expect(copied.method,equals(request.method));
expect(copied.headers,equals(request.headers));
expect(copied.body,equals(request.body));
expect(copied.encoding,equals(request.encoding));
expect(copied.followRedirects,equals(request.followRedirects));
expect(copied.maxRedirects,equals(request.maxRedirects));
expect(copied.persistentConnection,equals(request.persistentConnection));
expect(copied.method, equals(request.method));
expect(copied.headers, equals(request.headers));
expect(copied.body, equals(request.body));
expect(copied.encoding, equals(request.encoding));
expect(copied.followRedirects, equals(request.followRedirects));
expect(copied.maxRedirects, equals(request.maxRedirects));
expect(copied.persistentConnection, equals(request.persistentConnection));
});
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ main() {
final response = baseResponse as Response;
expect(copied.hashCode, isNot(equals(response.hashCode)));
expect(copied.statusCode, equals(response.statusCode));
expect(copied.body,equals(response.body));
expect(copied.headers,equals(response.headers));
expect(copied.isRedirect,equals(response.isRedirect));
expect(copied.persistentConnection,equals(response.persistentConnection));
expect(copied.body, equals(response.body));
expect(copied.headers, equals(response.headers));
expect(copied.isRedirect, equals(response.isRedirect));
expect(
copied.persistentConnection, equals(response.persistentConnection));
});
});
}
3 changes: 3 additions & 0 deletions apps/mobile/packages/logger/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ environment:
sdk: ">=3.0.0 <4.0.0"

dependencies:
dev_dependencies:
flutter_test:
sdk: flutter
2 changes: 1 addition & 1 deletion apps/mobile/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ dependencies:
get_it: ^7.7.0
hive: ^2.2.3
injectable: ^2.1.2
uuid: ^3.0.0
uuid: ^4.4.0
mockito: ^5.4.4
ddd_core:
path: packages/ddd_core
Expand Down
File renamed without changes.
3 changes: 0 additions & 3 deletions scripts/clean.ts

This file was deleted.

5 changes: 5 additions & 0 deletions scripts/generate.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[tasks.generate.model]
script = ["""
moon run :gen --query "projectName=models"
"""]
script_runner = "@shell"
1 change: 1 addition & 0 deletions scripts/git.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Empty file added scripts/migration.toml
Empty file.
28 changes: 28 additions & 0 deletions scripts/mobile.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[tasks.pub_get]
script = ["""
cd apps/mobile
flutter clean
flutter pub get
cd ../..
"""]
script_runner = "@shell"

[tasks.flutter-build-ios]
script = ["""
cd apps/mobile
flutter pub get
flutter build ipa --split-debug-info=./ --obfuscate --verbose
"""]
script_runner = "@shell"

[tasks.flutter-build-android]
script = ["""
cd apps/mobile
flutter pub get
flutter build apk --split-per-abi --split-debug-info=./ --obfuscate --verbose
"""]
script_runner = "@shell"

[tasks.flutter-build]
run_task = { name = ["flutter-build-ios", "flutter-build-android"] }
script_runner = "@shell"
58 changes: 0 additions & 58 deletions scripts/publishPkg.mjs

This file was deleted.

Empty file added scripts/test.toml
Empty file.
32 changes: 32 additions & 0 deletions scripts/tool.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[tasks.lint.ts.format]
script = ["""
bunx @biomejs/biome check . --apply
"""]
script_runner = "@shell"

[tasks.lint.ts.circular]
script = ["""
bunx @biomejs/biome check . --apply
"""]
script_runner = "@shell"

[tasks.lint.ts.typecheck]
script = ["""
bunx @biomejs/biome check . --apply
"""]
script_runner = "@shell"

[tasks.lint.ts.useless]
script = ["""
bunx @biomejs/biome check . --apply
"""]
script_runner = "@shell"

[tasks.lint.ts]
run_task = { name = [
"lint.ts.format",
"lint.ts.circular",
"lint.ts.typecheck",
"lint.ts.useless",
] }
script_runner = "@shell"
Empty file added scripts/web.toml
Empty file.
Loading