Skip to content

Commit ed899c0

Browse files
devoncarewkevmoo
andauthored
refactor the CI + testing setup (#74)
* 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>
1 parent 594ae13 commit ed899c0

File tree

5 files changed

+56
-57
lines changed

5 files changed

+56
-57
lines changed

.github/workflows/dart.yml

Lines changed: 42 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -9,42 +9,59 @@ on:
99
- cron: "0 0 * * 0" # Run every Sunday at 00:00.
1010

1111
jobs:
12+
13+
# Default test configurations.
1214
test:
1315
runs-on: ${{ matrix.os }}
16+
defaults:
17+
run:
18+
working-directory: example
1419
strategy:
15-
fail-fast: false
1620
matrix:
1721
os: [ubuntu-latest, macos-latest, windows-latest]
18-
# Test latest stable, beta, dev channels + last stable release
19-
# prior to the introduction of the unified `dart` developer tool.
20-
sdk: [stable, beta, dev, 2.9.3, 2.12.0-29.10.beta]
21-
flavor: [release]
22+
sdk: [2.12.0, stable, beta, dev]
23+
fail-fast: false
2224
steps:
2325
- uses: actions/checkout@v3
2426
- uses: ./
2527
with:
2628
sdk: ${{ matrix.sdk }}
2729

2830
- name: Print DART_HOME
29-
shell: bash
3031
run: echo "Dart SDK installed in $DART_HOME"
32+
- run: dart pub get
33+
- run: dart run bin/main.dart
34+
- run: dart analyze
35+
- run: dart test
36+
37+
# Test older SDKs.
38+
test_older:
39+
runs-on: ${{ matrix.os }}
40+
strategy:
41+
matrix:
42+
os: [ubuntu-latest, macos-latest, windows-latest]
43+
sdk: [2.9.3]
44+
fail-fast: false
45+
steps:
46+
- uses: actions/checkout@v3
47+
- uses: ./
48+
with:
49+
sdk: ${{ matrix.sdk }}
3150

3251
- name: Run hello world
3352
run: |
3453
echo "main() { print('hello world'); }" > hello.dart
3554
dart hello.dart
3655
56+
# Test the raw flavor SDKs.
3757
test_raw:
3858
runs-on: ${{ matrix.os }}
3959
strategy:
40-
fail-fast: false
4160
matrix:
4261
os: [ubuntu-latest, macos-latest, windows-latest]
43-
# Test latest stable, beta, dev, and main channels + last stable release
44-
# prior to the introduction of the unified `dart` developer tool, using
45-
# raw (unsigned) bits.
46-
sdk: [stable, beta, dev, main, 2.9.3, 2.12.0-29.10.beta]
62+
sdk: [dev, main]
4763
flavor: [raw]
64+
fail-fast: false
4865
steps:
4966
- uses: actions/checkout@v3
5067
- uses: ./
@@ -56,12 +73,13 @@ jobs:
5673
echo "main() { print('hello world'); }" > hello.dart
5774
dart hello.dart
5875
76+
# Test the architecture input parameter.
5977
test_arch:
6078
runs-on: windows-latest
6179
strategy:
62-
fail-fast: false
6380
matrix:
64-
sdk: [stable, beta, dev, 2.9.3, 2.12.0-29.10.beta]
81+
sdk: [2.12.0, stable, dev]
82+
fail-fast: false
6583
steps:
6684
- uses: actions/checkout@v3
6785
- uses: ./
@@ -73,50 +91,23 @@ jobs:
7391
run: |
7492
echo "main() { print('hello world'); }" > hello.dart
7593
dart hello.dart
76-
77-
test_pub:
78-
runs-on: ${{ matrix.os }}
94+
95+
# Test inferring the channel from the sdk parameter.
96+
test_inferred_channels:
97+
runs-on: ubuntu-latest
7998
strategy:
80-
fail-fast: false
8199
matrix:
82-
os: [ubuntu-latest, macos-latest, windows-latest]
83-
sdk: [stable, beta]
100+
sdk: [2.12.0-29.10.beta]
101+
fail-fast: false
84102
steps:
85103
- uses: actions/checkout@v3
86104
- uses: ./
87105
with:
88106
sdk: ${{ matrix.sdk }}
107+
architecture: ia32
89108

90-
- name: Global activate + run
109+
- name: Run hello world
91110
run: |
92-
dart pub global activate stagehand
93-
mkdir testapp
94-
cd testapp
95-
stagehand console-simple
96-
dart pub get
97-
dart run
98-
99-
test_test:
100-
runs-on: ${{ matrix.os }}
101-
strategy:
102-
fail-fast: false
103-
matrix:
104-
os: [ubuntu-latest, macos-latest, windows-latest]
105-
# Test latest stable, beta, dev channels
106-
sdk: [stable, beta, dev]
107-
flavor: [release]
108-
steps:
109-
- uses: actions/checkout@v3
110-
- uses: ./
111-
with:
112-
sdk: ${{ matrix.sdk }}
113-
114-
- id: dart_pub_upgrade
115-
name: Dart pub upgrade
116-
working-directory: example
117-
run: dart pub upgrade
118-
119-
- name: Dart test
120-
if: "always() && steps.dart_pub_upgrade.conclusion == 'success'"
121-
working-directory: example
122-
run: dart test
111+
echo "main() { print('hello world'); }" > hello.dart
112+
dart hello.dart
113+
- run: dart --version

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ jobs:
9696
strategy:
9797
matrix:
9898
os: [ubuntu-latest, macos-latest, windows-latest]
99-
sdk: [stable, beta, dev, 2.10.3, 2.12.0-29.10.beta]
99+
sdk: [2.18.0, stable, beta, dev]
100100
steps:
101101
- uses: actions/checkout@v3
102102
- uses: dart-lang/setup-dart@v1

action.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ branding:
55
color: blue
66
inputs:
77
sdk:
8-
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."
8+
description: >-
9+
The channel, or a specific version from a channel to install ('stable',
10+
'beta', 'dev', '2.7.2', '2.12.0-1.4.beta'). Using one of the three
11+
channels instead of a version will give you the latest version published
12+
to that channel.
913
required: false
1014
default: "stable"
1115
architecture:

example/bin/main.dart

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
void main(List<String> args) {
6+
print('hello world');
7+
}

example/pubspec.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
name: example
22
publish_to: none
3+
34
environment:
45
sdk: ">=2.12.0 <3.0.0"
56

6-
dependencies:
7-
characters:
8-
git: https://github.com/dart-lang/characters
9-
107
dev_dependencies:
118
test: any

0 commit comments

Comments
 (0)