Skip to content

Instantly share code, notes, and snippets.

@nestorsgarzonc
Last active October 22, 2024 00:34
Show Gist options
  • Select an option

  • Save nestorsgarzonc/5dc287b2108e6a522b07e4aeba8dafab to your computer and use it in GitHub Desktop.

Select an option

Save nestorsgarzonc/5dc287b2108e6a522b07e4aeba8dafab to your computer and use it in GitHub Desktop.
CI.yml
name: Flutter CI
on:
push:
branches:
- "main"
pull_request:
branches:
# Your desired branches
- "main"
jobs:
flutter_unit_test:
name: Run Flutter Tests and Analyze
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout the branch
uses: actions/checkout@v4
- name: Setup Flutter SDK
uses: subosito/flutter-action@v2
with:
channel: 'stable'
cache: true
- name: Cache Pub Dependencies
uses: actions/cache@v3
with:
path: ~/.pub-cache
key: ${{ runner.os }}-pub-${{ hashFiles('pubspec.lock') }}
restore-keys: |
${{ runner.os }}-pub-
- name: Get packages
run: flutter pub get
- name: Analyze code
# If can specify the folder to analyze
# flutter analyze lib --no-pub --fatal-warnings
run: flutter analyze --no-pub --fatal-warnings
- name: Run unit tests
run: flutter test
- name: Check code formatting
run: dart format ./lib --set-exit-if-changed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment