Skip to content

Commit b197872

Browse files
author
Anna Gringauze
authored
Add running tests on min SDK and current beta (#1392)
* Add running tests on min SDK and current beta - Run webdev tests on 2.13.4 and beta - prevent breaks on latest stable - prevent breaks on next SDK stable release - Run dwds tests on beta - prevents breaks on next SDK stable release * Require min SDK constraint to match current stable - Run tests in CI for stable and dev - Move tests on beta to a sheduled job instead of on PR - Add tests to ensure that min SDK constraint in webdev and dwds matches major and minor versions of the current stable. * Format
1 parent 487155d commit b197872

File tree

10 files changed

+591
-35
lines changed

10 files changed

+591
-35
lines changed

.github/workflows/dart.yml

+472-14
Large diffs are not rendered by default.

dwds/dart_test.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,3 @@ retry: 3
33

44
tags:
55
extension: # Extension tests require configuration, so we may exclude.
6-
dev-sdk: # Tests that require dev SDK to pass, we may exclude them for stable SDK.

dwds/mono_pkg.yaml

+20-2
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,29 @@ stages:
66
- analyze: --fatal-infos .
77
- test: test/build/ensure_version_test.dart
88
dart: dev
9+
- group:
10+
- analyze: .
11+
- test: test/build/min_sdk_test.dart --run-skipped
12+
dart: stable
913
- unit_test:
1014
- group:
1115
- command: Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
1216
- test:
13-
dart: dev
17+
dart:
18+
- dev
19+
- stable
1420
- test:
1521
os: windows
16-
dart: dev
22+
dart:
23+
- dev
24+
- stable
25+
- beta_cron:
26+
- analyze: .
27+
dart: beta
28+
- group:
29+
- command: Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
30+
- test: -j 1
31+
dart: beta
32+
- test: -j 1
33+
os: windows
34+
dart: beta

dwds/test/build/min_sdk_test.dart

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Copyright (c) 2021, 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+
// @dart = 2.9
6+
7+
@TestOn('vm')
8+
@Skip('Intended to run in analyze stage on stable SDK only, see mono_pkg.yaml')
9+
import 'dart:io';
10+
11+
import 'package:pub_semver/pub_semver.dart';
12+
import 'package:pubspec_parse/pubspec_parse.dart';
13+
import 'package:test/test.dart';
14+
15+
void main() {
16+
test('dwds pubspec has the stable as min SDK constraint', () {
17+
var pubspec = Pubspec.parse(File('pubspec.yaml').readAsStringSync());
18+
var sdkVersion = Version.parse(Platform.version.split(' ')[0]);
19+
sdkVersion = Version(sdkVersion.major, sdkVersion.minor, 0);
20+
21+
var sdkConstraint = VersionConstraint.compatibleWith(sdkVersion);
22+
var pubspecSdkConstraint = pubspec.environment['sdk'];
23+
expect(sdkConstraint.allowsAll(pubspecSdkConstraint), true,
24+
reason:
25+
'Min sdk constraint is outdated. Please update SDK constraint in '
26+
'pubspec to allow latest stable and backwards compatible versions.'
27+
'\n Current stable: $sdkVersion,'
28+
'\n Dwds pubspec constraint: $pubspecSdkConstraint');
29+
});
30+
}

example/pubspec.yaml

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,4 @@ environment:
99
dev_dependencies:
1010
build_runner: ^2.0.0
1111
build_web_compilers: ^3.0.0
12-
webdev:
13-
path: ../webdev
12+
webdev: ^2.7.5

mono_repo.yaml

+5-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ self_validate: analyzer_and_format
33
github:
44
env:
55
DISPLAY: ':99'
6-
cron: '0 0 * * 0'
6+
cron: '0 0 * * 0' # "At 00:00 (UTC) on Sunday."
77
on_completion:
88
- name: "Notify failure"
99
runs-on: ubuntu-latest
@@ -16,6 +16,10 @@ github:
1616
"${CHAT_WEBHOOK_URL}"
1717
env:
1818
CHAT_WEBHOOK_URL: ${{ secrets.BUILD_AND_TEST_TEAM_CHAT_WEBHOOK_URL }}
19+
stages:
20+
- name: beta_cron
21+
# Only run this stage for scheduled cron jobs
22+
if: github.event_name == 'schedule'
1923

2024
merge_stages:
2125
- analyzer_and_format

tool/ci.sh

+13-5
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,14 @@ for PKG in ${PKGS}; do
6767
echo
6868
echo -e "\033[1mPKG: ${PKG}; TASK: ${TASK}\033[22m"
6969
case ${TASK} in
70-
analyze)
70+
analyze_0)
7171
echo 'dart analyze --fatal-infos .'
7272
dart analyze --fatal-infos . || EXIT_CODE=$?
7373
;;
74+
analyze_1)
75+
echo 'dart analyze .'
76+
dart analyze . || EXIT_CODE=$?
77+
;;
7478
command)
7579
echo 'Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &'
7680
Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 & || EXIT_CODE=$?
@@ -84,17 +88,21 @@ for PKG in ${PKGS}; do
8488
dart test test/build/ensure_version_test.dart || EXIT_CODE=$?
8589
;;
8690
test_1)
87-
echo 'dart test'
88-
dart test || EXIT_CODE=$?
91+
echo 'dart test test/build/min_sdk_test.dart --run-skipped'
92+
dart test test/build/min_sdk_test.dart --run-skipped || EXIT_CODE=$?
8993
;;
9094
test_2)
91-
echo 'dart test test/build/ensure_build_test.dart'
92-
dart test test/build/ensure_build_test.dart || EXIT_CODE=$?
95+
echo 'dart test'
96+
dart test || EXIT_CODE=$?
9397
;;
9498
test_3)
9599
echo 'dart test -j 1'
96100
dart test -j 1 || EXIT_CODE=$?
97101
;;
102+
test_4)
103+
echo 'dart test test/build/ensure_build_test.dart'
104+
dart test test/build/ensure_build_test.dart || EXIT_CODE=$?
105+
;;
98106
*)
99107
echo -e "\033[31mUnknown TASK '${TASK}' - TERMINATING JOB\033[0m"
100108
exit 64

