# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Flutter

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      # Setup Java environment in order to build the Android app.
      - uses: actions/checkout@v1
      - uses: actions/setup-java@v1
        with:
         java-version: '12.x'
      # Setup the flutter environment.
      - uses: subosito/flutter-action@v1
        with:
         # channel: 'beta' # 'dev', 'alpha', default to: 'stable'
         flutter-version: '2.0.6' # you can also specify exact version of flutter

      - name: Copy environments
        run: cp .env.ci.example .env

      - name: Install dependencies
        run: flutter pub get
      
      - name: Run build runner
        run: flutter pub run build_runner build --delete-conflicting-outputs

      # Check for any formatting issues in the code.
      - name: Verify formatting
        run: flutter format --set-exit-if-changed .

      # Consider passing '--fatal-infos' for slightly stricter analysis.
      - name: Analyze project source
        run: flutter analyze .

      # Run widget tests for our flutter project.
      - name: Run tests
        run: flutter test
