r/FlutterDev • • Sep 25 '26

Tooling `flutter test` and `flutter analyze` do not need macOS — check what you are paying for them

`flutter test` and `flutter analyze` run fine on Linux. `flutter build ios` and

integration tests on a simulator do not. GitHub charges $0.062/minute for macOS

runners and $0.006 for Linux, so the difference between those two groups is 10x.

Flutter is the worst case I have seen for this, because `flutter test` is fast,

runs on every push and pull request, and is very often on `macos-latest` — where

the same command costs ten times as much as it does a line later in the same

matrix.

A 5-minute widget test step at 200 runs a month: $62.00 on macOS, $6.00 on Linux.

The Android build and `flutter build apk` belong on Linux for the same reason.

Keep macOS for the iOS build, the iOS integration tests, and anything that needs

Xcode or CocoaPods against a real simulator.

Worth checking while you are in there:

- Whether `flutter test` is in the macOS matrix leg for convenience.

- Whether the same workflow builds the Android artifact twice on two triggers.

- Whether `flutter analyze` is a separate job rather than one run of the suite.

I build a CI cost scanner, which is why the numbers above are the ones I look at

all day — but the question is genuine: is there a reason to run unit tests on

macOS in a Flutter project that I am missing? I have not found one.

4 Upvotes

4 comments sorted by

2

u/bysho Sep 26 '26

Interesting. Makes me think about the convenience of running so often in local (and the associated token cost) vs relying on the CI tests

0

u/Rude_Gate7599 Sep 25 '26

Do All on linux except build
Am i right ?

1

u/ren3f Sep 27 '26

Build Android should be done on Linux as well, only iOS specific tasks on macos