Skip to content

Commit

Permalink
Added revamped workflow that now tests this library against both the …
Browse files Browse the repository at this point in the history
…current and N-1 version of Flutter.
  • Loading branch information
diegotori committed Jan 15, 2025
1 parent 12aebcc commit 746795d
Showing 1 changed file with 44 additions and 37 deletions.
81 changes: 44 additions & 37 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
name: CI

env:
# Note: The version below should be manually updated to the latest second most recent version
# after a new stable version comes out.
flutter_n_minus_one_version: "3.24.5"

on:
pull_request:
paths-ignore:
Expand All @@ -9,48 +14,50 @@ on:
- master
paths-ignore:
- '**.md'
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
check-format:
name: Check format using dart format.
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Flutter Action
uses: subosito/flutter-action@v2
- name: Check format
run: dart format . --set-exit-if-changed

lint:
name: Lint
# Does a sanity check that packages at least pass analysis on the N-1
# versions of Flutter stable if the package claims to support that version.
# This is to minimize accidentally making changes that break old versions
# (which we don't commit to supporting, but don't want to actively break)
# without updating the constraints.
lint_and_build:
strategy:
matrix:
flutter-version:
# The version of Flutter to use should use the minimum Dart SDK version supported by the package,
# refer to https://docs.flutter.dev/development/tools/sdk/releases.
- ${{ env.flutter_n_minus_one_version }}
- "3.x"
name: Checks formatting, lints, and tests this library against a specific Flutter version.
runs-on: ubuntu-latest

steps:
- name: Checkout code
- name: 📚 Git Checkout
uses: actions/checkout@v4
- name: Flutter Action

- name: 🐦 Setup Flutter
uses: subosito/flutter-action@v2
- name: Install Package Dependencies
with:
flutter-version: ${{matrix.flutter-version}}
channel: stable
cache: true
cache-key: flutter-:os:-:channel:-:version:-:arch:-:hash:-${{ hashFiles('**/pubspec.lock') }}

- name: 📦 Install Dependencies
run: flutter packages get
- name: Get dependencies for example
run: flutter pub get
working-directory: example
- name: Lint using flutter analyze
run: flutter analyze .

test:
name: Run tests.
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Flutter Action
uses: subosito/flutter-action@v2
- name: Run flutter test
run: |
flutter pub get
flutter test
- name: ✨ Check Formatting
run: dart format --set-exit-if-changed lib

- name: 🕵️ Analyze
run: flutter analyze lib

- name: 🧪 Run Tests
run: flutter test --no-pub --coverage --test-randomize-ordering-seed random

- name: 📁 Upload coverage to Codecov
uses: codecov/codecov-action@v5

0 comments on commit 746795d

Please sign in to comment.