-
Notifications
You must be signed in to change notification settings - Fork 77
136 lines (120 loc) · 5.47 KB
/
Copy pathanalyze_and_test.yml
File metadata and controls
136 lines (120 loc) · 5.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
name: Analyze and Test
on:
pull_request:
branches:
- main
- develop
# Checkout + tests only; no writes to the repo via the token.
permissions:
contents: read
# Cancel superseded runs on the same PR — this build is heavy (Rust FRB crates +
# Flutter SDK + Linux GTK app + integration tests), so don't run stale commits to
# completion when newer ones are pushed.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
analyze_and_test:
runs-on: ubuntu-24.04
steps:
- name: Checkout Repository
uses: actions/checkout@v7
# The job builds the FRB Rust crates, the Flutter SDK toolchain, the
# Linux desktop app and runs integration tests on one runner; the stock
# ubuntu-24.04 image fills up and the runner dies with "No space left on
# device". Reclaim the unused pre-installed toolchains first.
- name: Free disk space
# Pinned to a commit SHA (not the mutable v1.3.1 tag): third-party action
# on a runner that can hold PR test secrets — a retag must not run here.
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1
with:
tool-cache: true
android: true
dotnet: true
haskell: true
large-packages: true
swap-storage: false
# Caches below are restored before any toolchain step that uses
# them, so the SDK download / pub resolve / crate fetch on a cold
# runner only pays out on a cache miss. The pub cache also holds the
# bull_sdk git clone; the Cargo cache holds its transitive crates.io
# deps. All three keys derive from lockfiles, so they self-invalidate
# when deps change. pubspec.lock pins the bull_sdk commit, so it is
# the right key for the Cargo cache (there is no repo-root Cargo.lock).
- name: Cache Flutter SDK (FVM)
uses: actions/cache@v6
with:
path: ~/fvm/versions
key: fvm-${{ runner.os }}-${{ hashFiles('.fvmrc') }}
# No restore-keys here on purpose: the pub cache holds the bull_sdk git
# clone, and a fuzzy fallback can restore a checkout from an OLDER lock
# whose pinned commit differs. pub then resolves against that stale clone,
# so `pub get --enforce-lockfile` sees deps the committed lock doesn't (it
# fails wanting to drop them). The exact key already pins the commit via
# pubspec.lock, so an unchanged lock still hits; a changed lock does one
# clean fetch and re-caches.
- name: Cache pub (hosted + git deps)
uses: actions/cache@v6
with:
path: ~/.pub-cache
key: pub-${{ runner.os }}-${{ hashFiles('pubspec.lock') }}
- name: Cache Cargo (FRB native crates)
uses: actions/cache@v6
with:
path: |
~/.cargo/registry
~/.cargo/git
key: cargo-${{ runner.os }}-${{ hashFiles('pubspec.lock') }}
restore-keys: cargo-${{ runner.os }}-
- name: Install FVM
run: |
curl -fsSL https://fvm.app/install.sh | bash -s -- 4.1.1
echo "$HOME/fvm/bin" >> $GITHUB_PATH
- run: make fvm-check
- run: make deps
- run: make build-runner
- run: make translations
- name: Linter shouldn't raise errors, warnings or infos
run: make analyze
- name: bull_ui import boundary (coins/ui imports only package:bull_ui)
run: |
if grep -rEl "package:flutter/(material|cupertino|widgets)\.dart" lib/features/coins/ui; then
echo "lib/features/coins/ui must import only package:bull_ui/bull_ui.dart, not Flutter UI directly"
exit 1
fi
- name: dart fix should have nothing to suggest
run: |
output=$(fvm dart fix --dry-run)
echo "$output"
echo "$output" | grep -q "Nothing to fix!"
- name: Unit tests must pass
run: make unit-test
- name: Install Linux desktop for integration tests
run: |
sudo apt-get update
sudo apt-get install -y \
clang lld cmake ninja-build pkg-config \
libgtk-3-dev liblzma-dev libstdc++-12-dev \
libsecret-1-dev libsecret-tools libcurl4-openssl-dev \
dbus gnome-keyring \
xdg-desktop-portal xdg-desktop-portal-gtk \
libsqlite3-dev xvfb xauth
# The tests build and launch the real Linux GTK app, which needs a
# display to init even though the tests themselves render nothing —
# on a headless runner the app aborts at startup ("log reader
# stopped unexpectedly / Unable to start the app on the device").
# xvfb-run gives it a virtual X server. dbus-run-session + an
# unlocked gnome-keyring provide the Secret Service flutter_secure_storage needs.
# Tests read the mnemonics via Platform.environment, so the secrets are
# exported as real env vars (not a .env file, which nothing loads). When a
# secret is unset (e.g. on forks) the var is empty and the funded-testnet
# groups skip themselves — "use the mnemonic if available".
- name: Integration tests (Linux desktop)
env:
TEST_ALICE_MNEMONIC: ${{ secrets.ENV_TEST_ALICE_MNEMONIC }}
TEST_BOB_MNEMONIC: ${{ secrets.ENV_TEST_BOB_MNEMONIC }}
run: |
xvfb-run -a dbus-run-session -- bash -c '
echo "" | gnome-keyring-daemon --unlock --daemonize --components=secrets
make integration-test
'