blob: c58b372801c34a882111ae0c59472bf052f76912 [file] [log] [blame]
name: Tests
on:
push:
branches:
- main
pull_request:
# Declare default permissions as read only.
permissions: read-all
jobs:
unit-test:
name: Unit tests on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-18.04, windows-2019, macos-10.15]
steps:
# Set up Flutter.
- name: Clone Flutter repository with master channel
uses: subosito/flutter-action@6c2e035f2692eeac890d854df95630c72673f130
with:
channel: master
- run: flutter doctor -v
# Checkout gallery code and get packages.
- name: Checkout gallery code
uses: actions/checkout@d171c3b028d844f2bf14e9fdec0c58114451e4bf
- run: flutter pub get -v
# Analyze, check formatting, and run unit tests.
- run: flutter analyze
- name: Ensure the Dart code is formatted correctly
run: flutter format --set-exit-if-changed --dry-run .
- name: Run Flutter unit tests
run: flutter test
benchmark-test:
name: Benchmark tests
runs-on: ubuntu-18.04
steps:
# Set up Flutter.
- name: Clone Flutter repository with master channel
uses: subosito/flutter-action@6c2e035f2692eeac890d854df95630c72673f130
with:
channel: master
- run: flutter doctor -v
- run: flutter config --enable-web
# Checkout gallery code and get packages.
- name: Checkout gallery code
uses: actions/checkout@d171c3b028d844f2bf14e9fdec0c58114451e4bf
- run: flutter pub get -v
- run: flutter test test_benchmarks
golden-test:
name: Golden tests
runs-on: macos-10.15
steps:
# Set up Flutter.
- name: Clone Flutter repository with master channel
uses: subosito/flutter-action@6c2e035f2692eeac890d854df95630c72673f130
with:
channel: master
- run: flutter doctor -v
# Checkout gallery code and get packages.
- name: Checkout gallery code
uses: actions/checkout@d171c3b028d844f2bf14e9fdec0c58114451e4bf
- run: flutter pub get -v
# Run the golden tests and upload failed test artifacts.
- run: flutter test test_goldens
- name: Upload goldens if tests fail
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8
if: failure()
with:
name: goldens
path: test_goldens/failures/