Skip to content

Commit 156ddb9

Browse files
authored
1.0.4 (#22)
* fix char in column * add lib.rs and app bench * fix * app version in About * Fix style * update README.md * add Unit test * add Unit Unit and better typing * upgrade CI GHA * upgrade CI GHA * remove Security check in GHA ci.yml * remove Security check in GHA ci.yml * fix bench error leading to build crash * refactor: update database driver type and improve connection validation * refactor: standardize database configuration property names to use snake_case * refactor: rename DbConfig to DatabaseConfig and update usage across the codebase * refactor: replace Connection with DatabaseConnection and update related usages * refactor: replace SQL builder functions with methods from SqlBuilder struct * refactor: add ComboItem struct with serialization and cloning tests * refactor: implement DatabaseAction struct for database operations and update usages * refactor: introduce BatchProcessor and TableExporter for paginated database exports * refactor: reorganize module structure and update imports for consistency * refactor: update SaveConfig methods for improved file handling and serialization * refactor: enhance CI/CD workflow with improved change detection and system dependencies * refactor: enhance CI/CD pipeline with improved change detection, caching, and security audits * refactor: reduce retention days for build artifacts and remove security audit steps * refactor: reduce retention days for build artifacts and remove security audit steps * refactor: reduce retention days for build artifacts and remove security audit steps * refactor: reduce retention days for build artifacts and remove security audit steps * refactor: reduce retention days for build artifacts and remove security audit steps * refactor: reduce retention days for build artifacts and remove security audit steps * refactor: update Tauri integration tests and change database driver to SQLite * refactor: remove unused test configuration functions and add dead code allowance * refactor: clean up imports and formatting across multiple files
1 parent b9b9e35 commit 156ddb9

Some content is hidden

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

80 files changed

+7606
-3166
lines changed

.github/workflows/ci.yml

Lines changed: 141 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,163 @@
1-
name: Rust CI
1+
name: Full Stack CI
22

33
on:
44
push:
55
branches: [ "main" ]
6+
paths-ignore:
7+
- '**.md'
8+
- '.gitignore'
9+
- 'LICENSE'
610
pull_request:
711
branches: [ "main" ]
12+
paths-ignore:
13+
- '**.md'
14+
- '.gitignore'
15+
- 'LICENSE'
816
workflow_dispatch:
917

1018
env:
1119
CARGO_TERM_COLOR: always
20+
RUST_BACKTRACE: 1
1221

1322
jobs:
14-
build:
15-
runs-on: macos-latest
23+
# Check if we should skip CI
24+
changes:
25+
name: Detect Changes
26+
runs-on: ubuntu-latest
27+
outputs:
28+
backend: ${{ steps.changes.outputs.backend }}
29+
frontend: ${{ steps.changes.outputs.frontend }}
30+
general: ${{ steps.changes.outputs.general }}
31+
gha: ${{ steps.changes.outputs.gha }}
32+
steps:
33+
- name: Checkout Repository
34+
uses: actions/checkout@v4
35+
36+
- name: Check for changes
37+
uses: dorny/paths-filter@v3
38+
id: changes
39+
with:
40+
# Define filters for different parts of the project to conditionally run jobs
41+
filters: |
42+
backend:
43+
- 'src-tauri/**'
44+
frontend:
45+
- 'src/**'
46+
- 'public/**'
47+
- 'package.json'
48+
- 'pnpm-lock.yaml'
49+
- 'index.html'
50+
- 'vite.config.*'
51+
- 'tsconfig.json'
52+
- 'tsconfig.node.json'
53+
- 'postcss.config.js'
54+
- 'tailwind.config.*'
55+
- 'components.json'
56+
- 'app-icon.png'
57+
- 'pnpm-lock.yaml'
58+
general:
59+
- '**.md'
60+
- '.gitignore'
61+
- 'LICENSE'
62+
- 'docs/**'
63+
gha:
64+
- '.github/**'
65+
66+
67+
# Combined Full Stack Test and Build
68+
full-stack-test-build:
69+
name: Full Stack Test & Build
70+
runs-on: ${{ matrix.os }}
71+
needs: changes
72+
if: needs.changes.outputs.general == 'false' || (needs.changes.outputs.backend == 'true' || needs.changes.outputs.frontend == 'true' || needs.changes.outputs.gha == 'true')
73+
74+
strategy:
75+
fail-fast: false
76+
matrix:
77+
os: [ macos-latest ]
1678

1779
steps:
18-
- name: Fetch Repository
80+
- name: Checkout Repository
1981
uses: actions/checkout@v4
2082

21-
- name: Install stable Rust toolchain
83+
# Setup all required tools
84+
- name: Setup pnpm
85+
uses: pnpm/action-setup@v4
86+
with:
87+
version: 9
88+
89+
- name: Setup Node.js
90+
uses: actions/setup-node@v4
91+
with:
92+
node-version: '20'
93+
cache: 'pnpm'
94+
95+
- name: Install Rust Toolchain
2296
uses: actions-rust-lang/setup-rust-toolchain@v1
2397
with:
2498
toolchain: stable
25-
target: x86_64-unknown-linux-gnu
99+
cache: true
100+
101+
# Enhanced caching strategy
102+
- name: Get pnpm store directory
103+
shell: bash
104+
run: |
105+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
26106
27-
- name: Run tests
107+
- name: Cache All Dependencies
108+
uses: actions/cache@v4
109+
with:
110+
path: |
111+
${{ env.STORE_PATH }}
112+
~/.cargo/bin/
113+
~/.cargo/registry/index/
114+
~/.cargo/registry/cache/
115+
~/.cargo/git/db/
116+
src-tauri/target/
117+
node_modules
118+
dist/
119+
key: ${{ runner.os }}-fullstack-${{ hashFiles('**/Cargo.lock', '**/pnpm-lock.yaml') }}
120+
restore-keys: |
121+
${{ runner.os }}-fullstack-
122+
${{ runner.os }}-
123+
124+
# Install all dependencies
125+
- name: Install Frontend Dependencies
126+
run: pnpm install --frozen-lockfile
127+
128+
# Backend tests and checks (if backend changed)
129+
- name: Run Rust Unit Tests
130+
if: needs.changes.outputs.backend == 'true'
131+
run: |
132+
cd src-tauri
133+
cargo test --verbose --all-features --lib
134+
135+
# Frontend tests and checks (if frontend changed)
136+
- name: Run Frontend Unit Tests
137+
if: needs.changes.outputs.frontend == 'true'
138+
run: pnpm test
139+
env:
140+
NODE_ENV: test
141+
142+
# Build frontend first (required for Tauri)
143+
- name: Build Frontend
144+
run: pnpm run build
145+
146+
# Run Tauri integration tests
147+
- name: Run Tauri Integration Tests
148+
run: |
149+
cd src-tauri
150+
cargo test
151+
152+
# Start backend for integration tests (if needed)
153+
- name: Start Backend for Integration Tests
154+
if: needs.changes.outputs.frontend == 'true' && needs.changes.outputs.backend == 'true'
28155
run: |
29156
cd src-tauri
30-
cargo test --verbose
157+
cargo check --release
158+
159+
# Build Tauri application (includes both frontend and backend)
160+
- name: Build Tauri Application
161+
run: pnpm tauri build --verbose
162+
env:
163+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Update Version Badge in Markdown Files
2+
3+
on:
4+
push:
5+
branches: [ "main", "master" ]
6+
paths: [ 'src-tauri/Cargo.toml' ] # Trigger only when Cargo.toml changes
7+
workflow_dispatch:
8+
9+
jobs:
10+
update-badge:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v4
16+
with:
17+
token: ${{ secrets.GITHUB_TOKEN }}
18+
19+
- name: Extract version from Cargo.toml
20+
id: get_version
21+
run: |
22+
# Extract version using multiple methods for robustness
23+
if command -v toml &> /dev/null; then
24+
VERSION=$(toml get Cargo.toml package.version --raw 2>/dev/null)
25+
fi
26+
27+
if [ -z "$VERSION" ]; then
28+
VERSION=$(grep '^version = ' Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/')
29+
fi
30+
31+
if [ -z "$VERSION" ]; then
32+
echo "Error: Could not extract version from Cargo.toml"
33+
exit 1
34+
fi
35+
36+
echo "version=$VERSION" >> $GITHUB_OUTPUT
37+
echo "Extracted version: $VERSION"
38+
39+
- name: Update version badges in all markdown files
40+
run: |
41+
VERSION="${{ steps.get_version.outputs.version }}"
42+
echo "Updating badges to version: $VERSION"
43+
44+
# Find all markdown files and update the version badge
45+
find . -name "*.md" -type f | while read -r file; do
46+
echo "Checking file: $file"
47+
if grep -q "img.shields.io/badge/Version-" "$file"; then
48+
echo "Updating badge in: $file"
49+
sed -i "s|https://img\.shields\.io/badge/Version-[^-]*-informational|https://img.shields.io/badge/Version-$VERSION-informational|g" "$file"
50+
fi
51+
done
52+
53+
- name: Check for changes
54+
id: check_changes
55+
run: |
56+
if git diff --quiet; then
57+
echo "changes=false" >> $GITHUB_OUTPUT
58+
echo "No changes detected"
59+
else
60+
echo "changes=true" >> $GITHUB_OUTPUT
61+
echo "Changes detected:"
62+
git diff --name-only
63+
fi
64+
65+
- name: Commit and push changes
66+
if: steps.check_changes.outputs.changes == 'true'
67+
run: |
68+
git config --local user.email "action@github.com"
69+
git config --local user.name "GitHub Action"
70+
git add -A
71+
git commit -m "🔖 Update version badge to v${{ steps.get_version.outputs.version }}"
72+
git push

README.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<div align="center">
55
<img src="https://img.shields.io/badge/Rust-dea584?style=for-the-badge&logo=rust&logoColor=white" alt="Rust" />
66
<img src="https://img.shields.io/badge/Tauri-ffc130?style=for-the-badge&logo=tauri&logoColor=white" alt="Tauri" />
7-
<img src="https://img.shields.io/badge/Version-1.0.3-7073f6?style=for-the-badge" alt="Version" />
7+
<img src="https://img.shields.io/badge/Version-1.0.4-7073f6?style=for-the-badge" alt="Version" />
88
</div>
99
</div>
1010

@@ -78,6 +78,32 @@ To quickly test FileFlow:
7878
4. **Upload and Insert**: Upload your CSV file and start the insertion process. Monitor progress with the on-screen
7979
loader.
8080

81+
## 🧪 Code Quality
82+
83+
### Unit Tests available
84+
85+
To run unit tests, use the following command:
86+
87+
#### For the Rust backend:
88+
89+
```bash
90+
cargo test
91+
```
92+
93+
#### For the Tauri frontend:
94+
95+
```bash
96+
pnpm test
97+
```
98+
99+
### Benchmarks available
100+
101+
To run benchmarks, use the following command:
102+
103+
```bash
104+
cargo bench
105+
```
106+
81107
## 🤝 Contributing
82108

83109
Contributions are welcome! To contribute:

jest.config.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
export default {
2+
preset: 'ts-jest/presets/default-esm',
3+
extensionsToTreatAsEsm: ['.ts', '.tsx'],
4+
testEnvironment: 'node',
5+
roots: ['<rootDir>/src'],
6+
testMatch: [
7+
'**/__tests__/**/*.+(ts|tsx|js)',
8+
'**/*.(test|spec).+(ts|tsx|js)'
9+
],
10+
transform: {
11+
'^.+\\.(ts|tsx)$': ['ts-jest', {
12+
useESM: true
13+
}]
14+
},
15+
moduleNameMapping: {
16+
'^(\\.{1,2}/.*)\\.js$': '$1'
17+
},
18+
collectCoverageFrom: [
19+
'src/**/*.{ts,tsx}',
20+
'!src/**/*.d.ts',
21+
'!src/**/*.test.{ts,tsx}'
22+
],
23+
coverageThreshold: {
24+
global: {
25+
branches: 90,
26+
functions: 90,
27+
lines: 90,
28+
statements: 90
29+
}
30+
}
31+
};

package.json

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,32 @@
77
"dev": "vite",
88
"build": "tsc && vite build",
99
"preview": "vite preview",
10-
"tauri": "tauri"
10+
"tauri": "tauri",
11+
"test": "jest",
12+
"test:watch": "jest --watch",
13+
"test:coverage": "jest --coverage"
1114
},
1215
"dependencies": {
13-
"@radix-ui/react-checkbox": "^1.3.2",
14-
"@radix-ui/react-dialog": "^1.1.14",
15-
"@radix-ui/react-dropdown-menu": "^2.1.15",
16+
"@radix-ui/react-checkbox": "^1.3.3",
17+
"@radix-ui/react-dialog": "^1.1.15",
18+
"@radix-ui/react-dropdown-menu": "^2.1.16",
1619
"@radix-ui/react-icons": "^1.3.2",
1720
"@radix-ui/react-label": "^2.1.7",
18-
"@radix-ui/react-menubar": "^1.1.15",
19-
"@radix-ui/react-popover": "^1.1.14",
20-
"@radix-ui/react-radio-group": "^1.3.7",
21-
"@radix-ui/react-select": "^2.2.5",
21+
"@radix-ui/react-menubar": "^1.1.16",
22+
"@radix-ui/react-popover": "^1.1.15",
23+
"@radix-ui/react-radio-group": "^1.3.8",
24+
"@radix-ui/react-select": "^2.2.6",
2225
"@radix-ui/react-separator": "^1.1.7",
2326
"@radix-ui/react-slot": "^1.2.3",
24-
"@radix-ui/react-switch": "^1.2.5",
25-
"@radix-ui/react-tabs": "^1.1.12",
26-
"@radix-ui/react-tooltip": "^1.2.7",
27-
"@tauri-apps/api": "^2.5.0",
27+
"@radix-ui/react-switch": "^1.2.6",
28+
"@radix-ui/react-tabs": "^1.1.13",
29+
"@radix-ui/react-tooltip": "^1.2.8",
30+
"@tauri-apps/api": "^2.8.0",
2831
"@tauri-apps/plugin-dialog": "~2.2.2",
2932
"class-variance-authority": "^0.7.1",
3033
"clsx": "^2.1.1",
3134
"cmdk": "1.0.0",
32-
"framer-motion": "^12.17.0",
35+
"framer-motion": "^12.23.18",
3336
"lucide-react": "^0.441.0",
3437
"next-themes": "^0.4.6",
3538
"react": "^18.3.1",
@@ -40,15 +43,18 @@
4043
"tailwindcss-animate": "^1.0.7"
4144
},
4245
"devDependencies": {
43-
"@tauri-apps/cli": "^2.5.0",
44-
"@types/node": "^22.15.31",
45-
"@types/react": "^18.3.23",
46+
"@tauri-apps/cli": "^2.8.4",
47+
"@types/jest": "^29.5.14",
48+
"@types/node": "^22.18.6",
49+
"@types/react": "^18.3.24",
4650
"@types/react-dom": "^18.3.7",
47-
"@vitejs/plugin-react": "^4.5.2",
51+
"@vitejs/plugin-react": "^4.7.0",
4852
"autoprefixer": "^10.4.21",
49-
"postcss": "^8.5.4",
53+
"jest": "^29.7.0",
54+
"postcss": "^8.5.6",
5055
"tailwindcss": "^3.4.17",
51-
"typescript": "^5.8.3",
56+
"ts-jest": "^29.4.4",
57+
"typescript": "^5.9.2",
5258
"vite": "^5.4.20"
5359
}
5460
}

0 commit comments

Comments
 (0)