38
loading...
This website collects cookies to deliver better user experience
pub get
name: Run Tests(for PRs)
on:
workflow_dispatch:
# Runs when a PR is made against master branch
pull_request:
branches: [ master ]
env:
flutter_version: "2.2.3"
jobs:
run_tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# Cache Flutter environment
- name: Cache Flutter dependencies
uses: actions/cache@v2
with:
path: /opt/hostedtoolcache/flutter
key: ${{ runner.OS }}-flutter-install-cache-${{ env.flutter_version }}
- uses: subosito/flutter-action@v1
with:
flutter-version: ${{ env.flutter_version }}
channel: stable
# Run pub get
- name: Run pub get
run: flutter pub get
# Runs tests
- name: Run tests
run: flutter test
master
branch. You could change this to whatever your default branch is, you can even define multiple branches. workflow_dispatch
so the action can be run manually - the reason I did this is because the cache doesn't seem to build properly unless you run the action on the base branch once(this seems to be by design according to GitHub). 2.x
for the version(but tossed out caching) so I don't have to update my actions every couple of weeks.flutter build ios
or flutter build apk
. If your unit tests don't have great coverage you could potentially break your project and I'm pretty sure your tests would still run without any issues. Adding a build step to the end would make sure that your project still builds correctly, but keep in mind this would make the action take longer to finish.