Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .fvmrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"flutter": "3.41.0",
"flutter": "3.47.8",
"flavors": {}
}
31 changes: 10 additions & 21 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,11 @@ env:
# The version the islands are validated against. Multi-view web embedding is
# young enough that the docs bundle pins its own version rather than following
# the range the package supports.
FLUTTER_VERSION: '3.41.4'
# The landing page is plain Dart, and its build tooling (Ciach's pins of
# build_web_compilers and leancode_lint) needs a newer SDK than the one this
# Flutter bundles. Installed after Flutter, so it is the `dart` on PATH;
# `flutter …` commands keep using their own.
DART_VERSION: '3.13.0'
JASPR_CLI_VERSION: '0.23.4'
# Its Dart (3.13) is also the one the landing page builds with, and what
# leancode_lint needs.
FLUTTER_VERSION: '3.47.8'
# The commit of the jaspr overrides in landing/pubspec.yaml.
JASPR_REF: '9311973c7261b4a37ee2cb526466aa6934854851'

# One deployment at a time per ref. A newer push to a pull request supersedes
# the preview in flight; on main every push still deploys, in order.
Expand All @@ -78,13 +76,8 @@ jobs:
flutter-version: ${{ env.FLUTTER_VERSION }}
cache: true

- name: Setup Dart
uses: dart-lang/setup-dart@v1
with:
sdk: ${{ env.DART_VERSION }}

- name: Install the Jaspr CLI
run: dart pub global activate jaspr_cli "$JASPR_CLI_VERSION"
run: dart pub global activate --source git https://github.com/schultek/jaspr --git-path packages/jaspr_cli --git-ref "$JASPR_REF"

- name: Setup Node
uses: actions/setup-node@v4
Expand Down Expand Up @@ -115,8 +108,10 @@ jobs:
run: dart format --output=none --set-exit-if-changed lib/generated lib/support
working-directory: docs_app/flutter

# Not `flutter analyze`: it leaves out the diagnostics of analyzer
# plugins, which is where leancode_lint's own rules come from.
- name: Analyze the example bundle
run: flutter analyze
run: dart analyze --fatal-infos
working-directory: docs_app/flutter

# Puts every example through the constraints a real island imposes.
Expand Down Expand Up @@ -189,15 +184,9 @@ jobs:
flutter-version: ${{ env.FLUTTER_VERSION }}
cache: true

- name: Setup Dart
if: env.VERCEL_TOKEN != ''
uses: dart-lang/setup-dart@v1
with:
sdk: ${{ env.DART_VERSION }}

- name: Install the Jaspr CLI
if: env.VERCEL_TOKEN != ''
run: dart pub global activate jaspr_cli "$JASPR_CLI_VERSION"
run: dart pub global activate --source git https://github.com/schultek/jaspr --git-path packages/jaspr_cli --git-ref "$JASPR_REF"

- name: Setup Node
if: env.VERCEL_TOKEN != ''
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@ jobs:
- name: Setup Dart
uses: dart-lang/setup-dart@v1
with:
sdk: 3.7
sdk: '3.13'

# `flutter pub publish` resolves the dev dependencies too, and
# leancode_lint needs Dart 3.13. Keep in sync with .fvmrc.
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: 3.29.x
flutter-version: '3.47.8'
cache: true

- name: Publish and release
Expand Down
49 changes: 41 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,20 @@ on:

jobs:
test:
name: Flutter ${{ matrix.channel }}${{ matrix.version }}
name: Test and analyze

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- version: '3.29.x'

steps:
- name: Checkout
uses: actions/checkout@v4

# leancode_lint, a dev dependency, needs Dart 3.13. Keep in sync with
# .fvmrc.
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ matrix.version }}
flutter-version: '3.47.8'
cache: true

- name: Flutter version
Expand All @@ -40,8 +37,13 @@ jobs:
- name: Download pub dependencies
run: flutter pub get

# Not `flutter analyze`: it leaves out the diagnostics of analyzer
# plugins, which is where leancode_lint's own rules come from.
- name: Run analyzer
run: flutter analyze
run: dart analyze --fatal-infos

- name: Check formatting
run: dart format --output=none --set-exit-if-changed lib test example/lib example/test

