Skip to content

Commit 3a54d4d

Browse files
authored
Merge pull request #21 from Y-RyuZU/tauri
2 parents 601ba91 + 88c3398 commit 3a54d4d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+2028
-603
lines changed

.github/workflows/pr-validation.yml

Lines changed: 120 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ on:
55
types: [opened, synchronize, reopened]
66

77
jobs:
8-
validate:
9-
name: Validate PR
8+
frontend-tests:
9+
name: Frontend Tests
1010
runs-on: ubuntu-latest
1111
steps:
1212
- uses: actions/checkout@v4
@@ -16,12 +16,60 @@ jobs:
1616
with:
1717
bun-version: latest
1818

19+
- name: Cache dependencies
20+
uses: actions/cache@v4
21+
with:
22+
path: |
23+
node_modules
24+
~/.bun/install/cache
25+
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }}
26+
restore-keys: |
27+
${{ runner.os }}-bun-
28+
29+
- name: Install dependencies
30+
run: bun install
31+
32+
- name: Run linting (TypeScript)
33+
run: bun run lint
34+
35+
- name: Run type checking
36+
run: bun run typecheck
37+
38+
- name: Run unit tests (Jest)
39+
run: bun run test:jest
40+
41+
- name: Run unit tests (Bun)
42+
run: bun test src/lib/services/__tests__/update-service.test.ts src/lib/services/__tests__/*.bun.test.ts
43+
44+
- name: Run critical E2E tests
45+
run: |
46+
bun test src/__tests__/e2e/translation-e2e-simple.test.ts
47+
bun test src/__tests__/e2e/skip-existing-translations-e2e.test.ts
48+
49+
- name: Generate test coverage
50+
run: bun run test:coverage
51+
52+
- name: Upload coverage to Codecov
53+
uses: codecov/codecov-action@v4
54+
with:
55+
token: ${{ secrets.CODECOV_TOKEN }}
56+
file: ./coverage/lcov.info
57+
flags: frontend
58+
name: frontend-coverage
59+
fail_ci_if_error: false
60+
61+
backend-tests:
62+
name: Backend Tests
63+
runs-on: ubuntu-latest
64+
steps:
65+
- uses: actions/checkout@v4
66+
1967
- name: Setup Rust
2068
uses: dtolnay/rust-toolchain@stable
2169
with:
2270
components: rustfmt, clippy
2371

24-
- name: Cache dependencies
72+
- name: Cache Rust dependencies
2573
uses: actions/cache@v4
2674
with:
2775
path: |
@@ -30,49 +78,101 @@ jobs:
3078
~/.cargo/registry/cache/
3179
~/.cargo/git/db/
3280
src-tauri/target/
33-
node_modules
34-
key: ${{ runner.os }}-pr-${{ hashFiles('**/Cargo.lock', '**/bun.lockb') }}
81+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
3582
restore-keys: |
36-
${{ runner.os }}-pr-
83+
${{ runner.os }}-cargo-
3784
3885
- name: Install system dependencies
3986
run: |
4087
sudo apt-get update
4188
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
4289
43-
- name: Install dependencies
44-
run: bun install
45-
4690
- name: Check formatting (Rust)
4791
run: cargo fmt --manifest-path src-tauri/Cargo.toml -- --check
4892

4993
- name: Run Clippy
50-
run: cargo clippy --manifest-path src-tauri/Cargo.toml -- -D warnings
94+
run: cargo clippy --manifest-path src-tauri/Cargo.toml --all-features --tests -- -D warnings
5195

52-
- name: Run linting (TypeScript)
53-
run: bun run lint
96+
- name: Run Rust tests
97+
run: cargo test --manifest-path src-tauri/Cargo.toml --all-features
5498

55-
- name: Run type checking
56-
run: bun run typecheck
99+
- name: Build check
100+
run: cargo check --manifest-path src-tauri/Cargo.toml --all-features
101+
102+
integration-tests:
103+
name: Integration Tests
104+
runs-on: ubuntu-latest
105+
needs: [frontend-tests, backend-tests]
106+
steps:
107+
- uses: actions/checkout@v4
57108

58-
- name: Run tests
59-
run: npm test
109+
- name: Setup Bun
110+
uses: oven-sh/setup-bun@v2
111+
with:
112+
bun-version: latest
60113

