|
1 | 1 | name: CI
|
2 | 2 |
|
| 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 | + |
3 | 8 | on:
|
4 | 9 | pull_request:
|
5 | 10 | paths-ignore:
|
|
9 | 14 | - master
|
10 | 15 | paths-ignore:
|
11 | 16 | - '**.md'
|
12 |
| - workflow_dispatch: |
| 17 | + |
| 18 | +concurrency: |
| 19 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 20 | + cancel-in-progress: true |
13 | 21 |
|
14 | 22 | 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. |
29 | 37 | runs-on: ubuntu-latest
|
30 |
| - |
31 | 38 | steps:
|
32 |
| - - name: Checkout code |
| 39 | + - name: 📚 Git Checkout |
33 | 40 | uses: actions/checkout@v4
|
34 |
| - - name: Flutter Action |
| 41 | + |
| 42 | + - name: 🐦 Setup Flutter |
35 | 43 | 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 |
37 | 51 | 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 |
47 | 52 |
|
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