Skip to content

Add running tests on min SDK and current beta #1392

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

Merged
merged 3 commits into from
Aug 31, 2021
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
486 changes: 472 additions & 14 deletions .github/workflows/dart.yml

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion dwds/dart_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ retry: 3

tags:
extension: # Extension tests require configuration, so we may exclude.
dev-sdk: # Tests that require dev SDK to pass, we may exclude them for stable SDK.
22 changes: 20 additions & 2 deletions dwds/mono_pkg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,29 @@ stages:
- analyze: --fatal-infos .
- test: test/build/ensure_version_test.dart
dart: dev
- group:
- analyze: .
- test: test/build/min_sdk_test.dart --run-skipped
dart: stable
- unit_test:
- group:
- command: Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
- test:
dart: dev
dart:
- dev
- stable
- test:
os: windows
dart: dev
dart:
- dev
- stable
- beta_cron:
- analyze: .
dart: beta
- group:
- command: Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
- test: -j 1
dart: beta
- test: -j 1
os: windows
dart: beta
30 changes: 30 additions & 0 deletions dwds/test/build/min_sdk_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Copyright (c) 2021, 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.

// @dart = 2.9

@TestOn('vm')
@Skip('Intended to run in analyze stage on stable SDK only, see mono_pkg.yaml')
import 'dart:io';

import 'package:pub_semver/pub_semver.dart';
import 'package:pubspec_parse/pubspec_parse.dart';
import 'package:test/test.dart';

void main() {
test('dwds pubspec has the stable as min SDK constraint', () {
var pubspec = Pubspec.parse(File('pubspec.yaml').readAsStringSync());
var sdkVersion = Version.parse(Platform.version.split(' ')[0]);
sdkVersion = Version(sdkVersion.major, sdkVersion.minor, 0);

var sdkConstraint = VersionConstraint.compatibleWith(sdkVersion);
var pubspecSdkConstraint = pubspec.environment['sdk'];
expect(sdkConstraint.allowsAll(pubspecSdkConstraint), true,
reason:
'Min sdk constraint is outdated. Please update SDK constraint in '
'pubspec to allow latest stable and backwards compatible versions.'
'\n Current stable: $sdkVersion,'
'\n Dwds pubspec constraint: $pubspecSdkConstraint');
});
}
3 changes: 1 addition & 2 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@ environment:
dev_dependencies:
build_runner: ^2.0.0
build_web_compilers: ^3.0.0
webdev:
path: ../webdev
webdev: ^2.7.5
6 changes: 5 additions & 1 deletion mono_repo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ self_validate: analyzer_and_format
github:
env:
DISPLAY: ':99'
cron: '0 0 * * 0'
cron: '0 0 * * 0' # "At 00:00 (UTC) on Sunday."
on_completion:
- name: "Notify failure"
runs-on: ubuntu-latest
Expand All @@ -16,6 +16,10 @@ github:
"${CHAT_WEBHOOK_URL}"
env:
CHAT_WEBHOOK_URL: ${{ secrets.BUILD_AND_TEST_TEAM_CHAT_WEBHOOK_URL }}
stages:
- name: beta_cron
# Only run this stage for scheduled cron jobs
if: github.event_name == 'schedule'

merge_stages:
- analyzer_and_format
18 changes: 13 additions & 5 deletions tool/ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,14 @@ for PKG in ${PKGS}; do
echo
echo -e "\033[1mPKG: ${PKG}; TASK: ${TASK}\033[22m"
case ${TASK} in
analyze)
analyze_0)
echo 'dart analyze --fatal-infos .'
dart analyze --fatal-infos . || EXIT_CODE=$?
;;
analyze_1)
echo 'dart analyze .'
dart analyze . || EXIT_CODE=$?
;;
command)
echo 'Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &'
Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 & || EXIT_CODE=$?
Expand All @@ -84,17 +88,21 @@ for PKG in ${PKGS}; do
dart test test/build/ensure_version_test.dart || EXIT_CODE=$?
;;
test_1)
echo 'dart test'
dart test || EXIT_CODE=$?
echo 'dart test test/build/min_sdk_test.dart --run-skipped'
dart test test/build/min_sdk_test.dart --run-skipped || EXIT_CODE=$?
;;
test_2)
echo 'dart test test/build/ensure_build_test.dart'
dart test test/build/ensure_build_test.dart || EXIT_CODE=$?
echo 'dart test'
dart test || EXIT_CODE=$?
;;
test_3)
echo 'dart test -j 1'
dart test -j 1 || EXIT_CODE=$?
;;
test_4)
echo 'dart test test/build/ensure_build_test.dart'
dart test test/build/ensure_build_test.dart || EXIT_CODE=$?
;;
*)
echo -e "\033[31mUnknown TASK '${TASK}' - TERMINATING JOB\033[0m"
exit 64
Expand Down
3 changes: 0 additions & 3 deletions webdev/dart_test.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
retry: 3

tags:
dev-sdk: # Tests that require dev SDK to pass, we may exclude them for stable SDK.
unreleased-sdk: # Tests that require unpublished SDK to pass, so we may exclude them for stable and dev SDK.
27 changes: 20 additions & 7 deletions webdev/mono_pkg.yaml
Original file line number Diff line number Diff line change
@@ -1,21 +1,34 @@
# See https://pub.dev/packages/mono_repo for details
dart:
# The minimum version should be kept in sync with the
# minimum SDK version defined in the webdev pubspec.
# This ensures we do not accidentally break users upon
# release of webdev.
- dev

stages:
- analyzer_and_format:
- group:
- format
- analyze: --fatal-infos .
- test: test/build/ensure_build_test.dart
dart: dev
- group:
- analyze: .
- test: test/build/min_sdk_test.dart --run-skipped
dart: stable
- unit_test:
- group:
- command: Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
- test: -j 1
dart:
- dev
- stable
- test: -j 1
os: windows
dart:
- dev
- stable
- beta_cron:
- analyze: .
dart: beta
- group:
- command: Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
- test: -j 1
dart: beta
- test: -j 1
os: windows
dart: beta
30 changes: 30 additions & 0 deletions webdev/test/build/min_sdk_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Copyright (c) 2021, 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.

// @dart = 2.9

@TestOn('vm')
@Skip('Intended to run in analyze stage on stable SDK only, see mono_pkg.yaml')
import 'dart:io';

import 'package:pub_semver/pub_semver.dart';
import 'package:pubspec_parse/pubspec_parse.dart';
import 'package:test/test.dart';

void main() {
test('webdev pubspec has the stable as min SDK constraint', () {
var pubspec = Pubspec.parse(File('pubspec.yaml').readAsStringSync());
var sdkVersion = Version.parse(Platform.version.split(' ')[0]);
sdkVersion = Version(sdkVersion.major, sdkVersion.minor, 0);

var sdkConstraint = VersionConstraint.compatibleWith(sdkVersion);
var pubspecSdkConstraint = pubspec.environment['sdk'];
expect(sdkConstraint.allowsAll(pubspecSdkConstraint), true,
reason:
'Min sdk constraint is outdated. Please update SDK constraint in '
'pubspec to allow latest stable and backwards compatible versions.'
'\n Current stable: $sdkVersion, '
'\n Webdev pubspec constraint: $pubspecSdkConstraint');
});
}