mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-20 06:08:34 +02:00
The 'async' flag in model_generator.sh launches per-module flutter pub get in parallel via 'bash -c ... &'. Flutter has a single-process startup lock for SDK initialization — when N parallel calls race for it, most lose, leaving the SDK cache half-initialized. Subsequent pub gets then fail with the misleading 'doesn't support null safety' error because Flutter can't resolve its own bundled sky_engine. Two fixes: 1. Drop 'async' — model_generator.sh now runs the 8 modules sequentially. Adds maybe 3 minutes per CI run vs parallel, but reliable beats fast. 2. Add explicit 'flutter precache --linux' step before model_generator. The '|| true' absorbs the known flutter_gpu.zip 404 on Flutter 3.32.0 — that asset isn't actually published at the URL Flutter constructs and isn't needed for desktop Linux.
186 lines
7.4 KiB
YAML
186 lines
7.4 KiB
YAML
name: Hash Wallet Linux build
|
|
|
|
# Triggers:
|
|
# - on push to dev/main (validates the foundation each time we land work)
|
|
# - on PRs targeting dev/main (gates merges)
|
|
# - manual via workflow_dispatch ("Run workflow" button in the UI)
|
|
on:
|
|
push:
|
|
branches: [dev, main]
|
|
pull_request:
|
|
branches: [dev, main]
|
|
workflow_dispatch:
|
|
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
|
|
jobs:
|
|
build:
|
|
# Both your Gitea linux-beast runner and GitHub-hosted ubuntu runners
|
|
# carry the `ubuntu-latest` label, so this works on either platform.
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
# Cake Labs' prebuilt build image with Flutter 3.32.0, Go 1.24.1, NDK r28,
|
|
# Rust nightly, and all the C++ build deps (boost, openssl, libsodium,
|
|
# libzmq, unbound, icu) preinstalled. Saves us from doing the simplybs
|
|
# source-bootstrap dance that ate 9GB on jw-laptop.
|
|
image: ghcr.io/cake-tech/cake_wallet:debian13-flutter3.32.0-ndkr28-go1.24.1-ruststablenightly
|
|
env:
|
|
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
|
|
# cake_wallet build profile name, retained from upstream — internal
|
|
# identifier only, doesn't appear in the binary or UI.
|
|
APP_LINUX_TYPE: cakewallet
|
|
|
|
steps:
|
|
- name: Fix Actions HOME pointing at /github/home (breaks ~/.cache writes)
|
|
run: echo "HOME=/root" >> $GITHUB_ENV
|
|
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 1
|
|
|
|
- name: Configure git inside the container
|
|
run: |
|
|
git config --global --add safe.directory '*'
|
|
git config --global user.email "ci@suchsoftware.com"
|
|
git config --global user.name "Hash Wallet CI"
|
|
|
|
# ---- Secrets ---------------------------------------------------------
|
|
# tool/.secrets-config.json is the source-of-truth for lib/.secrets.g.dart
|
|
# generation. Populate from CI secrets. EMPTY for non-Trocador entries
|
|
# because we don't have other affiliate keys yet.
|
|
- name: Inject Trocador + Bitcoin secrets
|
|
env:
|
|
TROCADOR_API_KEY: ${{ secrets.TROCADOR_API_KEY }}
|
|
TROCADOR_MONERO_API_KEY: ${{ secrets.TROCADOR_MONERO_API_KEY }}
|
|
TROCADOR_EXCHANGE_MARKUP: ${{ secrets.TROCADOR_EXCHANGE_MARKUP }}
|
|
run: |
|
|
set -e
|
|
mkdir -p tool
|
|
cat > tool/.secrets-config.json <<JSON
|
|
{
|
|
"trocadorApiKey": "${TROCADOR_API_KEY}",
|
|
"trocadorMoneroApiKey": "${TROCADOR_MONERO_API_KEY}",
|
|
"trocadorExchangeMarkup": "${TROCADOR_EXCHANGE_MARKUP:-1}",
|
|
"fiatApiKey": "",
|
|
"moonPayApiKey": "",
|
|
"anypayToken": "",
|
|
"onramperApiKey": "",
|
|
"robinhoodApplicationId": "",
|
|
"exolixApiKey": "",
|
|
"walletConnectProjectId": "",
|
|
"swapTradeApiKey": "",
|
|
"letsExchangeBearerToken": "",
|
|
"stealthExBearerToken": "",
|
|
"xoSwapApiKey": "",
|
|
"swapsXyzApiKey": "",
|
|
"nearIntentsApiKey": ""
|
|
}
|
|
JSON
|
|
# cw_bitcoin only needs breezApiKey (Lightning, disabled — empty is fine)
|
|
echo '{ "breezApiKey": "" }' > tool/.bitcoin-secrets-config.json
|
|
# Other per-module configs default to empty {} unless we add keys.
|
|
echo '{}' > tool/.evm-secrets-config.json
|
|
echo '{}' > tool/.solana-secrets-config.json
|
|
echo '{}' > tool/.tron-secrets-config.json
|
|
echo '{}' > tool/.nano-secrets-config.json
|
|
|
|
# ---- External clones (use prebuilt tarballs, NOT prepare_*.sh) -------
|
|
# The prepare_torch.sh / prepare_reown.sh scripts do dev-time clones
|
|
# that take forever; CI uses the pre-tagged release tarballs instead.
|
|
- name: Fetch prebuilt torch_dart
|
|
run: |
|
|
set -x -e
|
|
pushd scripts
|
|
rm -rf torch_dart torch_dart.tar.gz
|
|
wget -q 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
|
|
tar -xzf torch_dart.tar.gz -C torch_dart
|
|
rm torch_dart.tar.gz
|
|
popd
|
|
|
|
- name: Fetch prebuilt reown_flutter
|
|
run: |
|
|
set -x -e
|
|
pushd scripts
|
|
rm -rf reown_flutter reown_flutter.tar.gz
|
|
wget -q 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
|
|
tar -xzf reown_flutter.tar.gz -C reown_flutter
|
|
rm reown_flutter.tar.gz
|
|
popd
|
|
|
|
- name: Clone BitBox Flutter (small, builds fast)
|
|
run: |
|
|
set -x -e
|
|
pushd scripts
|
|
./build_bitbox_flutter.sh
|
|
popd
|
|
|
|
# ---- Native crypto cores (monero_c prebuilt bundle) ------------------
|
|
# Skips the full simplybs toolchain bootstrap. The bundle has libmonero,
|
|
# libwownero, AND libzano .so files; CMake only installs the ones we
|
|
# ship (monero + wownero).
|
|
- name: Fetch prebuilt monero_c .so bundle
|
|
run: |
|
|
set -x -e
|
|
./scripts/prepare_moneroc.sh
|
|
MONERO_C_TAG=$(cd scripts/monero_c && git describe --tags)
|
|
echo "monero_c TAG: $MONERO_C_TAG"
|
|
mkdir -p "scripts/monero_c/release/$MONERO_C_TAG"
|
|
pushd "scripts/monero_c/release/$MONERO_C_TAG"
|
|
wget -q https://github.com/MrCyjaneK/monero_c/releases/download/v0.18.4.6-RC1/release-bundle.zip
|
|
unzip -q release-bundle.zip
|
|
rm release-bundle.zip
|
|
ls x86_64-linux-gnu/
|
|
popd
|
|
|
|
# ---- Configure: pubspec.yaml, AndroidManifest.xml, env vars ----------
|
|
- name: Run configure (cakewallet build profile)
|
|
run: |
|
|
pushd scripts/linux
|
|
source ./app_env.sh cakewallet
|
|
./app_config.sh
|
|
popd
|
|
|
|
# ---- Codegen: mobx, hive adapters, FFI bindings ----------------------
|
|
# model_generator.sh is already trimmed to our 8 enabled chains.
|
|
# Use `async` flag for parallel build_runner across modules.
|
|
- name: Generate per-module secrets.g.dart files
|
|
run: dart run tool/generate_new_secrets.dart
|
|
|
|
# Initialize Flutter SDK once before parallel-ish work happens. flutter
|
|
# precache for Flutter 3.32.0 hits a 404 on flutter_gpu.zip (asset not
|
|
# actually published at the path Flutter constructs); the `|| true`
|
|
# absorbs that — desktop Linux build doesn't need flutter_gpu.
|
|
- name: Initialize Flutter SDK
|
|
run: |
|
|
flutter --version
|
|
flutter precache --linux --no-android --no-ios --no-macos --no-windows --no-fuchsia --no-web || true
|
|
|
|
# Sequential — async flag races on Flutter's startup lock and corrupts
|
|
# the SDK state, causing the "doesn't support null safety" cascade.
|
|
- name: Build generated code (mobx + hive adapters)
|
|
run: bash model_generator.sh
|
|
|
|
- name: Generate localization
|
|
run: dart run tool/generate_localization.dart
|
|
|
|
# ---- Compile + package ----------------------------------------------
|
|
- name: Build Linux app
|
|
run: flutter build linux --dart-define-from-file=env.json --release
|
|
|
|
- name: Compress release bundle
|
|
run: |
|
|
pushd build/linux/x64/release
|
|
zip -r hash_wallet_linux_${{ github.sha }}.zip bundle
|
|
popd
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: hash-wallet-linux-${{ github.sha }}
|
|
path: build/linux/x64/release/hash_wallet_linux_*.zip
|
|
retention-days: 14
|