Files
hash-wallet/.github/workflows/test.yml
T
jwinterm d19e52d308 ci(test): generate models and localization before analyzing
generated/i18n.dart and several .g.dart parts are untracked generation
outputs too; without them a fresh checkout analyzes with thousands of
undefined_identifier errors. Run model_generator.sh and
generate_localization exactly as the build lanes do.
2026-08-21 05:25:36 -04:00

96 lines
3.2 KiB
YAML

name: Tests and analysis
# Fast, pure-Dart verification: no native builds, no signing secrets.
# Runs on every push and PR (unlike the manual-dispatch build workflows,
# this finishes in minutes and needs nothing beyond pub get).
on:
push:
branches: [dev, main]
pull_request:
branches: [dev, main]
workflow_dispatch:
concurrency:
group: test-${{ github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash
jobs:
test:
runs-on: ubuntu-latest
container:
# Same prebuilt image as the build workflows (bundles Flutter 3.32.0).
image: ghcr.io/cake-tech/cake_wallet:debian13-flutter3.32.0-ndkr28-go1.24.1-ruststablenightly
steps:
- name: Fix Actions HOME (writeable for ~/.cache)
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 '*'
# pubspec.yaml has path deps under scripts/ that must exist before
# pub get; fetch the same prebuilt bundles the build workflows use.
- 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
run: |
set -x -e
pushd scripts
./build_bitbox_flutter.sh
popd
# pubspec.yaml, the cw_* wiring in it, wallet_types.g.dart, and the
# .secrets.g.dart files are all GENERATED and untracked; a bare
# `flutter pub get` on a fresh checkout can never succeed. Mirror the
# build lanes' generation sequence (empty secrets are fine for tests).
- name: Generate workspace (pubspec, coin modules, empty secrets)
run: |
set -x -e
cp pubspec_description.yaml pubspec.yaml
flutter pub get
dart run tool/generate_pubspec.dart
flutter pub get
dart run tool/configure.dart --monero --bitcoin --ethereum --polygon --nano --bitcoinCash --wownero --dogecoin --base --arbitrum --bsc
flutter pub get
dart run tool/generate_new_secrets.dart
- name: Generate models and localization
run: |
set -e
bash model_generator.sh
dart run tool/generate_localization.dart
- name: flutter analyze (errors are fatal, existing warnings are not)
run: flutter analyze lib --no-fatal-infos --no-fatal-warnings
- name: flutter test
run: flutter test