diff --git a/.github/workflows/code-integration.yml b/.github/workflows/code-integration.yml index 47170a6..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 @@ -78,14 +78,26 @@ 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: Bootstrap Workspace + - name: Install Melos (Windows) + if: runner.os == 'Windows' + run: flutter pub global activate melos + shell: pwsh + + - 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 }}" 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 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..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 -- 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 -- flutter test --coverage + run: melos exec --fail-fast --ignore="*_web" --concurrency=1 -- flutter test --coverage clean: description: Clean all packages