webdev/dart_test.yaml

-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,2 @@
11
retry: 3
22

3-
tags:
4-
dev-sdk: # Tests that require dev SDK to pass, we may exclude them for stable SDK.
5-
unreleased-sdk: # Tests that require unpublished SDK to pass, so we may exclude them for stable and dev SDK.

webdev/mono_pkg.yaml

+20-7
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,34 @@
11
# See https://pub.dev/packages/mono_repo for details
2-
dart:
3-
# The minimum version should be kept in sync with the
4-
# minimum SDK version defined in the webdev pubspec.
5-
# This ensures we do not accidentally break users upon
6-
# release of webdev.
7-
- dev
8-
92
stages:
103
- analyzer_and_format:
114
- group:
125
- format
136
- analyze: --fatal-infos .
147
- test: test/build/ensure_build_test.dart
158
dart: dev
9+
- group:
10+
- analyze: .
11+
- test: test/build/min_sdk_test.dart --run-skipped
12+
dart: stable
1613
- unit_test:
1714
- group:
1815
- command: Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
1916
- test: -j 1
17+
dart:
18+
- dev
19+
- stable
20+
- test: -j 1
21+
os: windows
22+
dart:
23+
- dev
24+
- stable
25+
- beta_cron:
26+
- analyze: .
27+
dart: beta
28+
- group:
29+
- command: Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
30+
- test: -j 1
31+
dart: beta
2032
- test: -j 1
2133
os: windows
34+
dart: beta

webdev/test/build/min_sdk_test.dart

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Copyright (c) 2021, 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+
// @dart = 2.9
6+
7+
@TestOn('vm')
8+
@Skip('Intended to run in analyze stage on stable SDK only, see mono_pkg.yaml')
9+
import 'dart:io';
10+
11+
import 'package:pub_semver/pub_semver.dart';
12+
import 'package:pubspec_parse/pubspec_parse.dart';
13+
import 'package:test/test.dart';
14+
15+
void main() {
16+
test('webdev pubspec has the stable as min SDK constraint', () {
17+
var pubspec = Pubspec.parse(File('pubspec.yaml').readAsStringSync());
18+
var sdkVersion = Version.parse(Platform.version.split(' ')[0]);
19+
sdkVersion = Version(sdkVersion.major, sdkVersion.minor, 0);
20+
21+
var sdkConstraint = VersionConstraint.compatibleWith(sdkVersion);
22+
var pubspecSdkConstraint = pubspec.environment['sdk'];
23+
expect(sdkConstraint.allowsAll(pubspecSdkConstraint), true,
24+
reason:
25+
'Min sdk constraint is outdated. Please update SDK constraint in '
26+
'pubspec to allow latest stable and backwards compatible versions.'
27+
'\n Current stable: $sdkVersion, '
28+
'\n Webdev pubspec constraint: $pubspecSdkConstraint');
29+
});
30+
}

0 commit comments

Comments
 (0)