Skip to content
triangle

GitHub Action

Generate matrix from pubspec.yaml action

v1.0 Latest version

Generate matrix from pubspec.yaml action

triangle

Generate matrix from pubspec.yaml action

GitHub Action to generates a matrix of Dart and Flutter SDK versions from a pubspec.yaml file

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Generate matrix from pubspec.yaml action

uses: flutter-actions/[email protected]

Learn more about this action in flutter-actions/pubspec-matrix-action

Choose a version

Note

This action is still in development and may not work as expected.

About

This GitHub Action generates a matrix of Dart and Flutter SDK versions from a pubspec.yaml file.

Inputs

The action takes the following inputs:

  • pubspec: The path to the pubspec.yaml file. Default: pubspec.yaml.

  • channel: The Flutter channel to use when resolving the Flutter SDK version. Default: any

  • platform: The platform to use when resolving the Flutter SDK version. Default: The runner operating system

  • strict: If true, the action will assert constraints on the Dart SDK version bundled with the Flutter SDK to ensure compatibility. Default: false

Outputs

  • matrix: A JSON string representing the matrix of both Dart and Flutter SDK versions.
  • dart: The Dart SDK specific versions.
  • flutter: The Flutter SDK specific versions.

Usage

name: test

on:
  push:

jobs:
  pubspec:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4

    - id: pubspec
      name: Generate matrix from pubspec.yaml
      uses: flutter-actions/pubspec-matrix-action@v1
      with:
        pubspec: 'pubspec.yaml'
    outputs:
      matrix: ${{ steps.pubspec.outputs.matrix }}

  test:
    needs: pubspec
    runs-on: ubuntu-latest
    strategy:
      matrix: ${{fromJson(needs.pubspec.outputs.matrix)}}
    steps:
    - uses: actions/checkout@v4

    - uses: flutter-actions/setup-flutter@v2
      with:
        version: ${{ matrix.flutter }}
        channel: stable

    - run: flutter pub get
    - run: flutter test

Example

License

Licensed under the MIT License.