Merge pull request #151 from GiampaoloGabba/master #133
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Tests | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
workflow_call: | |
env: | |
FLUTTER_VERSION: "3.19.3" | |
jobs: | |
tests: | |
name: Unit tests on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
steps: | |
- name: Set up Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: ${{ env.FLUTTER_VERSION }} | |
channel: 'stable' | |
cache: true | |
cache-key: 'flutter-:os:-:channel:-:version:' | |
cache-path: '${{ runner.tool_cache }}/flutter/:channel:-:version:' | |
- name: Flutter doctor | |
run: flutter doctor -v | |
shell: bash | |
# Checkout and get packages. | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Get packages | |
run: flutter pub get | |
# Analyze, check formatting, and run unit tests. | |
- name: Run Unit Tests | |
run: flutter test --coverage | |
- name: Upload Coverage to Codecov | |
if: ${{ runner.os == 'Linux' }} | |
uses: codecov/codecov-action@v2 | |
format: | |
name: Format | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: ${{ env.FLUTTER_VERSION }} | |
channel: 'stable' | |
cache: true | |
cache-key: 'flutter-:os:-:channel:-:version:' | |
cache-path: '${{ runner.tool_cache }}/flutter/:channel:-:version:' | |
- name: Flutter doctor | |
run: flutter doctor -v | |
# Checkout and get packages. | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- run: dart pub get | |
- name: Format | |
run: dart format --set-exit-if-changed . | |
analyze: | |
name: Analyze | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: ${{ env.FLUTTER_VERSION }} | |
channel: 'stable' | |
cache: true | |
cache-key: 'flutter-:os:-:channel:-:version:' | |
cache-path: '${{ runner.tool_cache }}/flutter/:channel:-:version:' | |
- name: Flutter doctor | |
run: flutter doctor -v | |
# Checkout and get packages. | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- run: dart pub get | |
- name: Analyze | |
run: dart analyze |