Skip to content

Commit

Permalink
refactor the CI + testing setup (#74)
Browse files Browse the repository at this point in the history
* refactor the CI + testing setup

* split out older sdk testing

* update test_raw

* Update action.yml

Co-authored-by: Kevin Moore <kevmoo@users.noreply.github.com>

* re-add testing for inferring beta channels

* update job name

---------

Co-authored-by: Kevin Moore <kevmoo@users.noreply.github.com>
  • Loading branch information
devoncarew and kevmoo committed Feb 16, 2023
1 parent 594ae13 commit ed899c0
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 57 deletions.
93 changes: 42 additions & 51 deletions .github/workflows/dart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,42 +9,59 @@ 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: ./
with:
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: ./
Expand All @@ -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: ./
Expand All @@ -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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
7 changes: 7 additions & 0 deletions example/bin/main.dart
Original file line number Diff line number Diff line change
@@ -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<String> args) {
print('hello world');
}
5 changes: 1 addition & 4 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit ed899c0

Please sign in to comment.