- name: Run tests
run: flutter test
Expand All @@ -54,6 +56,37 @@ jobs:
# We don't want it to fail the CI, it's just to see how would `pub publish` behave.
run: dart pub publish --dry-run || true

floor:
name: Test on Flutter 3.19 (lower bound)

runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

# The lowest Flutter that pubspec.yaml allows.
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.19.6'
cache: true

# Consumers never resolve dev dependencies, so the package itself still
# resolves on this SDK; leancode_lint, which needs Dart 3.13, does not.
- name: Drop leancode_lint
run: sed -i '/^ leancode_lint:/d' pubspec.yaml

# The example app is not part of what consumers get and still depends on
# leancode_lint, so it is left out: `dart pub get --no-example` skips it,
# where `flutter pub get --no-example` and the implicit `pub get` of
# `flutter test` would still touch it.
- name: Download pub dependencies
run: dart pub get --no-example

- name: Run tests
run: flutter test --no-pub

pana-score:
name: pana score

Expand Down
18 changes: 18 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,22 @@ analyzer:
- windows/**
- macos/**
- linux/**
errors:
# The controllers hold callbacks over their value type (validators, value
# setters, builders), so they are invariant in it by design. Satisfying
# the rule would mean changing the public API.
unsafe_variance: ignore

# leancode_lint's own rules run as an analyzer plugin, so they need the Dart 3.13
# SDK that leancode_lint requires. That SDK is only needed to develop the package:
# consumers never resolve dev dependencies, and the `floor` job in
# .github/workflows/test.yml checks that the package still works on the lower
# bound in pubspec.yaml.
plugins:
leancode_lint:
version: ^28.0.0
diagnostics:
cognitive_complexity: true
# Off: dot shorthands need Dart 3.10, and the package supports Dart 3.3.
# The rule does not check the language version.
prefer_dot_shorthand: false
6 changes: 3 additions & 3 deletions docs_app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ this directory:
npm run landing:build && npm run dev
```

Open http://localhost:3000. Node 22, the Flutter SDK and the Dart SDK with the Jaspr CLI
(`dart pub global activate jaspr_cli 0.23.4`) are required. `landing:build` only has to be repeated when `landing/`
changes; `npm run dev` without it serves the docs and 404s on `/`.
Open http://localhost:3000. Node 22, the Flutter SDK and the Jaspr CLI (see `../landing/README.md` for the command) are
required. `landing:build` only has to be repeated when `landing/` changes; `npm run dev` without it serves the docs and
404s on `/`.

## Layout

Expand Down
13 changes: 13 additions & 0 deletions docs_app/flutter/analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,16 @@ analyzer:
- windows/**
- macos/**
- linux/**
errors:
# The Docs* field widgets are generic over the controller's value type and
# take callbacks over it, the same as the controllers in the package.
unsafe_variance: ignore

# The same plugin setup as the package's analysis_options.yaml.
plugins:
leancode_lint:
version: ^28.0.0
diagnostics:
cognitive_complexity: true
# Off: dot shorthands need Dart 3.10, and this package's floor is 3.8.
prefer_dot_shorthand: false
2 changes: 1 addition & 1 deletion docs_app/flutter/lib/support/docs_brightness.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class DocsBrightness extends ValueNotifier<Brightness> {
DocsBrightness() : super(_read()) {
_observer =
web.MutationObserver(
(JSArray<JSObject> _, web.MutationObserver __) {
(JSArray<JSObject> _, web.MutationObserver _) {
value = _read();
}.toJS,
)..observe(
Expand Down
2 changes: 2 additions & 0 deletions docs_app/flutter/lib/support/island_frame.dart
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ class _IslandFrameState extends State<IslandFrame> {
/// The same tokens the docs page paints with: near-black surfaces, one lime
/// accent, rounded filled inputs. In the light variant the accent becomes a
/// fill with dark ink on it — a lime *text* would not be legible on paper.
// The score comes from the flat light/dark choices below, not from nesting.
// ignore: leancode_lint/cognitive_complexity
ThemeData islandTheme(Brightness brightness) {
final dark = brightness == Brightness.dark;

Expand Down
Loading
Loading