dwyl / learn-flutter

🦋 Learn how to use Flutter to Build Cross-platform Native Mobile Apps
https://flutter.dev
GNU General Public License v2.0
73 stars 8 forks source link

Continuous Integration with Travis #60

Open SimonLab opened 4 years ago

SimonLab commented 4 years ago

The following question contains some links and examples of .travis.yml files: https://stackoverflow.com/questions/60493958/flutter-integration-tests-with-travis-ci

SimonLab commented 4 years ago

The following .travis.yml code seems to work for the flutter-todo-list-tutorial:

language: dart
dist: bionic
addons:
install:
  - git clone https://github.com/flutter/flutter.git -b stable
  - ./flutter/bin/flutter doctor
script:
  - ./flutter/bin/flutter test
cache:
  directories:
    - $HOME/.pub-cache
SimonLab commented 3 years ago

Github actions can be used as CI: Follow the instruction on https://github.com/subosito/flutter-action to create a Github action for running tests (and other flutter command). For example the following yml file will run analyze and test on every push events:

name: CI
on: push
jobs:
  flutter-ci:
    name: run tests
    runs-on: ubuntu-latest
  # see https://github.com/marketplace/actions/flutter-action
    steps:
    - uses: actions/checkout@v2
    - uses: actions/setup-java@v1
      with:
        java-version: '12.x'
    - uses: subosito/flutter-action@v1
      with:
        flutter-version: '1.22.x'
        channel: 'stable'
    - run: flutter pub get
    - run: flutter analyze
    - run: flutter test