diff --git a/.github/workflows/are_translations_sane.yml b/.github/workflows/are_translations_sane.yml deleted file mode 100644 index 5f12d042..00000000 --- a/.github/workflows/are_translations_sane.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: Are translations sane - -on: [pull_request] - -jobs: - PR_test_build: - runs-on: ubuntu-24.04 - - steps: - - uses: actions/checkout@v4 - - name: Check for translations - if: github.event_name == 'pull_request' - run: | - for i in res/values/strings_*.arb; - do - echo "tr: $i" - cat $i | jq || exit 1 - done diff --git a/.github/workflows/automated_integration_test.yml b/.github/workflows/automated_integration_test.yml deleted file mode 100644 index 1e0d1054..00000000 --- a/.github/workflows/automated_integration_test.yml +++ /dev/null @@ -1,490 +0,0 @@ - -name: Automated Integration Tests - -# Temporarily disabled - uncomment to re-enable -on: - # push: - # pull_request: - # branches: [main] - workflow_dispatch: # This is to manually trigger if needed -defaults: - run: - shell: bash -jobs: - Automated_integration_test: - runs-on: linux-amd64 - timeout-minutes: 90 - container: - image: ghcr.io/cake-tech/cake_wallet:debian12-flutter3.27.0-go1.24.1-ruststablenightly - env: - STORE_PASS: test@cake_wallet - KEY_PASS: test@cake_wallet - MONEROC_CACHE_DIR_ROOT: /opt/generic_cache - BRANCH_NAME: ${{ github.head_ref || github.ref_name }} - ANDROID_AVD_HOME: /root/.android/avd - volumes: - - /opt/cw_cache_android/root/.cache:/root/.cache - - /opt/cw_cache_android/root/.android/avd/:/root/.android/avd - - /opt/cw_cache_android/root/.ccache:/root/.ccache - - /opt/cw_cache_android/root/.pub-cache/:/root/.pub-cache - - /opt/cw_cache_android/root/.gradle/:/root/.gradle - - /opt/cw_cache_android/root/.android/:/root/.android - - /opt/cw_cache_android/root/go/pkg:/root/go/pkg - - /opt/cw_cache_android/opt/generic_cache:/opt/generic_cache - - /dev/kvm:/dev/kvm - strategy: - matrix: - api-level: [29] - - steps: - - name: Fix github actions messing up $HOME... - run: 'echo HOME=/root | sudo tee -a $GITHUB_ENV' - - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.sha || github.sha }} - - name: configure git - run: | - git config --global --add safe.directory '*' - git config --global user.email "ci@cakewallet.com" - git config --global user.name "CakeWallet CI" - - name: Get the full commit message - run: | - FULL_MESSAGE="$(git log -1 --pretty=%B)" - echo "message<> $GITHUB_ENV - echo "$FULL_MESSAGE" >> $GITHUB_ENV - echo "EOF" >> $GITHUB_ENV - - - name: Add secrets - run: | - touch cw_bitcoin/lib/.secrets.g.dart - touch cw_evm/lib/.secrets.g.dart - touch cw_solana/lib/.secrets.g.dart - touch cw_core/lib/.secrets.g.dart - touch cw_nano/lib/.secrets.g.dart - touch cw_tron/lib/.secrets.g.dart - - echo "const polygonScanApiKey = '${{ secrets.POLYGON_SCAN_API_KEY }}';" >> cw_evm/lib/.secrets.g.dart - echo "const etherScanApiKey = '${{ secrets.ETHER_SCAN_API_KEY }}';" >> cw_evm/lib/.secrets.g.dart - echo "const moralisApiKey = '${{ secrets.MORALIS_API_KEY }}';" >> cw_evm/lib/.secrets.g.dart - echo "const nowNodesApiKey = '${{ secrets.EVM_NOWNODES_API_KEY }}';" >> cw_evm/lib/.secrets.g.dart - echo "const ankrApiKey = '${{ secrets.ANKR_API_KEY }}';" >> cw_solana/lib/.secrets.g.dart - echo "const chainStackApiKey = '${{ secrets.CHAIN_STACK_API_KEY }}';" >> cw_solana/lib/.secrets.g.dart - echo "const moralisApiKey = '${{ secrets.MORALIS_API_KEY }}';" >> cw_solana/lib/.secrets.g.dart - - echo "const nano2ApiKey = '${{ secrets.NANO2_API_KEY }}';" >> cw_nano/lib/.secrets.g.dart - echo "const nanoNowNodesApiKey = '${{ secrets.NANO_NOW_NODES_API_KEY }}';" >> cw_nano/lib/.secrets.g.dart - - echo "const tronGridApiKey = '${{ secrets.TRON_GRID_API_KEY }}';" >> cw_tron/lib/.secrets.g.dart - echo "const tronNowNodesApiKey = '${{ secrets.TRON_NOW_NODES_API_KEY }}';" >> cw_tron/lib/.secrets.g.dart - - echo "const breezApiKey = '${{ secrets.BREEZ_API_KEY }}';" >> cw_bitcoin/lib/.secrets.g.dart - - echo "${{ secrets.MAIN_SECRETS_FILE }}" | base64 --decode > lib/.secrets.g.dart - - - name: prepare monero_c and cache - run: | - export MONEROC_HASH=$(cat scripts/prepare_moneroc.sh | grep 'git checkout' | xargs | awk '{ print $3 }') - echo MONEROC_HASH=$MONEROC_HASH >> /etc/environment - mkdir -p "$MONEROC_CACHE_DIR_ROOT/moneroc-$MONEROC_HASH/monero_c" - pushd scripts - ln -s "$MONEROC_CACHE_DIR_ROOT/moneroc-$MONEROC_HASH/monero_c" - ./prepare_moneroc.sh - popd - pushd scripts/monero_c - mkdir -p "$MONEROC_CACHE_DIR_ROOT/_cache/contrib/depends/built" || true - mkdir -p "$MONEROC_CACHE_DIR_ROOT/_cache/monero/contrib/depends/built" || true - mkdir -p "$MONEROC_CACHE_DIR_ROOT/_cache/wownero/contrib/depends/built" || true - mkdir -p "$MONEROC_CACHE_DIR_ROOT/_cache/contrib/depends/sources" || true - mkdir -p "$MONEROC_CACHE_DIR_ROOT/_cache/monero/contrib/depends/sources" || true - mkdir -p "$MONEROC_CACHE_DIR_ROOT/_cache/wownero/contrib/depends/sources" || true - - rm -rf "$PWD/contrib/depends/built" "$PWD/monero/contrib/depends/built" "$PWD/wownero/contrib/depends/built" - rm -rf "$PWD/contrib/depends/sources" "$PWD/monero/contrib/depends/sources" "$PWD/wownero/contrib/depends/sources" - mkdir -p contrib/depends || true - ln -sf "$MONEROC_CACHE_DIR_ROOT/_cache/contrib/depends/built" "$PWD/contrib/depends/built" - ln -sf "$MONEROC_CACHE_DIR_ROOT/_cache/monero/contrib/depends/built" "$PWD/monero/contrib/depends/built" - ln -sf "$MONEROC_CACHE_DIR_ROOT/_cache/wownero/contrib/depends/built" "$PWD/wownero/contrib/depends/built" - ln -sf "$MONEROC_CACHE_DIR_ROOT/_cache/contrib/depends/sources" "$PWD/contrib/depends/sources" - ln -sf "$MONEROC_CACHE_DIR_ROOT/_cache/monero/contrib/depends/sources" "$PWD/monero/contrib/depends/sources" - ln -sf "$MONEROC_CACHE_DIR_ROOT/_cache/wownero/contrib/depends/sources" "$PWD/wownero/contrib/depends/sources" - popd - - - name: Generate KeyStore - run: | - pushd /opt/generic_cache - if [[ ! -f key.jks ]]; - then - keytool -genkey -v -keystore key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias testKey -noprompt -dname "CN=CakeWallet, OU=CakeWallet, O=CakeWallet, L=Florida, S=America, C=USA" -storepass $STORE_PASS -keypass $KEY_PASS - else - echo "$PWD/key.jks exist, not generating" - fi - popd - cp /opt/generic_cache/key.jks android/app - - - name: Execute Build and Setup Commands - run: | - pushd scripts/android - source ./app_env.sh cakewallet - ./app_config.sh - popd - - - name: Build monero_c - run: | - pushd scripts/android/ - source ./app_env.sh cakewallet - ./build_monero_all.sh - popd - - - name: Install Flutter dependencies - run: | - flutter pub get - - - name: Build mwebd - run: | - set -x -e - export MWEBD_HASH=$(cat scripts/android/build_mwebd.sh | grep 'git reset --hard' | xargs | awk '{ print $4 }') - echo MWEBD_HASH=$MWEBD_HASH >> /etc/environment - pushd scripts/android - gomobile init; - ./build_mwebd.sh - popd - - - name: Build Decred - run: | - set -x -e - pushd scripts/android - ./build_decred.sh - popd - - - name: Build generated code - run: | - flutter --version - flutter clean - rm -rf .dart_tool - rm pubspec.lock - flutter pub get - ./model_generator.sh async - - - name: Generate key properties - run: | - dart run tool/generate_android_key_properties.dart keyAlias=testKey storeFile=key.jks storePassword=$STORE_PASS keyPassword=$KEY_PASS - - - name: Generate localization - run: | - dart run tool/generate_localization.dart - - - name: Rename app - run: | - sanitized_branch_name=${BRANCH_NAME#origin/} # Remove 'origin/' prefix if it exists - sanitized_branch_name=${sanitized_branch_name:0:16} # Take only the first 16 characters - sanitized_branch_name=$(echo "$sanitized_branch_name" | tr '[:upper:]' '[:lower:]') # Convert to lowercase - sanitized_branch_name=$(echo "$sanitized_branch_name" | sed 's/[^a-z0-9]//g') # Remove all special characters - - echo -e "id=com.cakewallet.test_${sanitized_branch_name}\nname=${BRANCH_NAME}" > android/app.properties - - - name: Build - run: | - flutter build apk --dart-define=hasDevOptions=true --release --split-per-abi - - - name: Rename apk file - run: | - sanitized_branch_name=$(grep '^id=' android/app.properties | cut -d'=' -f2 | sed 's/com\.cakewallet\.test_//') - cd build/app/outputs/flutter-apk - mkdir test-apk - - cp app-arm64-v8a-release.apk test-apk/${sanitized_branch_name}.apk - cp app-x86_64-release.apk test-apk/${sanitized_branch_name}_x86.apk - echo "APK files created: test-apk/${sanitized_branch_name}.apk and test-apk/${sanitized_branch_name}_x86.apk" - - - name: Find APK file - id: find_apk - run: | - set -x - # Read the sanitized branch name from the app.properties file - sanitized_branch_name=$(grep '^id=' android/app.properties | cut -d'=' -f2 | sed 's/com\.cakewallet\.test_//') - - echo "Looking for APK file: build/app/outputs/flutter-apk/test-apk/${sanitized_branch_name}.apk" - ls -la build/app/outputs/flutter-apk/test-apk/ || echo "test-apk directory not found" - apk_file=$(ls build/app/outputs/flutter-apk/test-apk/${sanitized_branch_name}.apk || exit 1) - echo "APK_FILE=$apk_file" >> $GITHUB_ENV - echo "APK file found: $apk_file" - ls -la "$apk_file" - - - name: ๐Ÿ” Debug System Environment - run: | - echo "=== System Information ===" - uname -a - echo "=== Container Info ===" - cat /proc/version || echo "Cannot read /proc/version" - echo "=== KVM Device Check ===" - ls -la /dev/kvm || echo "KVM device not found" - echo "=== udev Status ===" - which udevadm || echo "udevadm not found" - echo "=== Current User ===" - whoami - echo "=== Groups ===" - groups - echo "=== Environment ===" - env | grep -E "(HOME|USER|PATH)" | sort - - - name: ๐Ÿงน Clean up existing emulators - run: | - echo "=== Cleaning up existing emulators ===" - # Kill any existing emulator processes - pkill -f emulator || echo "No emulator processes found" - # Kill any existing adb processes - pkill -f adb || echo "No adb processes found" - # Wait a moment for processes to terminate - sleep 2 - # Start adb server fresh - adb start-server || echo "Failed to start adb server" - # Kill adb server to ensure clean state - adb kill-server || echo "Failed to kill adb server" - echo "=== Cleanup complete ===" - - - name: ๐Ÿ” Verify AVD Configuration - run: | - echo "=== AVD Configuration Check ===" - - # Check if AVD directory exists - echo "Checking AVD directory..." - ls -la ~/.android/avd/ || echo "AVD directory not found" - - # List available AVDs - echo "Available AVDs:" - emulator -list-avds || echo "Failed to list AVDs" - - # Check Android SDK location - echo "Android SDK location:" - echo $ANDROID_HOME - echo $ANDROID_SDK_ROOT - - # Check emulator binary - echo "Emulator binary:" - which emulator || echo "Emulator not found in PATH" - emulator -version || echo "Failed to get emulator version" - - echo "=== AVD Check Complete ===" - - - name: ๐Ÿฆพ Enable KVM - run: | - echo "=== KVM Setup and Verification ===" - - # Check if KVM device exists - if [ -e /dev/kvm ]; then - echo "โœ… KVM device found at /dev/kvm" - - # Check current permissions - echo "Current KVM permissions:" - ls -la /dev/kvm - - # Set proper permissions - sudo chmod 666 /dev/kvm || echo "โš ๏ธ Failed to set KVM permissions" - - # Verify permissions were set - if [ -r /dev/kvm ] && [ -w /dev/kvm ]; then - echo "โœ… KVM is readable and writable" - else - echo "โš ๏ธ KVM permissions may not be optimal" - fi - - # Test KVM functionality - echo "Testing KVM functionality..." - if command -v kvm-ok >/dev/null 2>&1; then - if kvm-ok 2>/dev/null; then - echo "โœ… KVM is working properly" - else - echo "โš ๏ธ KVM check failed, but continuing..." - fi - else - echo "โ„น๏ธ kvm-ok command not available, testing manually..." - # Manual KVM test - if [ -r /dev/kvm ] && [ -w /dev/kvm ]; then - echo "โœ… KVM device is accessible" - fi - fi - - # Try to create udev rules (may fail in container, that's OK) - echo "Setting up udev rules..." - sudo mkdir -p /etc/udev/rules.d || echo "โš ๏ธ Could not create udev directory" - echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules || echo "โš ๏ธ Could not create udev rule" - - # Try to reload udev rules (will likely fail in container, that's OK) - sudo udevadm control --reload-rules || echo "โ„น๏ธ udevadm control failed (expected in container)" - sudo udevadm trigger --name-match=kvm || echo "โ„น๏ธ udevadm trigger failed (expected in container)" - - else - echo "โŒ KVM device not found at /dev/kvm" - echo "This will cause the emulator to run in software mode (slower)" - fi - - # Check system resources - echo "=== System Resources ===" - echo "Memory:" - free -h - echo "Disk space:" - df -h - echo "CPU cores:" - nproc - echo "KVM module loaded:" - lsmod | grep kvm || echo "KVM module not loaded (may be built-in)" - - echo "=== KVM Setup Complete ===" - - - name: ๐Ÿฆพ Cache gradle - uses: gradle/actions/setup-gradle@v3 - - - name: ๐Ÿฆพ Cache AVD - uses: actions/cache@v4 - id: avd-cache - with: - path: | - ~/.android/avd/* - ~/.android/adb* - key: avd-${{ matrix.api-level }} - - - name: ๐Ÿ”ง Prepare emulator utilities - run: | - # Create a helper script for emulator readiness checks - cat > /tmp/emulator_ready.sh << 'EOF' - #!/bin/bash - - echo "=== Emulator Readiness Check ===" - - # Wait for boot completion - echo "1. Checking boot completion..." - timeout 300 bash -c 'until adb shell getprop sys.boot_completed 2>/dev/null | grep -q "1"; do sleep 5; echo " Waiting for boot completion..."; done' - if [ $? -eq 0 ]; then - echo "โœ… Boot completed" - else - echo "โŒ Boot completion timeout" - echo "โš ๏ธ Continuing anyway..." - fi - - # Wait for input service - echo "2. Checking input service..." - timeout 60 bash -c 'until adb shell service list 2>/dev/null | grep -q "input"; do sleep 2; echo " Waiting for input service..."; done' - if [ $? -eq 0 ]; then - echo "โœ… Input service ready" - else - echo "โŒ Input service timeout" - echo "โš ๏ธ Continuing anyway..." - fi - - # Wait for package manager - echo "3. Checking package manager..." - timeout 60 bash -c 'until adb shell pm list packages 2>/dev/null >/dev/null; do sleep 2; echo " Waiting for package manager..."; done' - if [ $? -eq 0 ]; then - echo "โœ… Package manager ready" - else - echo "โŒ Package manager timeout" - echo "โš ๏ธ Continuing anyway..." - fi - - # Wait for settings service - echo "4. Checking settings service..." - timeout 60 bash -c 'until adb shell settings get global window_animation_scale 2>/dev/null >/dev/null; do sleep 2; echo " Waiting for settings service..."; done' - if [ $? -eq 0 ]; then - echo "โœ… Settings service ready" - else - echo "โŒ Settings service timeout" - echo "โš ๏ธ Continuing anyway..." - fi - - echo "โœ… Emulator readiness check completed" - EOF - - chmod +x /tmp/emulator_ready.sh - - - name: ๐Ÿฆพ Create AVD and generate snapshot for caching - if: steps.avd-cache.outputs.cache-hit != 'true' - uses: reactivecircus/android-emulator-runner@v2 - with: - api-level: ${{ matrix.api-level }} - force-avd-creation: false - # arch: ${{ matrix.arch }} - emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -read-only -memory 1024 -no-snapshot-save - working-directory: ${{ github.workspace }} - disable-animations: false - script: | - echo "=== AVD Snapshot Generation ===" - - # Use the helper script to ensure emulator is fully ready - /tmp/emulator_ready.sh - - # Manually disable animations with error handling - echo "Disabling animations manually..." - adb shell settings put global window_animation_scale 0.0 || echo "Failed to disable window animations" - adb shell settings put global transition_animation_scale 0.0 || echo "Failed to disable transition animations" - adb shell settings put global animator_duration_scale 0.0 || echo "Failed to disable animator duration" - - echo "=== Checking emulator status before termination ===" - adb devices || echo "ADB devices check failed" - echo "=== AVD snapshot generation complete ===" - - - name: ๐Ÿš€ Integration tests on Android Emulator - timeout-minutes: 60 - uses: reactivecircus/android-emulator-runner@v2 - with: - api-level: ${{ matrix.api-level }} - force-avd-creation: false - emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -read-only -memory 1024 -no-snapshot-save - disable-animations: false - working-directory: ${{ github.workspace }} - script: | - echo "=== Pre-test Environment Check ===" - pwd - ls -la integration_test_runner.sh || echo "integration_test_runner.sh not found" - - echo "=== Emulator Status Check ===" - adb devices - - echo "=== Emulator Info ===" - adb shell getprop ro.build.version.release || echo "Failed to get Android version" - adb shell getprop ro.product.model || echo "Failed to get device model" - - echo "=== Checking Emulator Performance ===" - adb shell cat /proc/cpuinfo | grep -i "model name" | head -1 || echo "Could not check CPU info" - adb shell cat /proc/meminfo | grep -i "memtotal" || echo "Could not check memory info" - - echo "=== Checking Emulator Process ===" - ps aux | grep emulator | grep -v grep || echo "Emulator process not found in ps output" - - echo "=== Making script executable ===" - chmod a+rx integration_test_runner.sh - - echo "=== Running integration tests ===" - - echo "Final emulator readiness check..." - /tmp/emulator_ready.sh || echo "Emulator readiness check failed, but continuing..." - - echo "Disabling animations for test performance..." - adb shell settings put global window_animation_scale 0.0 || echo "Failed to disable window animations" - adb shell settings put global transition_animation_scale 0.0 || echo "Failed to disable transition animations" - adb shell settings put global animator_duration_scale 0.0 || echo "Failed to disable animator duration" - - echo "Starting integration test runner..." - ./integration_test_runner.sh - TEST_EXIT_CODE=$? - - if [ $TEST_EXIT_CODE -eq 0 ]; then - echo "Integration tests completed successfully" - else - echo "Integration tests failed with exit code $TEST_EXIT_CODE" - fi - - - name: ๐Ÿงน Post-test cleanup - if: always() - run: | - echo "=== Post-test cleanup ===" - # Kill any remaining emulator processes - pkill -f emulator || echo "No emulator processes to kill" - # Kill any remaining adb processes - pkill -f adb || echo "No adb processes to kill" - # Wait for processes to terminate - sleep 2 - # Check for any remaining processes - ps aux | grep -E "(emulator|adb)" | grep -v grep || echo "No remaining emulator/adb processes" - echo "=== Cleanup complete ===" - - name: cleanup - run: rm -rf build/app/outputs/flutter-apk/test-apk/ diff --git a/.github/workflows/no_http_imports.yaml b/.github/workflows/no_http_imports.yaml deleted file mode 100644 index dad6821a..00000000 --- a/.github/workflows/no_http_imports.yaml +++ /dev/null @@ -1,21 +0,0 @@ -name: No http imports - -on: [pull_request] - -jobs: - PR_test_build: - runs-on: ubuntu-24.04 - - steps: - - uses: actions/checkout@v4 - - name: Check for http package usage - if: github.event_name == 'pull_request' - run: | - GIT_GREP_OUT="$(git grep package:http | (grep .dart: || test $? = 1) | (grep -v proxy_wrapper.dart || test $? = 1) | (grep -v very_insecure_http_do_not_use || test $? = 1) || true)" - [[ "x$GIT_GREP_OUT" == "x" ]] && exit 0 - echo "$GIT_GREP_OUT" - echo "There are .dart files which use http imports" - echo "Using http package breaks proxy integration" - echo "Please use ProxyWrapper.getHttpClient() from package:cw_core/utils/proxy_wrapper.dart" - exit 1 - \ No newline at end of file diff --git a/.github/workflows/no_print_in_dart.yaml b/.github/workflows/no_print_in_dart.yaml deleted file mode 100644 index 507793bd..00000000 --- a/.github/workflows/no_print_in_dart.yaml +++ /dev/null @@ -1,19 +0,0 @@ -name: No print statements in dart files - -on: [pull_request] - -jobs: - PR_test_build: - runs-on: ubuntu-24.04 - - steps: - - uses: actions/checkout@v4 - - name: Check for print() statements in dart code (use printV() instead) - if: github.event_name == 'pull_request' - run: | - GIT_GREP_OUT="$(git grep ' print(' | (grep .dart: || test $? = 1) | (grep -v print_verbose.dart || test $? = 1) | (grep -v print_verbose_dummy.dart || test $? = 1) || true)" - [[ "x$GIT_GREP_OUT" == "x" ]] && exit 0 - echo "$GIT_GREP_OUT" - echo "There are .dart files which use print() statements" - echo "Please use printV from package:cw_core/utils/print_verbose.dart" - exit 1 diff --git a/.github/workflows/no_restricted_imports.yaml b/.github/workflows/no_restricted_imports.yaml deleted file mode 100644 index 18b228dc..00000000 --- a/.github/workflows/no_restricted_imports.yaml +++ /dev/null @@ -1,49 +0,0 @@ -name: No restricted imports in lib directory - -on: [pull_request] - -jobs: - check_restricted_imports: - runs-on: ubuntu-24.04 - - steps: - - uses: actions/checkout@v4 - - name: Check for restricted imports in lib directory - if: github.event_name == 'pull_request' - run: | - RESTRICTED_PACKAGES=( - "cw_bitcoin" - "cw_bitcoin_cash" - "cw_ethereum" - "cw_evm" - "cw_haven" - "cw_mweb" - "cw_nano" - "cw_polygon" - "cw_base" - "cw_arbitrum" - "cw_solana" - "cw_tron" - "cw_wownero" - "cw_zano" - ) - - FOUND_RESTRICTED=false - - for package in "${RESTRICTED_PACKAGES[@]}"; do - GREP_RESULT=$(find lib -type f -name "*.dart" -exec grep -l "import.*package:$package" {} \; || true) - - if [ -n "$GREP_RESULT" ]; then - echo "Found restricted import of '$package' in the following files:" - echo "$GREP_RESULT" - FOUND_RESTRICTED=true - fi - done - - if [ "$FOUND_RESTRICTED" = true ]; then - echo "Error: Restricted package imports found in lib/ directory" - echo "Please remove these imports as they are not allowed in the lib/ directory" - exit 1 - else - echo "No restricted imports found. All good!" - fi \ No newline at end of file diff --git a/.github/workflows/pr_test_build_android.yml b/.github/workflows/pr_test_build_android.yml deleted file mode 100644 index a7b1a901..00000000 --- a/.github/workflows/pr_test_build_android.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Cake Wallet Android - -on: - pull_request: - -permissions: - contents: read - packages: write - -jobs: - # ----------------------------------------- - # PATH A: Internal PRs - internal-build: - if: > - github.event_name == 'pull_request' && - github.event.pull_request.head.repo.fork == false - uses: ./.github/workflows/reusable-build.yml - with: - ref: ${{ github.event.pull_request.head.sha }} - pr_number: ${{ github.head_ref || github.ref_name }} - secrets: inherit - -# # ----------------------------------------- -# # PATH B: External Fork PRs -# external-build: -# if: > -# github.event_name == 'pull_request_target' && -# github.event.pull_request.head.repo.fork == true -# environment: external_contributors -# uses: ./.github/workflows/reusable-build.yml -# with: -# ref: ${{ github.event.pull_request.head.sha }} -# pr_number: ${{ github.head_ref || github.ref_name }} -# secrets: inherit diff --git a/.github/workflows/pr_test_build_linux.yml b/.github/workflows/pr_test_build_linux.yml deleted file mode 100644 index 36fb28a2..00000000 --- a/.github/workflows/pr_test_build_linux.yml +++ /dev/null @@ -1,251 +0,0 @@ -name: Cake Wallet Linux - -on: [pull_request] - -defaults: - run: - shell: bash -jobs: - PR_test_build: - runs-on: [Linux, amd64, forlinux] - container: - image: ghcr.io/cake-tech/cake_wallet:debian13-flutter3.32.0-ndkr28-go1.24.1-ruststablenightly - env: - STORE_PASS: test@cake_wallet - KEY_PASS: test@cake_wallet - MONEROC_CACHE_DIR_ROOT: /opt/generic_cache - BRANCH_NAME: ${{ github.head_ref || github.ref_name }} - DESKTOP_FORCE_MOBILE: Y - volumes: - - /opt/cw_cache_linux/root/.cache:/root/.cache - - /opt/cw_cache_linux/root/.ccache:/root/.ccache - - /opt/cw_cache_linux/root/.pub-cache/:/root/.pub-cache - - /opt/cw_cache_linux/root/go/pkg:/root/go/pkg - - /opt/cw_cache_linux/opt/generic_cache:/opt/generic_cache - - steps: - - name: Fix github actions messing up $HOME... - run: "echo HOME=/root | sudo tee -a $GITHUB_ENV" - - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.sha }} - repository: ${{ github.event.pull_request.head.repo.full_name }} - - name: configure git - run: | - git config --global --add safe.directory '*' - git config --global user.email "ci@cakewallet.com" - git config --global user.name "CakeWallet CI" - - name: Get the full commit message - run: | - FULL_MESSAGE="$(git log -1 --pretty=%B)" - echo "message<> $GITHUB_ENV - echo "$FULL_MESSAGE" >> $GITHUB_ENV - echo "EOF" >> $GITHUB_ENV - - - name: Add secrets - run: | - touch cw_bitcoin/lib/.secrets.g.dart - touch cw_evm/lib/.secrets.g.dart - touch cw_solana/lib/.secrets.g.dart - touch cw_core/lib/.secrets.g.dart - touch cw_nano/lib/.secrets.g.dart - touch cw_tron/lib/.secrets.g.dart - - echo "const polygonScanApiKey = '${{ secrets.POLYGON_SCAN_API_KEY }}';" >> cw_evm/lib/.secrets.g.dart - echo "const etherScanApiKey = '${{ secrets.ETHER_SCAN_API_KEY }}';" >> cw_evm/lib/.secrets.g.dart - echo "const moralisApiKey = '${{ secrets.MORALIS_API_KEY }}';" >> cw_evm/lib/.secrets.g.dart - echo "const blinkApiKey = '${{ secrets.BLINK_API_KEY }}';" >> cw_evm/lib/.secrets.g.dart - echo "const nowNodesApiKey = '${{ secrets.EVM_NOWNODES_API_KEY }}';" >> cw_evm/lib/.secrets.g.dart - echo "const ankrApiKey = '${{ secrets.ANKR_API_KEY }}';" >> cw_solana/lib/.secrets.g.dart - echo "const chainStackApiKey = '${{ secrets.CHAIN_STACK_API_KEY }}';" >> cw_solana/lib/.secrets.g.dart - echo "const moralisApiKey = '${{ secrets.MORALIS_API_KEY }}';" >> cw_solana/lib/.secrets.g.dart - - echo "const nano2ApiKey = '${{ secrets.NANO2_API_KEY }}';" >> cw_nano/lib/.secrets.g.dart - echo "const nanoNowNodesApiKey = '${{ secrets.NANO_NOW_NODES_API_KEY }}';" >> cw_nano/lib/.secrets.g.dart - - echo "const tronGridApiKey = '${{ secrets.TRON_GRID_API_KEY }}';" >> cw_tron/lib/.secrets.g.dart - echo "const tronNowNodesApiKey = '${{ secrets.TRON_NOW_NODES_API_KEY }}';" >> cw_tron/lib/.secrets.g.dart - - echo "const breezApiKey = '${{ secrets.BREEZ_API_KEY }}';" >> cw_bitcoin/lib/.secrets.g.dart - - echo "${{ secrets.MAIN_SECRETS_FILE }}" | base64 --decode > lib/.secrets.g.dart - - - name: Fetch prebuilt Torch - run: | - set -x -e - pushd scripts - wget https://github.com/MrCyjaneK/torch_dart/releases/download/v1.0.17/torch_dart-v1.0.17.tar.gz -O torch_dart.tar.gz - mkdir torch_dart - pushd torch_dart - tar -xzf ../torch_dart.tar.gz - popd - rm ./torch_dart.tar.gz - popd - - - name: Fetch prebuilt Reown - run: | - set -x -e - pushd scripts - # cleaning - rm -rf reown_flutter - rm -f reown_flutter.tar.gz - wget https://github.com/cake-tech/reown_flutter/releases/download/v0.0.4/reown_flutter-v0.0.4.tar.gz -O reown_flutter.tar.gz - mkdir reown_flutter - pushd reown_flutter - tar -xzf ../reown_flutter.tar.gz - popd - rm ./reown_flutter.tar.gz - popd - - - name: Build Zcash Lib - run: | - set -x -e - pushd scripts/linux - ./build_zcash.sh - popd - - - name: Build Bitbox Flutter - run: | - set -x -e - pushd scripts - ./build_bitbox_flutter.sh - popd - - - name: Build monero_c - run: | - ./scripts/prepare_moneroc.sh - mkdir -p scripts/monero_c/release - pushd scripts/monero_c/release - mkdir -p $(git describe --tags) - pushd $(git describe --tags) - wget https://github.com/MrCyjaneK/monero_c/releases/download/v0.18.4.6-RC1/release-bundle.zip - unzip release-bundle.zip - rm release-bundle.zip - popd - popd - - - name: Execute Build and Setup Commands - run: | - pushd scripts/linux - source ./app_env.sh cakewallet - ./app_config.sh - popd - - - name: Install Flutter dependencies - run: | - flutter pub get - - - name: Build mwebd - run: | - set -x -e - export MWEBD_HASH=$(cat scripts/android/build_mwebd.sh | grep 'git reset --hard' | xargs | awk '{ print $4 }') - echo MWEBD_HASH=$MWEBD_HASH >> /etc/environment - pushd scripts/android - ./build_mwebd.sh - popd - - - name: Build generated code - run: | - ./model_generator.sh async - - - name: Generate localization - run: | - dart run tool/generate_localization.dart - - name: Workaround zcash - run: | - mkdir -p scripts/zcash_lib/assets/ - touch scripts/zcash_lib/assets/sapling-spend.params - touch scripts/zcash_lib/assets/sapling-output.params - - name: Build linux - run: | - flutter build linux --dart-define=hasDevOptions=true --release - - - name: Compress release - run: | - pushd build/linux/x64/release - zip -r cakewallet_linux.zip bundle - popd - - - name: Upload Artifact to github - uses: actions/upload-artifact@v4 - with: - path: ${{ github.workspace }}/build/linux/x64/release/cakewallet_linux.zip - name: cakewallet_linux - - name: Verify lint - run: | - exec env ABORT_ON_CHANGE=true ./scripts/lint.sh - - - name: Prepare virtual desktop - if: ${{ contains(env.message, 'run tests') }} - run: | - nohup Xvfb :99 -screen 0 720x1280x16 & - echo DISPLAY=:99 | sudo tee -a $GITHUB_ENV - dbus-daemon --system --fork - nohup NetworkManager & - nohup ffmpeg -framerate 60 -video_size 720x1280 -f x11grab -i :99 -c:v libx264 -c:a aac /opt/screen_grab.mkv & - - # Note for people adding tests: - # - Tests are ran on Linux, with some things being mocked out. - # - Screen recording is being provided for the entire length of the test, you can download it in github articats. - # - Screen recordeding is encrypted, look at step "Stop screen recording, encrypt and upload", and add your key if you want - # Reason for encryption is the fact that we restore the wallet from seed, and we don't want to leak that, while there - # isn't much in those wallets anyway, we still wouldn't like to leak it to anyone who is able to access github. - - - name: Test [confirm_seeds_flow_test] - if: ${{ contains(env.message, 'run tests') }} - timeout-minutes: 20 - run: | - xmessage -timeout 30 "confirm_seeds_flow_test" & - rm -rf ~/.local/share/com.example.cake_wallet/ ~/Documents/cake_wallet/ ~/cake_wallet - exec timeout --signal=SIGKILL 900 flutter drive --driver=test_driver/integration_test.dart --target=integration_test/test_suites/confirm_seeds_flow_test.dart - - name: Test [create_wallet_flow_test] - if: ${{ contains(env.message, 'run tests') }} - timeout-minutes: 20 - run: | - xmessage -timeout 30 "create_wallet_flow_test" & - rm -rf ~/.local/share/com.example.cake_wallet/ ~/Documents/cake_wallet/ ~/cake_wallet - exec timeout --signal=SIGKILL 900 flutter drive --driver=test_driver/integration_test.dart --target=integration_test/test_suites/create_wallet_flow_test.dart - # - name: Test [exchange_flow_test] - # if: ${{ contains(env.message, 'run tests') }} - # timeout-minutes: 20 - # run: | - # xmessage -timeout 30 "exchange_flow_test" & - # rm -rf ~/.local/share/com.example.cake_wallet/ ~/Documents/cake_wallet/ ~/cake_wallet - # exec timeout --signal=SIGKILL 900 flutter drive --driver=test_driver/integration_test.dart --target=integration_test/test_suites/exchange_flow_test.dart - - name: Test [restore_wallet_through_seeds_flow_test] - if: ${{ contains(env.message, 'run tests') }} - timeout-minutes: 20 - run: | - xmessage -timeout 30 "restore_wallet_through_seeds_flow_test" & - rm -rf ~/.local/share/com.example.cake_wallet/ ~/Documents/cake_wallet/ ~/cake_wallet - exec timeout --signal=SIGKILL 900 flutter drive --driver=test_driver/integration_test.dart --target=integration_test/test_suites/restore_wallet_through_seeds_flow_test.dart - - name: Test [cw_monero] - timeout-minutes: 15 - run: cd cw_monero && flutter test - - name: Stop screen recording, encrypt and upload - if: always() - run: | - if [[ ! -f "/opt/screen_grab.mkv" ]]; - then - exit 0; - fi - killall ffmpeg - sleep 5 - killall -9 ffmpeg || true - sleep 5 - # Feel free to add your own public key if you wish - gpg --keyserver hkps://keyserver.ubuntu.com --recv-keys 6B3199AD9B3D23B8 # konstantin@cakewallet.com - gpg --keyserver hkps://keyserver.ubuntu.com --recv-keys 35C8DBAFB8D9ACAC # cyjan@mrcyjanek.net - gpg --trust-model always --encrypt --output /opt/screen_grab.mkv.gpg \ - --recipient 6B3199AD9B3D23B8 \ - --recipient 35C8DBAFB8D9ACAC \ - /opt/screen_grab.mkv - rm /opt/screen_grab.mkv - mv /opt/screen_grab.mkv.gpg ./screen_grab.mkv.gpg - - name: Upload Artifact to github - if: always() - continue-on-error: true - uses: actions/upload-artifact@v4 - with: - path: ${{ github.workspace }}/screen_grab.mkv.gpg - name: tests_screen_grab diff --git a/.github/workflows/reusable-build.yml b/.github/workflows/reusable-build.yml deleted file mode 100644 index acc209e4..00000000 --- a/.github/workflows/reusable-build.yml +++ /dev/null @@ -1,217 +0,0 @@ -name: Reusable Build Logic - -permissions: - contents: read - packages: write - -on: - workflow_call: - inputs: - ref: - required: true - type: string - pr_number: - required: true - type: string - -defaults: - run: - shell: bash -jobs: - PR_test_build: - runs-on: [Linux, amd64, android] - container: - image: ghcr.io/cake-tech/cake_wallet:debian13-flutter3.32.0-ndkr28-go1.24.1-ruststablenightly - env: - STORE_PASS: test@cake_wallet - KEY_PASS: test@cake_wallet - MONEROC_CACHE_DIR_ROOT: /opt/generic_cache - BRANCH_NAME: ${{ github.head_ref || github.ref_name }} - ANDROID_AVD_HOME: /root/.android/avd - volumes: - - /opt/cw_cache_android/root/.cache:/root/.cache - - /opt/cw_cache_android/root/.android/avd/:/root/.android/avd - - /opt/cw_cache_android/root/.ccache:/root/.ccache - - /opt/cw_cache_android/root/.pub-cache/:/root/.pub-cache - - /opt/cw_cache_android/root/.gradle/:/root/.gradle - - /opt/cw_cache_android/root/.android/:/root/.android - - /opt/cw_cache_android/root/go/pkg:/root/go/pkg - - /opt/cw_cache_android/opt/generic_cache:/opt/generic_cache - - /dev/kvm:/dev/kvm - - /var/run/docker.sock:/var/run/docker.sock - strategy: - matrix: - api-level: [29] - - steps: - - name: Fix github actions messing up $HOME... - run: "echo HOME=/root | sudo tee -a $GITHUB_ENV" - - uses: actions/checkout@v4 - with: - ref: ${{ inputs.ref }} - - - name: Log in to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Get the full commit message - run: | - FULL_MESSAGE="$(git log -1 --pretty=%B)" - echo "message<> $GITHUB_ENV - echo "$FULL_MESSAGE" >> $GITHUB_ENV - echo "EOF" >> $GITHUB_ENV - - - name: Add secrets - run: | - touch cw_bitcoin/lib/.secrets.g.dart - touch cw_evm/lib/.secrets.g.dart - touch cw_solana/lib/.secrets.g.dart - touch cw_core/lib/.secrets.g.dart - touch cw_nano/lib/.secrets.g.dart - touch cw_tron/lib/.secrets.g.dart - - echo "const polygonScanApiKey = '${{ secrets.POLYGON_SCAN_API_KEY }}';" >> cw_evm/lib/.secrets.g.dart - echo "const etherScanApiKey = '${{ secrets.ETHER_SCAN_API_KEY }}';" >> cw_evm/lib/.secrets.g.dart - echo "const moralisApiKey = '${{ secrets.MORALIS_API_KEY }}';" >> cw_evm/lib/.secrets.g.dart - echo "const nowNodesApiKey = '${{ secrets.EVM_NOWNODES_API_KEY }}';" >> cw_evm/lib/.secrets.g.dart - echo "const blinkApiKey = '${{ secrets.BLINK_API_KEY }}';" >> cw_evm/lib/.secrets.g.dart - echo "const ankrApiKey = '${{ secrets.ANKR_API_KEY }}';" >> cw_solana/lib/.secrets.g.dart - echo "const chainStackApiKey = '${{ secrets.CHAIN_STACK_API_KEY }}';" >> cw_solana/lib/.secrets.g.dart - echo "const moralisApiKey = '${{ secrets.MORALIS_API_KEY }}';" >> cw_solana/lib/.secrets.g.dart - - echo "const nano2ApiKey = '${{ secrets.NANO2_API_KEY }}';" >> cw_nano/lib/.secrets.g.dart - echo "const nanoNowNodesApiKey = '${{ secrets.NANO_NOW_NODES_API_KEY }}';" >> cw_nano/lib/.secrets.g.dart - - echo "const tronGridApiKey = '${{ secrets.TRON_GRID_API_KEY }}';" >> cw_tron/lib/.secrets.g.dart - echo "const tronNowNodesApiKey = '${{ secrets.TRON_NOW_NODES_API_KEY }}';" >> cw_tron/lib/.secrets.g.dart - - echo "const breezApiKey = '${{ secrets.BREEZ_API_KEY }}';" >> cw_bitcoin/lib/.secrets.g.dart - - echo "${{ secrets.MAIN_SECRETS_FILE }}" | base64 --decode > lib/.secrets.g.dart - - - name: Generate KeyStore - run: | - pushd /opt/generic_cache - if [[ ! -f key.jks ]]; - then - keytool -genkey -v -keystore key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias testKey -noprompt -dname "CN=CakeWallet, OU=CakeWallet, O=CakeWallet, L=Florida, S=America, C=USA" -storepass $STORE_PASS -keypass $KEY_PASS - else - echo "$PWD/key.jks exist, not generating" - fi - popd - cp /opt/generic_cache/key.jks android/app - - - name: Build dependencies utilizing ghcr cache - run: | - env \ - CW_DOCKER_REGISTRY=ghcr.io/cake-tech/cake_wallet \ - CW_DOCKER_USE_CLOUD=true \ - ./scripts/android/docker/build.sh - - - name: Execute Build and Setup Commands - run: | - pushd scripts/android - source ./app_env.sh cakewallet - ./app_config.sh - popd - - - name: Install Flutter dependencies - run: | - flutter pub get - - - name: Build generated code - run: | - flutter --version - flutter clean - rm -rf .dart_tool - rm pubspec.lock - flutter pub get - ./model_generator.sh async - - - name: Generate key properties - run: | - dart run tool/generate_android_key_properties.dart keyAlias=testKey storeFile=key.jks storePassword=$STORE_PASS keyPassword=$KEY_PASS - - - name: Generate localization - run: | - dart run tool/generate_localization.dart - - - name: Compile graphics - run: | - ./compile_graphics.sh - - - name: Rename app - run: | - sanitized_branch_name=${BRANCH_NAME#origin/} # Remove 'origin/' prefix if it exists - sanitized_branch_name=${sanitized_branch_name:0:16} # Take only the first 16 characters - sanitized_branch_name=$(echo "$sanitized_branch_name" | tr '[:upper:]' '[:lower:]') # Convert to lowercase - sanitized_branch_name=$(echo "$sanitized_branch_name" | sed 's/[^a-z0-9]//g') # Remove all special characters - - echo -e "id=com.cakewallet.test_${sanitized_branch_name}\nname=${BRANCH_NAME}" > android/app.properties - - - name: Replace email address - run: | - PATTERN1="support@cakewallet.com" - PATTERN1REP="dev.testflight.cakewallet@mrcyjanek.net" - echo lib/utils/exception_handler.dart \ - lib/view_model/support_view_model.dart \ - | while IFS= read -r -d '' file; do - sed -i.bak \ - -e "s|$PATTERN1|$PATTERN1REP|g" \ - "$file" - done - - - name: Build - run: | - export ANDROID_NDK_HOME="$ANDROID_SDK_ROOT/ndk/$ANDROID_NDK_VERSION" - export ANDROID_NDK="$ANDROID_NDK_HOME" - pushd $ANDROID_SDK_ROOT/ndk - ln -s 28.2.13676358 25.1.8937393 - popd - flutter build apk --dart-define=hasDevOptions=true --release --split-per-abi - - - name: Rename apk file - run: | - cd build/app/outputs/flutter-apk - mkdir test-apk - cp app-arm64-v8a-release.apk test-apk/${BRANCH_NAME}.apk - cp app-x86_64-release.apk test-apk/${BRANCH_NAME}_x86.apk - - - name: Find APK file - id: find_apk - run: | - set -x - apk_file=$(ls build/app/outputs/flutter-apk/test-apk/${BRANCH_NAME}.apk || exit 1) - echo "APK_FILE=$apk_file" >> $GITHUB_ENV - - name: Write BRANCH_NAME to env - run: echo "BRANCH_NAME=${BRANCH_NAME}" >> $GITHUB_ENV - - - name: Upload to slack step - uses: vaporif/slack-file-upload-action@v1 - with: - token: ${{ secrets.SLACK_APP_TOKEN }} - initial_comment: ${{ env.message }} - files: > - [ - {"file": "${{ env.APK_FILE }}", "filename": "${{ env.BRANCH_NAME }}.apk"} - ] - channel_id: ${{ secrets.SLACK_APK_CHANNEL }} - - - name: cleanup - run: rm -rf build/app/outputs/flutter-apk/test-apk/ - - - name: Upload Artifact to github - uses: actions/upload-artifact@v4 - with: - path: ${{ github.workspace }}/build/app/outputs/flutter-apk - name: "android apk" - - - name: 16KB align - run: | - cd build/app/outputs/flutter-apk - for i in arm64-v8a x86_64; do - ../../../../scripts/android/check_16kb_align.sh app-$i-release.apk - done