This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json | |
name: Flutter Packages CI | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- ".github/workflows/flutter_packages.yaml" | |
- "pkgs/**" | |
pull_request: | |
branches: | |
- main | |
paths: | |
- ".github/workflows/flutter_packages.yaml" | |
- "pkgs/**" | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
changes: | |
runs-on: ubuntu-latest | |
outputs: | |
# The output will be a JSON array of package names, e.g. | |
# '["genui_client"]' | |
matrix: ${{ steps.filter.outputs.changes }} | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 | |
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 | |
id: filter | |
with: | |
# For pushes, the base is the previous commit. For PRs, it's the | |
# target branch. | |
base: ${{ github.base_ref }} | |
# The name of the filter becomes the value in the output matrix. | |
filters: | | |
genui_client: | |
- "pkgs/genui_client/**" | |
# To add another package, create a new entry here. | |
# another_package: | |
# - "pkgs/another_package/**" | |
analyze_and_test: | |
needs: changes | |
# Only run if the 'changes' job has found changed packages. | |
if: github.repository == 'flutter/genui' && needs.changes.outputs.matrix != '[]' | |
name: Test ${{ matrix.package }} on ${{ matrix.os }} with Flutter ${{ matrix.flutter_version }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
# The list of packages is dynamically set from the 'changes' job. | |
package: ${{ fromJSON(needs.changes.outputs.matrix) }} | |
flutter_version: [stable, beta, master] | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
defaults: | |
run: | |
working-directory: pkgs/${{ matrix.package }} | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 | |
- uses: actions/setup-java@17f84c3641ba7b8f6deff6309fc4c864478f5d62 | |
with: | |
distribution: "zulu" | |
java-version: "17" | |
- uses: subosito/flutter-action@e938fdf56512cc96ef2f93601a5a40bde3801046 | |
with: | |
channel: ${{ matrix.flutter_version }} | |
- name: Cache Pub dependencies | |
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 | |
with: | |
path: ${{ env.PUB_CACHE }} | |
key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }} | |
restore-keys: ${{ runner.os }}-pub- | |
- name: Install dependencies | |
run: dart pub get | |
- name: Check formatting | |
run: dart format --output=none --set-exit-if-changed . | |
- name: Analyze code | |
run: flutter analyze --fatal-infos | |
- name: Run Flutter tests | |
run: flutter test --test-randomize-ordering-seed=random |