61-
- name: Build check
114+
- name: Setup Rust
115+
uses: dtolnay/rust-toolchain@stable
116+
117+
- name: Cache dependencies
118+
uses: actions/cache@v4
119+
with:
120+
path: |
121+
~/.cargo/bin/
122+
~/.cargo/registry/index/
123+
~/.cargo/registry/cache/
124+
~/.cargo/git/db/
125+
src-tauri/target/
126+
node_modules
127+
~/.bun/install/cache
128+
key: ${{ runner.os }}-integration-${{ hashFiles('**/Cargo.lock', '**/bun.lockb') }}
129+
restore-keys: |
130+
${{ runner.os }}-integration-
131+
132+
- name: Install system dependencies
133+
run: |
134+
sudo apt-get update
135+
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
136+
137+
- name: Install dependencies
138+
run: bun install
139+
140+
- name: Run realistic E2E tests
141+
run: |
142+
bun test src/__tests__/e2e/realistic-translation-e2e.test.ts
143+
bun test src/__tests__/e2e/realistic-progress-e2e.test.ts
144+
bun test src/__tests__/e2e/backup-system-e2e.test.ts
145+
146+
- name: Test build process
62147
run: |
63-
cd src-tauri
64-
cargo check --all-features
148+
bun run build
149+
cargo build --manifest-path src-tauri/Cargo.toml --release
65150
66151
security-scan:
67152
name: Security Scan
68153
runs-on: ubuntu-latest
69154
steps:
70155
- uses: actions/checkout@v4
71156

157+
- name: Setup Bun
158+
uses: oven-sh/setup-bun@v2
159+
with:
160+
bun-version: latest
161+
162+
- name: Install dependencies
163+
run: bun install
164+
72165
- name: Run cargo audit
73166
uses: rustsec/audit-check@v2
74167
with:
75168
token: ${{ secrets.GITHUB_TOKEN }}
76169

77170
- name: Run npm audit
78-
run: npm audit --audit-level=moderate || true
171+
run: bun audit --audit-level=moderate || true
172+
173+
- name: Check for sensitive files
174+
run: |
175+
if find . -name "*.key" -o -name "*.pem" -o -name "*.p12" -o -name "*.jks" | grep -v node_modules | grep -q .; then
176+
echo "Sensitive files found"
177+
exit 1
178+
fi

