-
Notifications
You must be signed in to change notification settings - Fork 9
feat(coin-updates): integrate komodo_coin_updates into komodo_coins #190
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
Merged
Merged
Changes from all commits
Commits
Show all changes
43 commits
Select commit
Hold shift + click to select a range
2023eca
refactor(coin-updates): migrate to hive_ce with generated adapters
takenagain 0602158
refactor(coin-updates): migrate from equatable to freezed
takenagain 3fef011
test(coin-updates): add basic unit tests for data layer
takenagain dfce286
refactor(coin-updates): use komodo_types Asset models for parsing
takenagain ec71788
chore(coin-updates): update runtime update config model
takenagain 2e2e31c
test(coin-updates): add hive ce tests and test harness
takenagain 5b78648
feat(coin-updates): integrate komodo_coin_updates into komodo_coins
takenagain 3cd75e9
refactor(coin-updates): replace manual barrel files with index_generator
takenagain e275ead
refactor(review): add default annotations, improve error handling & l…
takenagain 509d1d3
test(coin-updates): expand test cases and edge case testing
takenagain f6bdd10
refactor(example): replace futurebuilder with cubit approach
takenagain 8bcb243
ci(tests): add flutter test workflow
takenagain 7022a14
docs(coin-updates): add auto-generated docs
takenagain fa7d08a
feat(ci): add package filter parameter for running specific tests
takenagain 8ce6285
test(coin-updates): address nitpicks and improve coverage
takenagain d2f2764
fix(asset): align toJson with the expected structure in fromJson
takenagain 0f7a5c6
refactor(komodo_coins): split config updating and fetching
takenagain e060b4c
test(komodo_coins): add unit tests for the new managers and strategies
takenagain 453105d
fix(coin-updates): confirm boxes are not empty for exists check
takenagain 46697de
Merge remote-tracking branch 'origin/dev' into feat/runtime-coin-updates
takenagain d28133a
fix(komodo_coins): initialize hive box
takenagain 3d01b5b
fix(coin-updates): revert changes to asset classes and use protocol.c…
takenagain d9335df
test(coin-updates): document and deduplicate tests
takenagain 617f140
fix(coins): use dedicated startup coins provider for kdf startup
takenagain d17ee5d
Merge remote-tracking branch 'origin/dev' into feat/runtime-coin-updates
takenagain 61dc49a
ci: add GITHUB_TOKEN to flutter build steps
takenagain 38e4b77
refactor(coin-updates): move build_config models to defi_types package
takenagain 273f72f
fix(sparkline): cherry pick of 5dc948 to migrate to hive_ce
takenagain 212c906
Merge branch 'dev' into feat/runtime-coin-updates
takenagain 0f86fa1
refactor(review): update comments, references, and unnecessary libraries
takenagain 1a25a1e
docs(coin_updates): update and add recommended SDK approach
takenagain c2db66a
refactor(seed-node-updater): use the new runtime update config for URL
takenagain 98b0f71
fix(build-transformer): use new cdn mirrors and add unit tests
takenagain 7d0dda9
fix(cex-market-data): add handling for too many request responses
takenagain 37b5b04
docs&tests: update doc references, add example, remove faulty tests
takenagain 0b01251
Merge branch 'dev' into feat/runtime-coin-updates
takenagain 21eff1c
build(kdf): add transformer_invoker back for build transformer
takenagain 2cb6cf0
Optimize in-flight request cleanup to avoid blocking response
cursoragent adb136f
fix(sparkline): Use unawaited for in-flight request cleanup to preven…
takenagain 9423a80
Merge branch 'dev' into feat/runtime-coin-updates
takenagain 19303ab
test(cex-market-data): fix ohlc breaking changes and add ci build step
takenagain 383bca8
test(komodo_defi_rpc_methods): update rpc method test cases & interfaces
takenagain d113410
build: disable concurrent downloads for GitHub CI stability
takenagain File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,198 @@ | ||
| name: Flutter package tests (consolidated) | ||
| permissions: | ||
| contents: read | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
| pull_request: | ||
| branches: [main, dev, feat/**, bugfix/**, hotfix/**] | ||
| workflow_dispatch: | ||
| inputs: | ||
| package: | ||
| description: "Optional package path to test (e.g., packages/komodo_coin_updates or komodo_coin_updates)" | ||
| required: false | ||
| package_regex: | ||
| description: "Optional regex to filter packages (applied to full path under packages/*)" | ||
| required: false | ||
|
|
||
| jobs: | ||
| test-all: | ||
| name: Flutter tests (all packages) | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Flutter (stable) | ||
| uses: subosito/flutter-action@v2 | ||
| with: | ||
| channel: stable | ||
| flutter-version: "3.35.1" | ||
| architecture: x64 | ||
|
|
||
| - name: Cache pub dependencies | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: | | ||
| ~/.pub-cache | ||
| **/.dart_tool | ||
| key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-pub- | ||
|
|
||
| - name: Discover packages | ||
| id: discover | ||
| shell: bash | ||
| run: | | ||
| set -euo pipefail | ||
| input_pkg="${{ github.event.inputs.package || '' }}" | ||
| input_re="${{ github.event.inputs.package_regex || '' }}" | ||
|
|
||
| # Discover all packages with pubspec.yaml | ||
| mapfile -t all_pkgs < <(find packages -mindepth 1 -maxdepth 1 -type d -exec test -e '{}/pubspec.yaml' ';' -print | sort) | ||
|
|
||
| filter_pkgs=() | ||
| if [ -n "$input_pkg" ]; then | ||
| # Normalize to packages/<name> | ||
| if [[ "$input_pkg" != packages/* ]]; then | ||
| input_pkg="packages/$input_pkg" | ||
| fi | ||
| if [ -e "$input_pkg/pubspec.yaml" ]; then | ||
| filter_pkgs+=("$input_pkg") | ||
| else | ||
| echo "No pubspec.yaml found at $input_pkg; no packages to test" >&2 | ||
| echo "packages=" >> "$GITHUB_OUTPUT" | ||
| exit 0 | ||
| fi | ||
| elif [ -n "$input_re" ]; then | ||
| while IFS= read -r p; do | ||
| if echo "$p" | grep -Eq "$input_re"; then | ||
| filter_pkgs+=("$p") | ||
| fi | ||
| done < <(printf '%s\n' "${all_pkgs[@]}") | ||
| else | ||
| filter_pkgs=("${all_pkgs[@]}") | ||
| fi | ||
|
|
||
| # Keep only packages that contain a test/ directory | ||
| with_tests=() | ||
| for p in "${filter_pkgs[@]}"; do | ||
| if [ -d "$p/test" ]; then | ||
| with_tests+=("$p") | ||
| fi | ||
| done | ||
|
|
||
| if [ ${#with_tests[@]} -eq 0 ]; then | ||
| echo "packages=" >> "$GITHUB_OUTPUT" | ||
| exit 0 | ||
| fi | ||
|
|
||
| # Output space-separated list of packages | ||
| echo "packages=${with_tests[*]}" >> "$GITHUB_OUTPUT" | ||
| echo "Found packages with tests: ${with_tests[*]}" | ||
|
|
||
| - name: Install dependencies for all packages | ||
| if: steps.discover.outputs.packages != '' | ||
| shell: bash | ||
| run: | | ||
| packages="${{ steps.discover.outputs.packages }}" | ||
| if [ -n "$packages" ]; then | ||
| for pkg in $packages; do | ||
| echo "Installing dependencies for $pkg..." | ||
| cd "$pkg" | ||
| flutter pub get | ||
| cd - > /dev/null | ||
| done | ||
| fi | ||
|
|
||
| - name: Run dry web build to generate assets (expected to fail) | ||
| if: steps.discover.outputs.packages != '' | ||
| env: | ||
| GITHUB_API_PUBLIC_READONLY_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| working-directory: packages/komodo_defi_sdk/example | ||
| run: flutter build web --release || echo "Dry build completed (failure expected)" | ||
|
|
||
| - name: Run tests for all packages | ||
| if: steps.discover.outputs.packages != '' | ||
| env: | ||
| GITHUB_API_PUBLIC_READONLY_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| shell: bash | ||
| run: | | ||
| packages="${{ steps.discover.outputs.packages }}" | ||
|
|
||
| # Initialize results tracking | ||
| declare -A test_results | ||
| declare -A test_outputs | ||
| overall_success=true | ||
|
|
||
| echo "# Test Results" > test_summary.md | ||
| echo "" >> test_summary.md | ||
| echo "| Package | Status | Details |" >> test_summary.md | ||
| echo "|---------|--------|---------|" >> test_summary.md | ||
|
|
||
| # Run tests for each package | ||
| for pkg in $packages; do | ||
| echo "" | ||
| echo "=========================================" | ||
| echo "Testing package: $pkg" | ||
| echo "=========================================" | ||
|
|
||
| cd "$pkg" | ||
|
|
||
| # Run flutter test and capture output and exit code | ||
| if flutter_output=$(flutter test -r expanded 2>&1); then | ||
| test_results["$pkg"]="✅ PASS" | ||
| test_outputs["$pkg"]="Tests passed successfully" | ||
| echo "✅ $pkg: PASSED" | ||
| else | ||
| test_results["$pkg"]="❌ FAIL" | ||
| test_outputs["$pkg"]=$(echo "$flutter_output" | tail -n 10) # Last 10 lines for brevity | ||
| echo "❌ $pkg: FAILED" | ||
| overall_success=false | ||
| fi | ||
|
|
||
| cd - > /dev/null | ||
| done | ||
|
|
||
| echo "" | ||
| echo "=========================================" | ||
| echo "TEST SUMMARY" | ||
| echo "=========================================" | ||
|
|
||
| # Generate summary table | ||
| for pkg in $packages; do | ||
| status="${test_results[$pkg]}" | ||
| details="${test_outputs[$pkg]}" | ||
| # Escape pipe characters in details for markdown table | ||
| details=$(echo "$details" | sed 's/|/\\|/g' | tr '\n' ' ' | sed 's/ */ /g' | cut -c1-100) | ||
| if [ ${#details} -eq 100 ]; then | ||
| details="${details}..." | ||
| fi | ||
| echo "| \`$pkg\` | $status | $details |" >> test_summary.md | ||
| echo "$status $pkg" | ||
| done | ||
|
|
||
| echo "" | ||
| cat test_summary.md | ||
|
|
||
| # Set step summary for GitHub Actions | ||
| cat test_summary.md >> "$GITHUB_STEP_SUMMARY" | ||
|
|
||
| # Fail the job if any tests failed | ||
| if [ "$overall_success" = false ]; then | ||
| echo "" | ||
| echo "❌ One or more test suites failed!" | ||
| exit 1 | ||
| else | ||
| echo "" | ||
| echo "✅ All test suites passed!" | ||
| fi | ||
|
|
||
| - name: Upload test summary | ||
| if: always() && steps.discover.outputs.packages != '' | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: test-summary | ||
| path: test_summary.md | ||
| retention-days: 30 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| # Run GitHub Actions locally with act | ||
|
|
||
| This guide shows how to run the Flutter test workflow locally using act, filter to a single package, and re-run failed jobs on GitHub. | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| - Docker (required by act) | ||
| - Windows: [Install Docker Desktop on Windows](https://docs.docker.com/desktop/install/windows-install/) | ||
| - macOS: [Install Docker Desktop on Mac](https://docs.docker.com/desktop/install/mac-install/) | ||
| - Ubuntu: [Install Docker Engine on Ubuntu](https://docs.docker.com/engine/install/ubuntu/) | ||
|
|
||
| - act | ||
| - macOS (Homebrew): | ||
|
|
||
| ```bash | ||
| brew install act | ||
| ``` | ||
|
|
||
| - Other platforms: download a binary from [nektos/act releases](https://github.com/nektos/act/releases) and put it on your PATH | ||
| - Repo/docs: [nektos/act](https://github.com/nektos/act) | ||
|
|
||
| - (Optional) GitHub CLI (to re-run failed jobs on GitHub): | ||
| - Install: [GitHub CLI](https://cli.github.com/) | ||
|
|
||
| ## Notes for Apple Silicon (M-series) Macs | ||
|
|
||
| - act may need to run containers as amd64: | ||
| - Add: `--container-architecture linux/amd64` | ||
| - Map `ubuntu-latest` to an image: `-P ubuntu-latest=catthehacker/ubuntu:act-latest` | ||
|
|
||
| ## Common commands | ||
|
|
||
| - List jobs in this workflow: | ||
|
|
||
| ```bash | ||
| act -l -W .github/workflows/flutter-tests.yml | ||
| ``` | ||
|
|
||
| - Run the test job for all packages (verbose): | ||
|
|
||
| ```bash | ||
| act -j test --verbose \ | ||
| -W .github/workflows/flutter-tests.yml \ | ||
| -P ubuntu-latest=catthehacker/ubuntu:act-latest \ | ||
| --container-architecture linux/amd64 | ||
| ``` | ||
|
|
||
| - Run only a single package (e.g., packages/komodo_coin_updates) via workflow_dispatch input (verbose): | ||
|
|
||
| ```bash | ||
| act workflow_dispatch -j test --verbose \ | ||
| -W .github/workflows/flutter-tests.yml \ | ||
| -P ubuntu-latest=catthehacker/ubuntu:act-latest \ | ||
| --container-architecture linux/amd64 \ | ||
| --input package=komodo_coin_updates | ||
| ``` | ||
|
|
||
| - Filter packages by regex (matches paths under `packages/*`): | ||
|
|
||
| ```bash | ||
| act workflow_dispatch -j test --verbose \ | ||
| -W .github/workflows/flutter-tests.yml \ | ||
| -P ubuntu-latest=catthehacker/ubuntu:act-latest \ | ||
| --container-architecture linux/amd64 \ | ||
| --input package_regex='komodo_coin_updates' | ||
| ``` | ||
|
|
||
| ## Re-run only failed jobs on GitHub | ||
|
|
||
| - GitHub UI: Actions → select the failed run → Re-run jobs → Re-run failed jobs | ||
| - GitHub CLI: | ||
|
|
||
| ```bash | ||
| gh run rerun <run-id> --failed | ||
| ``` | ||
|
|
||
| ## Verify installation | ||
|
|
||
| - Docker: | ||
|
|
||
| ```bash | ||
| docker --version | ||
| docker run hello-world | ||
| ``` | ||
|
|
||
| - act: | ||
|
|
||
| ```bash | ||
| act --version | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| targets: | ||
| $default: | ||
| builders: | ||
| hive_ce_generator|hive_generator: | ||
| enabled: true | ||
| generate_for: | ||
| - lib/**.dart |
3 changes: 0 additions & 3 deletions
3
packages/komodo_cex_market_data/example/komodo_cex_market_data_example.dart
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.