name: Dart

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

jobs:
  test:
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
        # Test latest stable, beta, and dev channels + last stable release
        # prior to the introduction of the unified `dart` developer tool.
        sdk: [stable, beta, dev, 2.9.3]
    steps:
      - uses: actions/checkout@v2
      - uses: ./
        with:
          sdk: ${{ matrix.sdk }}

      - name: Run hello world
        run: |
          echo "main() { print('hello world'); }" > hello.dart
          dart hello.dart

  # TODO: Remove this step after v0.2 (https://github.com/dart-lang/setup-dart/issues/12).
  test_deprecated_channel:
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        channel: [ stable ]
    steps:
      - uses: actions/checkout@v2
      - uses: ./
        with:
          channel: ${{ matrix.channel }}

      - name: Run hello world
        run: |
          echo "main() { print('hello world'); }" > hello.dart
          dart hello.dart

name: Dart

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

jobs:
  test:
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
        # Test latest stable, beta, and dev channels + last stable release
        # prior to the introduction of the unified `dart` developer tool.
        sdk: [stable, beta, dev, 2.9.3, 2.12.0-29.10.beta]
    steps:
      - uses: actions/checkout@v2
      - uses: ./
        with:
          sdk: ${{ matrix.sdk }}

      - name: Run hello world
        run: |
          echo "main() { print('hello world'); }" > hello.dart
          dart hello.dart

  # TODO: Remove this step after v0.2 (https://github.com/dart-lang/setup-dart/issues/12).
  test_deprecated_channel:
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        channel: [ stable ]
    steps:
      - uses: actions/checkout@v2
      - uses: ./
        with:
          channel: ${{ matrix.channel }}

      - name: Run hello world
        run: |
          echo "main() { print('hello world'); }" > hello.dart
          dart hello.dart

Add back an SDK with a specific version from a channel
Add back an SDK with a specific version from a channel