public/locales/en/common.json

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@
5757
"fallback": "Fallback to Entry-Based",
5858
"fallbackHint": "Use entry-based chunking if token estimation fails"
5959
},
60+
"skipExistingTranslations": {
61+
"title": "Skip when translations exist",
62+
"hint": "Skip items that already have target language files (Mods, Quests, Guidebooks only)"
63+
},
6064
"typicalLocation": "Typical location",
6165
"pathSettings": "Path Settings",
6266
"minecraftDirectory": "Minecraft Directory",
@@ -173,8 +177,17 @@
173177
"selectProfileDirectoryFirst": "Please select a profile directory first",
174178
"noTargetLanguageSelected": "No target language selected. Please select a target language from the dropdown in the translation tab.",
175179
"translationInProgress": "Translation in Progress",
176-
"cannotSwitchTabs": "Cannot switch tabs while translation is in progress. Please wait for the current translation to complete or cancel it.",
177-
"failedToLoad": "Failed to load"
180+
"scanInProgress": "Scan in Progress",
181+
"cannotSwitchTabs": "Cannot switch tabs while operation is in progress. Please wait for it to complete.",
182+
"failedToLoad": "Failed to load",
183+
"directoryNotFound": "Directory not found: {{path}}",
184+
"modsDirectoryNotFound": "Mods directory not found: {{path}}. Please select a valid Minecraft profile directory.",
185+
"questsDirectoryNotFound": "Quests directory not found: {{path}}. Please select a valid Minecraft profile directory containing quest files.",
186+
"guidebooksDirectoryNotFound": "Guidebooks directory not found: {{path}}. Please select a valid Minecraft profile directory containing guidebook files.",
187+
"customFilesDirectoryNotFound": "Custom files directory not found: {{path}}. Please select a valid directory containing JSON or SNBT files.",
188+
"profileDirectoryNotFound": "Profile directory not found: {{path}}. Please select a valid Minecraft profile directory.",
189+
"failedToLoadLogs": "Failed to load session logs",
190+
"noMinecraftDir": "Minecraft directory is not set. Please configure it in settings."
178191
},
179192
"info": {
180193
"translationCancelled": "Translation cancelled by user"
@@ -240,7 +253,11 @@
240253
"failed": "Failed",
241254
"pending": "Pending",
242255
"in_progress": "In Progress"
243-
}
256+
},
257+
"sessionDetails": "Session Details",
258+
"viewLogs": "View Logs",
259+
"sessionLogs": "Session Logs",
260+
"noLogsFound": "No logs found for this session"
244261
},
245262
"update": {
246263
"title": "Update Available",

public/locales/ja/common.json

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@
5757
"fallback": "エントリベースへのフォールバック",
5858
"fallbackHint": "トークン推定が失敗した場合、エントリベースのチャンク分割を使用"
5959
},
60+
"skipExistingTranslations": {
61+
"title": "既存の翻訳がある場合スキップ",
62+
"hint": "対象言語ファイルが既に存在するアイテムをスキップします(Mod、クエスト、ガイドブックのみ)"
63+
},
6064
"typicalLocation": "一般的な場所",
6165
"pathSettings": "パス設定",
6266
"minecraftDirectory": "Minecraftディレクトリ",
@@ -173,8 +177,17 @@
173177
"selectProfileDirectoryFirst": "最初にプロファイルディレクトリを選択してください",
174178
"noTargetLanguageSelected": "対象言語が選択されていません。翻訳タブのドロップダウンから対象言語を選択してください。",
175179
"translationInProgress": "翻訳中",
176-
"cannotSwitchTabs": "翻訳中はタブを切り替えることができません。現在の翻訳が完了するまでお待ちいただくか、キャンセルしてください。",
177-
"failedToLoad": "読み込みに失敗しました"
180+
"scanInProgress": "スキャン中",
181+
"cannotSwitchTabs": "処理中はタブを切り替えることができません。処理が完了するまでお待ちください。",
182+
"failedToLoad": "読み込みに失敗しました",
183+
"directoryNotFound": "ディレクトリが見つかりません: {{path}}",
184+
"modsDirectoryNotFound": "Modsディレクトリが見つかりません: {{path}}。有効なMinecraftプロファイルディレクトリを選択してください。",
185+
"questsDirectoryNotFound": "クエストディレクトリが見つかりません: {{path}}。クエストファイルを含む有効なMinecraftプロファイルディレクトリを選択してください。",
186+
"guidebooksDirectoryNotFound": "ガイドブックディレクトリが見つかりません: {{path}}。ガイドブックファイルを含む有効なMinecraftプロファイルディレクトリを選択してください。",
187+
"customFilesDirectoryNotFound": "カスタムファイルディレクトリが見つかりません: {{path}}。JSONまたはSNBTファイルを含む有効なディレクトリを選択してください。",
188+
"profileDirectoryNotFound": "プロファイルディレクトリが見つかりません: {{path}}。有効なMinecraftプロファイルディレクトリを選択してください。",
189+
"failedToLoadLogs": "セッションログの読み込みに失敗しました",
190+
"noMinecraftDir": "Minecraftディレクトリが設定されていません。設定で設定してください。"
178191
},
179192
"info": {
180193
"translationCancelled": "翻訳はユーザーによってキャンセルされました"
@@ -240,7 +253,11 @@
240253
"failed": "失敗",
241254
"pending": "保留中",
242255
"in_progress": "進行中"
243-
}
256+
},
257+
"sessionDetails": "セッション詳細",
258+
"viewLogs": "ログを見る",
259+
"sessionLogs": "セッションログ",
260+
"noLogsFound": "このセッションのログが見つかりません"
244261
},
245262
"update": {
246263
"title": "アップデートが利用可能",

src-tauri/Cargo.lock

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src-tauri/Cargo.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ tauri-build = { version = "2.1.0", features = [] }
2121
serde_json = "1.0"
2222
serde = { version = "1.0", features = ["derive"] }
2323
log = "0.4"
24-
tauri = { version = "2.4.0", features = [] }
24+
tauri = { version = "2.4.0", features = ["test"] }
2525
tauri-plugin-log = "2.0.0-rc"
2626
tauri-plugin-dialog = "2.0.0"
2727
tauri-plugin-shell = "2.0.0"
@@ -34,3 +34,7 @@ chrono = "0.4"
3434
dirs = "5.0"
3535
rfd = "0.12"
3636
toml = "0.8"
37+
38+
[dev-dependencies]
39+
tempfile = "3.0"
40+
tokio = { version = "1.0", features = ["full"] }

0 commit comments

Comments
 (0)