Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor the CI + testing setup #74

Merged
merged 6 commits into from
Feb 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The specific beta case was testing this branch:
https://github.com/dart-lang/setup-dart/blob/main/setup.sh#L27

If we have no case were we test "detect channel from version anymore" we lose coverage.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha - I'll update this PR to test inferring the channel from the sdk param.

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