From a69524c231f6cc0be7f63bb91fdd65c4f4290c75 Mon Sep 17 00:00:00 2001 From: protheeuz Date: Sat, 31 Jan 2026 05:58:40 +0700 Subject: [PATCH 1/5] fix(quality): remove unused variables and exclude web from tests - Remove unused _minFrequency field from MemoryCache - Remove unused normalizedSql variable from QueryOptimizer - Update melos test commands to ignore web package (no tests) - Fix flutter analyze warnings for code quality compliance --- packages/local_storage_cache/lib/src/cache/memory_cache.dart | 4 ---- .../lib/src/optimization/query_optimizer.dart | 1 - pubspec.yaml | 4 ++-- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/packages/local_storage_cache/lib/src/cache/memory_cache.dart b/packages/local_storage_cache/lib/src/cache/memory_cache.dart index f930c31..c6bc8a0 100644 --- a/packages/local_storage_cache/lib/src/cache/memory_cache.dart +++ b/packages/local_storage_cache/lib/src/cache/memory_cache.dart @@ -30,9 +30,6 @@ class MemoryCache { /// Maps frequency count to set of keys with that frequency. final Map> _frequencyMap = {}; - /// Minimum frequency for LFU. - int _minFrequency = 0; - /// Gets a value from cache. T? get(String key) { final entry = _cache[key]; @@ -97,7 +94,6 @@ class MemoryCache { // Update LFU frequency map (new entries start at frequency 0) if (evictionPolicy == EvictionPolicy.lfu) { _frequencyMap.putIfAbsent(0, () => {}).add(key); - _minFrequency = 0; } } diff --git a/packages/local_storage_cache/lib/src/optimization/query_optimizer.dart b/packages/local_storage_cache/lib/src/optimization/query_optimizer.dart index 015063f..9cee178 100644 --- a/packages/local_storage_cache/lib/src/optimization/query_optimizer.dart +++ b/packages/local_storage_cache/lib/src/optimization/query_optimizer.dart @@ -173,7 +173,6 @@ class QueryOptimizer { if (schema == null) return []; final missingIndexes = []; - final normalizedSql = sql.toUpperCase(); // Check WHERE clause final whereMatch = diff --git a/pubspec.yaml b/pubspec.yaml index 6efb9f2..c72d355 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -38,11 +38,11 @@ melos: test: description: Run tests in all packages - run: melos exec --fail-fast -- flutter test + run: melos exec --fail-fast --ignore="*_web" -- flutter test test:coverage: description: Run tests with coverage in all packages - run: melos exec --fail-fast -- flutter test --coverage + run: melos exec --fail-fast --ignore="*_web" -- flutter test --coverage clean: description: Clean all packages From c14cea0f6c94f558220c7b91676837ee4074f8f0 Mon Sep 17 00:00:00 2001 From: protheeuz Date: Sat, 31 Jan 2026 06:06:57 +0700 Subject: [PATCH 2/5] fix(ci): add Windows support for melos installation - Add platform-specific melos installation steps - Use PowerShell for Windows PATH configuration - Unix systems (Linux/macOS) use bash PATH configuration - Fix 'melos: command not found' error on Windows runners --- .github/workflows/code-integration.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/code-integration.yml b/.github/workflows/code-integration.yml index 47170a6..2b0ee51 100644 --- a/.github/workflows/code-integration.yml +++ b/.github/workflows/code-integration.yml @@ -78,11 +78,19 @@ jobs: restore-keys: | ${{ runner.os }}-pub- - - name: Install Melos + - name: Install Melos (Unix) + if: runner.os != 'Windows' run: | flutter pub global activate melos echo "$HOME/.pub-cache/bin" >> $GITHUB_PATH + - name: Install Melos (Windows) + if: runner.os == 'Windows' + run: | + flutter pub global activate melos + echo "$env:LOCALAPPDATA\Pub\Cache\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + shell: pwsh + - name: Bootstrap Workspace run: melos bootstrap From 03ecc25e326f3a70190bc9847c8608effe3e3358 Mon Sep 17 00:00:00 2001 From: protheeuz Date: Sat, 31 Jan 2026 06:14:46 +0700 Subject: [PATCH 3/5] fix(ci): use flutter pub global run for Windows melos commands - Windows PATH update in PowerShell not available in bash shell - Use 'flutter pub global run melos' for Windows bootstrap - Add separate bootstrap steps for Unix and Windows - Add release workflow and documentation Changes: - Split bootstrap step by platform - Add RELEASE_PROCESS.md guide - Add automated release workflow --- .github/RELEASE_PROCESS.md | 174 +++++++++++++++++++++++++ .github/workflows/code-integration.yml | 12 +- .github/workflows/release.yml | 78 ++++++----- 3 files changed, 224 insertions(+), 40 deletions(-) create mode 100644 .github/RELEASE_PROCESS.md diff --git a/.github/RELEASE_PROCESS.md b/.github/RELEASE_PROCESS.md new file mode 100644 index 0000000..d5d7680 --- /dev/null +++ b/.github/RELEASE_PROCESS.md @@ -0,0 +1,174 @@ +# Release Process Guide + +Panduan lengkap untuk membuat release di repository ini. + +## 📋 Overview + +Repository ini menggunakan **Release Drafter** untuk otomatis membuat draft release dan **GitHub Actions** untuk publish release dengan tags. + +## 🔄 Workflow Release + +### 1. Development & PR + +Ketika membuat PR, tambahkan label yang sesuai: + +- `breaking` / `breaking-change` → Major version bump (v3.0.0) +- `feature` / `feat` / `enhancement` → Minor version bump (v2.1.0) +- `fix` / `bug` → Patch version bump (v2.0.1) +- `docs` / `chore` / `refactor` → Patch version bump (v2.0.1) + +**Contoh**: + +```bash +# PR dengan label "fix" akan menghasilkan v2.0.1 +# PR dengan label "feature" akan menghasilkan v2.1.0 +# PR dengan label "breaking" akan menghasilkan v3.0.0 +``` + +### 2. Merge ke Main + +Setelah PR di-merge ke `main`: + +1. **Release Drafter otomatis membuat/update draft release** +2. Buka: `https://github.com/YOUR_USERNAME/local-storage-cache/releases` +3. Anda akan melihat draft release dengan: + - ✅ Title: `v2.0.1` (otomatis) + - ✅ Description: List semua PR yang di-merge (otomatis) + - ✅ Categorized by labels (otomatis) + +### 3. Publish Release (2 Cara) + +#### Cara 1: Manual via GitHub UI (Recommended untuk kontrol penuh) + +1. Buka draft release di GitHub +2. Review title, description, dan changes +3. Edit jika perlu (tambahkan catatan khusus, breaking changes, dll) +4. Klik **"Publish release"** +5. GitHub otomatis membuat tag dan trigger workflow release + +#### Cara 2: Via Git Command Line (Untuk advanced users) + +```bash +# 1. Pastikan di main branch dan up to date +git checkout main +git pull origin main + +# 2. Buat tag dengan format v*.*.* +git tag -a v2.0.1 -m "Release v2.0.1" + +# 3. Push tag ke GitHub +git push origin v2.0.1 + +# 4. GitHub Actions otomatis: +# - Run tests +# - Run analysis +# - Generate changelog +# - Create release +``` + +## 📝 Format Commit Messages + +Gunakan conventional commits untuk changelog yang lebih baik: + +```bash +feat(query): add support for LEFT JOIN operations +fix(cache): resolve memory leak in LFU eviction +docs(readme): update installation instructions +perf(storage): optimize batch insert performance +refactor(core): simplify query builder logic +test(engine): add tests for transaction rollback +chore(deps): update dependencies +ci(workflow): fix Windows PATH configuration +``` + +## 🏷️ Version Numbering (Semantic Versioning) + +Format: `MAJOR.MINOR.PATCH` (contoh: `v2.0.1`) + +- **MAJOR** (v3.0.0): Breaking changes yang tidak backward compatible +- **MINOR** (v2.1.0): New features yang backward compatible +- **PATCH** (v2.0.1): Bug fixes dan improvements + +## 📦 Contoh Release Description (Otomatis) + +```markdown +## Changes + +### 🚀 New Features +- Add support for LEFT JOIN operations (#123) +- Implement query caching mechanism (#124) + +### 🐛 Bug Fixes +- Fix memory leak in LFU eviction (#125) +- Resolve cache invalidation issue (#126) + +### 📚 Documentation +- Update README with new examples (#127) + +### 🔧 Maintenance +- Update dependencies (#128) +- Fix CI workflow for Windows (#129) + +## Installation + +Add this to your package's `pubspec.yaml` file: + +\`\`\`yaml +dependencies: + local_storage_cache: ^2.0.1 +\`\`\` + +## Contributors + +@username1, @username2 +``` + +## 🔍 Checklist Sebelum Release + +- [ ] All CI workflows passing (code-quality, code-integration) +- [ ] All tests passing (380+ tests) +- [ ] No analyzer warnings +- [ ] CHANGELOG.md updated (optional, Release Drafter handles this) +- [ ] Version number di pubspec.yaml sudah benar +- [ ] Breaking changes documented (jika ada) +- [ ] Migration guide provided (jika ada breaking changes) + +## 🚀 Post-Release + +Setelah release published: + +1. **Verify release**: Check GitHub releases page +2. **Update documentation**: Jika ada perubahan API +3. **Announce**: Inform users via channels (Discord, Twitter, dll) +4. **Monitor**: Watch for issues or bug reports + +## 🛠️ Troubleshooting + +### Draft release tidak muncul? + +- Pastikan PR sudah di-merge ke `main` +- Check workflow runs di Actions tab +- Pastikan release-drafter.yml config benar + +### Version number salah? + +- Edit draft release di GitHub UI +- Ubah title dan tag sebelum publish +- Atau delete draft dan buat manual + +### Ingin skip release drafter? + +Buat release manual: + +1. Go to Releases → "Draft a new release" +2. Choose tag: Create new tag `v2.0.1` +3. Target: `main` +4. Write description manually +5. Publish + +## 📚 Resources + +- [Semantic Versioning](https://semver.org/) +- [Conventional Commits](https://www.conventionalcommits.org/) +- [Release Drafter](https://github.com/release-drafter/release-drafter) +- [GitHub Releases](https://docs.github.com/en/repositories/releasing-projects-on-github) diff --git a/.github/workflows/code-integration.yml b/.github/workflows/code-integration.yml index 2b0ee51..4a39aba 100644 --- a/.github/workflows/code-integration.yml +++ b/.github/workflows/code-integration.yml @@ -86,14 +86,18 @@ jobs: - name: Install Melos (Windows) if: runner.os == 'Windows' - run: | - flutter pub global activate melos - echo "$env:LOCALAPPDATA\Pub\Cache\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + run: flutter pub global activate melos shell: pwsh - - name: Bootstrap Workspace + - name: Bootstrap Workspace (Unix) + if: runner.os != 'Windows' run: melos bootstrap + - name: Bootstrap Workspace (Windows) + if: runner.os == 'Windows' + run: flutter pub global run melos bootstrap + shell: pwsh + - name: Run Platform Tests run: flutter test working-directory: packages/local_storage_cache diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f949541..ca2299e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,13 +3,13 @@ name: Release on: push: tags: - - 'v*' + - 'v*.*.*' permissions: contents: write jobs: - create_release: + create-release: name: Create Release runs-on: ubuntu-latest @@ -19,51 +19,57 @@ jobs: with: fetch-depth: 0 - - name: Get Tag Name - id: tag - run: echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT + - name: Set Up Flutter + uses: subosito/flutter-action@v2 + with: + channel: stable + cache: true - - name: Get Previous Tag - id: prev_tag + - name: Install Melos run: | - PREV_TAG=$(git describe --tags --abbrev=0 ${{ steps.tag.outputs.tag }}^ 2>/dev/null || echo "") - echo "prev_tag=${PREV_TAG}" >> $GITHUB_OUTPUT + flutter pub global activate melos + echo "$HOME/.pub-cache/bin" >> $GITHUB_PATH + + - name: Bootstrap Workspace + run: melos bootstrap + + - name: Run Tests + run: melos test + + - name: Run Analysis + run: melos analyze - name: Generate Changelog id: changelog run: | - if [ -z "${{ steps.prev_tag.outputs.prev_tag }}" ]; then - CHANGELOG=$(git log --pretty=format:"- %s (%h)" ${{ steps.tag.outputs.tag }}) + # Get previous tag + PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "") + + if [ -z "$PREV_TAG" ]; then + # First release, get all commits + COMMITS=$(git log --pretty=format:"- %s (%h)" --no-merges) else - CHANGELOG=$(git log --pretty=format:"- %s (%h)" ${{ steps.prev_tag.outputs.prev_tag }}..${{ steps.tag.outputs.tag }}) + # Get commits since previous tag + COMMITS=$(git log ${PREV_TAG}..HEAD --pretty=format:"- %s (%h)" --no-merges) fi - echo "changelog<> $GITHUB_OUTPUT - echo "$CHANGELOG" >> $GITHUB_OUTPUT - echo "EOF" >> $GITHUB_OUTPUT + + # Save to file for multiline output + echo "$COMMITS" > changelog.txt + + # Set output + echo "previous_tag=$PREV_TAG" >> $GITHUB_OUTPUT - name: Create Release - uses: softprops/action-gh-release@v2 + uses: softprops/action-gh-release@v1 with: - tag_name: ${{ steps.tag.outputs.tag }} - name: Release ${{ steps.tag.outputs.tag }} - body: | - ## Changes in ${{ steps.tag.outputs.tag }} - - ${{ steps.changelog.outputs.changelog }} - - ## Installation - - Add this to your package's `pubspec.yaml` file: - - ```yaml - dependencies: - local_storage_cache: ${{ steps.tag.outputs.tag }} - ``` - - ## Full Changelog - - See [CHANGELOG.md](https://github.com/protheeuz/local-storage-cache/blob/${{ steps.tag.outputs.tag }}/packages/local_storage_cache/CHANGELOG.md) for detailed changes. + body_path: changelog.txt draft: false - prerelease: ${{ contains(steps.tag.outputs.tag, '-') }} + prerelease: false + generate_release_notes: true env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Notify Success + run: | + echo "✅ Release ${{ github.ref_name }} created successfully!" + echo "📦 View release at: https://github.com/${{ github.repository }}/releases/tag/${{ github.ref_name }}" From 9ba81ab7c627c42c1eddde91ef656a0d8cb79923 Mon Sep 17 00:00:00 2001 From: protheeuz Date: Sat, 31 Jan 2026 06:17:28 +0700 Subject: [PATCH 4/5] chore: add RELEASE_PROCESS.md to gitignore - Remove RELEASE_PROCESS.md from repository - Add to .gitignore for local reference only --- .github/RELEASE_PROCESS.md | 174 ------------------------------------- .gitignore | 3 +- 2 files changed, 2 insertions(+), 175 deletions(-) delete mode 100644 .github/RELEASE_PROCESS.md diff --git a/.github/RELEASE_PROCESS.md b/.github/RELEASE_PROCESS.md deleted file mode 100644 index d5d7680..0000000 --- a/.github/RELEASE_PROCESS.md +++ /dev/null @@ -1,174 +0,0 @@ -# Release Process Guide - -Panduan lengkap untuk membuat release di repository ini. - -## 📋 Overview - -Repository ini menggunakan **Release Drafter** untuk otomatis membuat draft release dan **GitHub Actions** untuk publish release dengan tags. - -## 🔄 Workflow Release - -### 1. Development & PR - -Ketika membuat PR, tambahkan label yang sesuai: - -- `breaking` / `breaking-change` → Major version bump (v3.0.0) -- `feature` / `feat` / `enhancement` → Minor version bump (v2.1.0) -- `fix` / `bug` → Patch version bump (v2.0.1) -- `docs` / `chore` / `refactor` → Patch version bump (v2.0.1) - -**Contoh**: - -```bash -# PR dengan label "fix" akan menghasilkan v2.0.1 -# PR dengan label "feature" akan menghasilkan v2.1.0 -# PR dengan label "breaking" akan menghasilkan v3.0.0 -``` - -### 2. Merge ke Main - -Setelah PR di-merge ke `main`: - -1. **Release Drafter otomatis membuat/update draft release** -2. Buka: `https://github.com/YOUR_USERNAME/local-storage-cache/releases` -3. Anda akan melihat draft release dengan: - - ✅ Title: `v2.0.1` (otomatis) - - ✅ Description: List semua PR yang di-merge (otomatis) - - ✅ Categorized by labels (otomatis) - -### 3. Publish Release (2 Cara) - -#### Cara 1: Manual via GitHub UI (Recommended untuk kontrol penuh) - -1. Buka draft release di GitHub -2. Review title, description, dan changes -3. Edit jika perlu (tambahkan catatan khusus, breaking changes, dll) -4. Klik **"Publish release"** -5. GitHub otomatis membuat tag dan trigger workflow release - -#### Cara 2: Via Git Command Line (Untuk advanced users) - -```bash -# 1. Pastikan di main branch dan up to date -git checkout main -git pull origin main - -# 2. Buat tag dengan format v*.*.* -git tag -a v2.0.1 -m "Release v2.0.1" - -# 3. Push tag ke GitHub -git push origin v2.0.1 - -# 4. GitHub Actions otomatis: -# - Run tests -# - Run analysis -# - Generate changelog -# - Create release -``` - -## 📝 Format Commit Messages - -Gunakan conventional commits untuk changelog yang lebih baik: - -```bash -feat(query): add support for LEFT JOIN operations -fix(cache): resolve memory leak in LFU eviction -docs(readme): update installation instructions -perf(storage): optimize batch insert performance -refactor(core): simplify query builder logic -test(engine): add tests for transaction rollback -chore(deps): update dependencies -ci(workflow): fix Windows PATH configuration -``` - -## 🏷️ Version Numbering (Semantic Versioning) - -Format: `MAJOR.MINOR.PATCH` (contoh: `v2.0.1`) - -- **MAJOR** (v3.0.0): Breaking changes yang tidak backward compatible -- **MINOR** (v2.1.0): New features yang backward compatible -- **PATCH** (v2.0.1): Bug fixes dan improvements - -## 📦 Contoh Release Description (Otomatis) - -```markdown -## Changes - -### 🚀 New Features -- Add support for LEFT JOIN operations (#123) -- Implement query caching mechanism (#124) - -### 🐛 Bug Fixes -- Fix memory leak in LFU eviction (#125) -- Resolve cache invalidation issue (#126) - -### 📚 Documentation -- Update README with new examples (#127) - -### 🔧 Maintenance -- Update dependencies (#128) -- Fix CI workflow for Windows (#129) - -## Installation - -Add this to your package's `pubspec.yaml` file: - -\`\`\`yaml -dependencies: - local_storage_cache: ^2.0.1 -\`\`\` - -## Contributors - -@username1, @username2 -``` - -## 🔍 Checklist Sebelum Release - -- [ ] All CI workflows passing (code-quality, code-integration) -- [ ] All tests passing (380+ tests) -- [ ] No analyzer warnings -- [ ] CHANGELOG.md updated (optional, Release Drafter handles this) -- [ ] Version number di pubspec.yaml sudah benar -- [ ] Breaking changes documented (jika ada) -- [ ] Migration guide provided (jika ada breaking changes) - -## 🚀 Post-Release - -Setelah release published: - -1. **Verify release**: Check GitHub releases page -2. **Update documentation**: Jika ada perubahan API -3. **Announce**: Inform users via channels (Discord, Twitter, dll) -4. **Monitor**: Watch for issues or bug reports - -## 🛠️ Troubleshooting - -### Draft release tidak muncul? - -- Pastikan PR sudah di-merge ke `main` -- Check workflow runs di Actions tab -- Pastikan release-drafter.yml config benar - -### Version number salah? - -- Edit draft release di GitHub UI -- Ubah title dan tag sebelum publish -- Atau delete draft dan buat manual - -### Ingin skip release drafter? - -Buat release manual: - -1. Go to Releases → "Draft a new release" -2. Choose tag: Create new tag `v2.0.1` -3. Target: `main` -4. Write description manually -5. Publish - -## 📚 Resources - -- [Semantic Versioning](https://semver.org/) -- [Conventional Commits](https://www.conventionalcommits.org/) -- [Release Drafter](https://github.com/release-drafter/release-drafter) -- [GitHub Releases](https://docs.github.com/en/repositories/releasing-projects-on-github) diff --git a/.gitignore b/.gitignore index e534671..7312b98 100644 --- a/.gitignore +++ b/.gitignore @@ -31,4 +31,5 @@ build/ .flutter-plugins-dependencies .kiro/ -AGENTS.md \ No newline at end of file +AGENTS.md +.github/RELEASE_PROCESS.md \ No newline at end of file From 517d46309625f0637edc75c914cf5e6058e52828 Mon Sep 17 00:00:00 2001 From: protheeuz Date: Sat, 31 Jan 2026 06:22:09 +0700 Subject: [PATCH 5/5] fix(ci): run tests sequentially to avoid flutter lock conflicts - Add --concurrency=1 to melos test commands - Prevents multiple flutter commands from running simultaneously - Fixes 'Waiting for another flutter command to release the startup lock' errors - Update both workflow and melos scripts --- .github/workflows/code-integration.yml | 2 +- pubspec.yaml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/code-integration.yml b/.github/workflows/code-integration.yml index 4a39aba..c6850b1 100644 --- a/.github/workflows/code-integration.yml +++ b/.github/workflows/code-integration.yml @@ -47,7 +47,7 @@ jobs: run: melos bootstrap - name: Run Unit Tests - run: melos test + run: melos exec --fail-fast --ignore="*_web" --concurrency=1 -- flutter test platform_tests: name: Platform Tests diff --git a/pubspec.yaml b/pubspec.yaml index c72d355..ade0c01 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -38,11 +38,11 @@ melos: test: description: Run tests in all packages - run: melos exec --fail-fast --ignore="*_web" -- flutter test + run: melos exec --fail-fast --ignore="*_web" --concurrency=1 -- flutter test test:coverage: description: Run tests with coverage in all packages - run: melos exec --fail-fast --ignore="*_web" -- flutter test --coverage + run: melos exec --fail-fast --ignore="*_web" --concurrency=1 -- flutter test --coverage clean: description: Clean all packages