diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml index ab1f7e1..871f2b6 100644 --- a/.github/workflows/dart.yml +++ b/.github/workflows/dart.yml @@ -9,16 +9,18 @@ on: - cron: "0 0 * * 0" # Run every Sunday at 00:00. jobs: + + # Default test configurations. test: runs-on: ${{ matrix.os }} + defaults: + run: + working-directory: example strategy: - fail-fast: false matrix: os: [ubuntu-latest, macos-latest, windows-latest] - # Test latest stable, beta, 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] - flavor: [release] + sdk: [2.12.0, stable, beta, dev] + fail-fast: false steps: - uses: actions/checkout@v3 - uses: ./ @@ -26,25 +28,40 @@ jobs: sdk: ${{ matrix.sdk }} - name: Print DART_HOME - shell: bash run: echo "Dart SDK installed in $DART_HOME" + - run: dart pub get + - run: dart run bin/main.dart + - run: dart analyze + - run: dart test + + # Test older SDKs. + test_older: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + sdk: [2.9.3] + fail-fast: false + steps: + - uses: actions/checkout@v3 + - uses: ./ + with: + sdk: ${{ matrix.sdk }} - name: Run hello world run: | echo "main() { print('hello world'); }" > hello.dart dart hello.dart + # Test the raw flavor SDKs. test_raw: runs-on: ${{ matrix.os }} strategy: - fail-fast: false matrix: os: [ubuntu-latest, macos-latest, windows-latest] - # Test latest stable, beta, dev, and main channels + last stable release - # prior to the introduction of the unified `dart` developer tool, using - # raw (unsigned) bits. - sdk: [stable, beta, dev, main, 2.9.3, 2.12.0-29.10.beta] + sdk: [dev, main] flavor: [raw] + fail-fast: false steps: - uses: actions/checkout@v3 - uses: ./ @@ -56,12 +73,13 @@ jobs: echo "main() { print('hello world'); }" > hello.dart dart hello.dart + # Test the architecture input parameter. test_arch: runs-on: windows-latest strategy: - fail-fast: false matrix: - sdk: [stable, beta, dev, 2.9.3, 2.12.0-29.10.beta] + sdk: [2.12.0, stable, dev] + fail-fast: false steps: - uses: actions/checkout@v3 - uses: ./ @@ -73,50 +91,23 @@ jobs: run: | echo "main() { print('hello world'); }" > hello.dart dart hello.dart - - test_pub: - runs-on: ${{ matrix.os }} + + # Test inferring the channel from the sdk parameter. + test_inferred_channels: + runs-on: ubuntu-latest strategy: - fail-fast: false matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - sdk: [stable, beta] + sdk: [2.12.0-29.10.beta] + fail-fast: false steps: - uses: actions/checkout@v3 - uses: ./ with: sdk: ${{ matrix.sdk }} + architecture: ia32 - - name: Global activate + run + - name: Run hello world run: | - dart pub global activate stagehand - mkdir testapp - cd testapp - stagehand console-simple - dart pub get - dart run - - test_test: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - # Test latest stable, beta, dev channels - sdk: [stable, beta, dev] - flavor: [release] - steps: - - uses: actions/checkout@v3 - - uses: ./ - with: - sdk: ${{ matrix.sdk }} - - - id: dart_pub_upgrade - name: Dart pub upgrade - working-directory: example - run: dart pub upgrade - - - name: Dart test - if: "always() && steps.dart_pub_upgrade.conclusion == 'success'" - working-directory: example - run: dart test + echo "main() { print('hello world'); }" > hello.dart + dart hello.dart + - run: dart --version diff --git a/README.md b/README.md index 158fb3b..0979ba2 100644 --- a/README.md +++ b/README.md @@ -96,7 +96,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] - sdk: [stable, beta, dev, 2.10.3, 2.12.0-29.10.beta] + sdk: [2.18.0, stable, beta, dev] steps: - uses: actions/checkout@v3 - uses: dart-lang/setup-dart@v1 diff --git a/action.yml b/action.yml index e3ac45e..53daecd 100644 --- a/action.yml +++ b/action.yml @@ -5,7 +5,11 @@ branding: color: blue inputs: sdk: - description: "The channel, or a specific version from a channel to install ('stable', 'beta', 'dev', '2.7.2', '2.12.0-1.4.beta'). Using one of the three channels instead of a version will give you the latest version published to that channel." + description: >- + The channel, or a specific version from a channel to install ('stable', + 'beta', 'dev', '2.7.2', '2.12.0-1.4.beta'). Using one of the three + channels instead of a version will give you the latest version published + to that channel. required: false default: "stable" architecture: diff --git a/example/bin/main.dart b/example/bin/main.dart new file mode 100644 index 0000000..ca6b24e --- /dev/null +++ b/example/bin/main.dart @@ -0,0 +1,7 @@ +// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +void main(List args) { + print('hello world'); +} diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 897475f..8b71f7c 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -1,11 +1,8 @@ name: example publish_to: none + environment: sdk: ">=2.12.0 <3.0.0" -dependencies: - characters: - git: https://github.com/dart-lang/characters - dev_dependencies: test: any