blob: b78f46ed6957ae6c51ba506c2487a8a9e3ca94bc [file] [log] [blame]
name: Flutter Gallery Unit Tests
on:
push:
branches:
- master
pull_request:
jobs:
test:
name: Test on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
# Set up Flutter and add it to the path.
- name: Clone Flutter repository with master channel.
uses: actions/checkout@v2
with:
repository: 'flutter/flutter'
ref: 'master'
path: 'flutter'
fetch-depth: 0
- name: Add Flutter to the PATH for Unix.
run: echo "::add-path::/$GITHUB_WORKSPACE/flutter/bin"
if: runner.os != 'Windows'
- name: Add Flutter to the PATH for Windows.
run: echo "::add-path::${env:GITHUB_WORKSPACE}\flutter\bin"
if: runner.os == 'Windows'
- name: Run Flutter doctor.
run: flutter doctor -v
# Clone the Gallery repository under `code`, to avoid conflicts with `flutter`.
- name: Clone the Gallery repository.
uses: actions/checkout@v2
with:
path: 'code'
# Run the tests for the repository.
- name: Get packages for the Flutter project.
run: flutter pub get
working-directory: code
- name: Analyze the project's Dart code.
run: flutter analyze
working-directory: code
- name: Ensure the Dart code is formatted correctly.
run: flutter format --set-exit-if-changed --dry-run .
working-directory: code
- name: Run Flutter unit tests.
run: flutter test
working-directory: code
# Run custom scripts defined in `tool/grind.dart`.
- name: Verify that localizations are up to date.
run: flutter pub run grinder verify-l10n
working-directory: code
# TODO: Enable verify-l10n for Windows when it behaves the same as on macOS/Ubuntu:
# https://github.com/material-components/material-components-flutter-gallery/issues/565
if: runner.os != 'Windows'
- name: Verify that code segments are up to date.
run: flutter pub run grinder verify-code-segments
working-directory: code
# TODO: Enable verify-code-segments for Unix and Windows when it behaves the same as on macOS:
# https://github.com/material-components/material-components-flutter-gallery/issues/565
if: runner.os == 'macOS'