Skip to content

Commit 746795d

Browse files
committed
Added revamped workflow that now tests this library against both the current and N-1 version of Flutter.
1 parent 12aebcc commit 746795d

File tree

1 file changed

+44
-37
lines changed

1 file changed

+44
-37
lines changed

.github/workflows/ci.yml

Lines changed: 44 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
name: CI
22

3+
env:
4+
# Note: The version below should be manually updated to the latest second most recent version
5+
# after a new stable version comes out.
6+
flutter_n_minus_one_version: "3.24.5"
7+
38
on:
49
pull_request:
510
paths-ignore:
@@ -9,48 +14,50 @@ on:
914
- master
1015
paths-ignore:
1116
- '**.md'
12-
workflow_dispatch:
17+
18+
concurrency:
19+
group: ${{ github.workflow }}-${{ github.ref }}
20+
cancel-in-progress: true
1321

1422
jobs:
15-
check-format:
16-
name: Check format using dart format.
17-
runs-on: ubuntu-latest
18-
19-
steps:
20-
- name: Checkout code
21-
uses: actions/checkout@v4
22-
- name: Flutter Action
23-
uses: subosito/flutter-action@v2
24-
- name: Check format
25-
run: dart format . --set-exit-if-changed
26-
27-
lint:
28-
name: Lint
23+
# Does a sanity check that packages at least pass analysis on the N-1
24+
# versions of Flutter stable if the package claims to support that version.
25+
# This is to minimize accidentally making changes that break old versions
26+
# (which we don't commit to supporting, but don't want to actively break)
27+
# without updating the constraints.
28+
lint_and_build:
29+
strategy:
30+
matrix:
31+
flutter-version:
32+
# The version of Flutter to use should use the minimum Dart SDK version supported by the package,
33+
# refer to https://docs.flutter.dev/development/tools/sdk/releases.
34+
- ${{ env.flutter_n_minus_one_version }}
35+
- "3.x"
36+
name: Checks formatting, lints, and tests this library against a specific Flutter version.
2937
runs-on: ubuntu-latest
30-
3138
steps:
32-
- name: Checkout code
39+
- name: 📚 Git Checkout
3340
uses: actions/checkout@v4
34-
- name: Flutter Action
41+
42+
- name: 🐦 Setup Flutter
3543
uses: subosito/flutter-action@v2
36-
- name: Install Package Dependencies
44+
with:
45+
flutter-version: ${{matrix.flutter-version}}
46+
channel: stable
47+
cache: true
48+
cache-key: flutter-:os:-:channel:-:version:-:arch:-:hash:-${{ hashFiles('**/pubspec.lock') }}
49+
50+
- name: 📦 Install Dependencies
3751
run: flutter packages get
38-
- name: Get dependencies for example
39-
run: flutter pub get
40-
working-directory: example
41-
- name: Lint using flutter analyze
42-
run: flutter analyze .
43-
44-
test:
45-
name: Run tests.
46-
runs-on: ubuntu-latest
4752

48-
steps:
49-
- name: Checkout code
50-
uses: actions/checkout@v4
51-
- name: Flutter Action
52-
uses: subosito/flutter-action@v2
53-
- name: Run flutter test
54-
run: |
55-
flutter pub get
56-
flutter test
53+
- name: ✨ Check Formatting
54+
run: dart format --set-exit-if-changed lib
55+
56+
- name: 🕵️ Analyze
57+
run: flutter analyze lib
58+
59+
- name: 🧪 Run Tests
60+
run: flutter test --no-pub --coverage --test-randomize-ordering-seed random
61+
62+
- name: 📁 Upload coverage to Codecov
63+
uses: codecov/codecov-action@v5

0 commit comments

Comments
 (0)