-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Normalize, sort, and validate SDK configurations
Towards #303
- Loading branch information
Showing
10 changed files
with
347 additions
and
217 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -117,22 +117,22 @@ jobs: | |
working-directory: mono_repo | ||
run: dartanalyzer . | ||
job_004: | ||
name: "smoke_test; linux; Dart edge; PKG: test_pkg; `dartfmt -n --set-exit-if-changed .`, `dartanalyzer --fatal-infos .`" | ||
name: "smoke_test; linux; Dart 2.10.4; PKG: test_pkg; `dartfmt -n --set-exit-if-changed .`, `dartanalyzer --fatal-infos .`" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Cache Pub hosted dependencies | ||
uses: actions/cache@v2 | ||
with: | ||
path: "~/.pub-cache/hosted" | ||
key: "os:ubuntu-latest;pub-cache-hosted;dart:main;packages:test_pkg;commands:dartfmt-dartanalyzer_0" | ||
key: "os:ubuntu-latest;pub-cache-hosted;dart:2.10.4;packages:test_pkg;commands:dartfmt-dartanalyzer_0" | ||
restore-keys: | | ||
os:ubuntu-latest;pub-cache-hosted;dart:main;packages:test_pkg | ||
os:ubuntu-latest;pub-cache-hosted;dart:main | ||
os:ubuntu-latest;pub-cache-hosted;dart:2.10.4;packages:test_pkg | ||
os:ubuntu-latest;pub-cache-hosted;dart:2.10.4 | ||
os:ubuntu-latest;pub-cache-hosted | ||
os:ubuntu-latest | ||
- uses: dart-lang/[email protected] | ||
with: | ||
sdk: main | ||
sdk: "2.10.4" | ||
- id: checkout | ||
uses: actions/checkout@v2 | ||
- id: test_pkg_pub_upgrade | ||
|
@@ -181,22 +181,22 @@ jobs: | |
working-directory: test_pkg | ||
run: dartanalyzer --fatal-infos . | ||
job_006: | ||
name: "smoke_test; linux; Dart beta; PKG: test_pkg; `dartfmt -n --set-exit-if-changed .`, `dartanalyzer --fatal-infos .`" | ||
name: "smoke_test; linux; Dart 2.12.0-29.10.beta; PKG: test_pkg; `dartfmt -n --set-exit-if-changed .`, `dartanalyzer --fatal-infos .`" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Cache Pub hosted dependencies | ||
uses: actions/cache@v2 | ||
with: | ||
path: "~/.pub-cache/hosted" | ||
key: "os:ubuntu-latest;pub-cache-hosted;dart:beta;packages:test_pkg;commands:dartfmt-dartanalyzer_0" | ||
key: "os:ubuntu-latest;pub-cache-hosted;dart:2.12.0-29.10.beta;packages:test_pkg;commands:dartfmt-dartanalyzer_0" | ||
restore-keys: | | ||
os:ubuntu-latest;pub-cache-hosted;dart:beta;packages:test_pkg | ||
os:ubuntu-latest;pub-cache-hosted;dart:beta | ||
os:ubuntu-latest;pub-cache-hosted;dart:2.12.0-29.10.beta;packages:test_pkg | ||
os:ubuntu-latest;pub-cache-hosted;dart:2.12.0-29.10.beta | ||
os:ubuntu-latest;pub-cache-hosted | ||
os:ubuntu-latest | ||
- uses: dart-lang/[email protected] | ||
with: | ||
sdk: beta | ||
sdk: "2.12.0-29.10.beta" | ||
- id: checkout | ||
uses: actions/checkout@v2 | ||
- id: test_pkg_pub_upgrade | ||
|
@@ -213,22 +213,22 @@ jobs: | |
working-directory: test_pkg | ||
run: dartanalyzer --fatal-infos . | ||
job_007: | ||
name: "smoke_test; linux; Dart 2.12.0-29.10.beta; PKG: test_pkg; `dartfmt -n --set-exit-if-changed .`, `dartanalyzer --fatal-infos .`" | ||
name: "smoke_test; linux; Dart beta; PKG: test_pkg; `dartfmt -n --set-exit-if-changed .`, `dartanalyzer --fatal-infos .`" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Cache Pub hosted dependencies | ||
uses: actions/cache@v2 | ||
with: | ||
path: "~/.pub-cache/hosted" | ||
key: "os:ubuntu-latest;pub-cache-hosted;dart:2.12.0-29.10.beta;packages:test_pkg;commands:dartfmt-dartanalyzer_0" | ||
key: "os:ubuntu-latest;pub-cache-hosted;dart:beta;packages:test_pkg;commands:dartfmt-dartanalyzer_0" | ||
restore-keys: | | ||
os:ubuntu-latest;pub-cache-hosted;dart:2.12.0-29.10.beta;packages:test_pkg | ||
os:ubuntu-latest;pub-cache-hosted;dart:2.12.0-29.10.beta | ||
os:ubuntu-latest;pub-cache-hosted;dart:beta;packages:test_pkg | ||
os:ubuntu-latest;pub-cache-hosted;dart:beta | ||
os:ubuntu-latest;pub-cache-hosted | ||
os:ubuntu-latest | ||
- uses: dart-lang/[email protected] | ||
with: | ||
sdk: "2.12.0-29.10.beta" | ||
sdk: beta | ||
- id: checkout | ||
uses: actions/checkout@v2 | ||
- id: test_pkg_pub_upgrade | ||
|
@@ -245,22 +245,22 @@ jobs: | |
working-directory: test_pkg | ||
run: dartanalyzer --fatal-infos . | ||
job_008: | ||
name: "smoke_test; linux; Dart stable; PKG: test_pkg; `dartfmt -n --set-exit-if-changed .`, `dartanalyzer --fatal-infos .`" | ||
name: "smoke_test; linux; Dart main; PKG: test_pkg; `dartfmt -n --set-exit-if-changed .`, `dartanalyzer --fatal-infos .`" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Cache Pub hosted dependencies | ||
uses: actions/cache@v2 | ||
with: | ||
path: "~/.pub-cache/hosted" | ||
key: "os:ubuntu-latest;pub-cache-hosted;dart:stable;packages:test_pkg;commands:dartfmt-dartanalyzer_0" | ||
key: "os:ubuntu-latest;pub-cache-hosted;dart:main;packages:test_pkg;commands:dartfmt-dartanalyzer_0" | ||
restore-keys: | | ||
os:ubuntu-latest;pub-cache-hosted;dart:stable;packages:test_pkg | ||
os:ubuntu-latest;pub-cache-hosted;dart:stable | ||
os:ubuntu-latest;pub-cache-hosted;dart:main;packages:test_pkg | ||
os:ubuntu-latest;pub-cache-hosted;dart:main | ||
os:ubuntu-latest;pub-cache-hosted | ||
os:ubuntu-latest | ||
- uses: dart-lang/[email protected] | ||
with: | ||
sdk: stable | ||
sdk: main | ||
- id: checkout | ||
uses: actions/checkout@v2 | ||
- id: test_pkg_pub_upgrade | ||
|
@@ -277,22 +277,22 @@ jobs: | |
working-directory: test_pkg | ||
run: dartanalyzer --fatal-infos . | ||
job_009: | ||
name: "smoke_test; linux; Dart 2.10.4; PKG: test_pkg; `dartfmt -n --set-exit-if-changed .`, `dartanalyzer --fatal-infos .`" | ||
name: "smoke_test; linux; Dart stable; PKG: test_pkg; `dartfmt -n --set-exit-if-changed .`, `dartanalyzer --fatal-infos .`" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Cache Pub hosted dependencies | ||
uses: actions/cache@v2 | ||
with: | ||
path: "~/.pub-cache/hosted" | ||
key: "os:ubuntu-latest;pub-cache-hosted;dart:2.10.4;packages:test_pkg;commands:dartfmt-dartanalyzer_0" | ||
key: "os:ubuntu-latest;pub-cache-hosted;dart:stable;packages:test_pkg;commands:dartfmt-dartanalyzer_0" | ||
restore-keys: | | ||
os:ubuntu-latest;pub-cache-hosted;dart:2.10.4;packages:test_pkg | ||
os:ubuntu-latest;pub-cache-hosted;dart:2.10.4 | ||
os:ubuntu-latest;pub-cache-hosted;dart:stable;packages:test_pkg | ||
os:ubuntu-latest;pub-cache-hosted;dart:stable | ||
os:ubuntu-latest;pub-cache-hosted | ||
os:ubuntu-latest | ||
- uses: dart-lang/[email protected] | ||
with: | ||
sdk: "2.10.4" | ||
sdk: stable | ||
- id: checkout | ||
uses: actions/checkout@v2 | ||
- id: test_pkg_pub_upgrade | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
## 3.4.7-dev | ||
|
||
- Use the latest `dart-lang/[email protected]`. | ||
- Normalize Dart SDK configurations. Throw on duplicate SDKs. Sort SDKs to | ||
maintain stable output. | ||
|
||
## 3.4.6 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,6 @@ | |
// BSD-style license that can be found in the LICENSE file. | ||
|
||
import 'package:meta/meta.dart'; | ||
import 'package:pub_semver/pub_semver.dart'; | ||
|
||
import '../../ci_shared.dart'; | ||
import '../../github_config.dart'; | ||
|
@@ -278,7 +277,7 @@ extension on CIJobEntry { | |
includeStage: true, | ||
), | ||
_githubJobOs, | ||
job.githubSdk, | ||
job.sdk, | ||
commandEntries, | ||
additionalCacheKeys: { | ||
'packages': packages.join('-'), | ||
|
@@ -299,48 +298,6 @@ extension on CIJobEntry { | |
} | ||
} | ||
|
||
Map<String, dynamic> _createDartSetup(String sdk) { | ||
Version realVersion; | ||
|
||
try { | ||
realVersion = Version.parse(sdk); | ||
} on FormatException { | ||
// noop | ||
} | ||
|
||
@alwaysThrows | ||
void unsupported() => throw UserException( | ||
'Unsupported Dart SDK configuration: `$sdk`.', | ||
details: "We are currently limited by what's supported by " | ||
'https://github.com/marketplace/actions/setup-dart-action', | ||
); | ||
|
||
Map<String, String> withMap; | ||
if (realVersion != null) { | ||
withMap = { | ||
'sdk': sdk, | ||
}; | ||
} else if (const { | ||
'beta', | ||
'dev', | ||
'stable', | ||
CIJob.githubSetupMainSdk, | ||
}.contains(sdk)) { | ||
withMap = { | ||
'sdk': sdk, | ||
}; | ||
} else { | ||
unsupported(); | ||
} | ||
|
||
final map = { | ||
'uses': 'dart-lang/[email protected]', | ||
'with': withMap, | ||
}; | ||
|
||
return map; | ||
} | ||
|
||
/// Returns the content of a Github Action Job. | ||
/// | ||
/// See https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions#jobs | ||
|
@@ -377,7 +334,12 @@ Map<String, dynamic> _githubJobYaml( | |
if (additionalCacheKeys != null) ...additionalCacheKeys, | ||
}, | ||
), | ||
_createDartSetup(dartVersion), | ||
{ | ||
'uses': 'dart-lang/[email protected]', | ||
'with': { | ||
'sdk': dartVersion, | ||
}, | ||
}, | ||
{ | ||
'id': 'checkout', | ||
'uses': 'actions/checkout@v2', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.