Skip to content

Use the dart-lang provided Dart setup #299

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 4 commits into from
Jan 19, 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
74 changes: 29 additions & 45 deletions .github/workflows/dart.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Created with package:mono_repo v3.4.4
# Created with package:mono_repo v3.4.5
name: Dart CI
on:
push:
Expand Down Expand Up @@ -29,10 +29,9 @@ jobs:
os:ubuntu-latest;pub-cache-hosted;dart:dev
os:ubuntu-latest;pub-cache-hosted
os:ubuntu-latest
- uses: cedx/setup-dart@v2
- uses: dart-lang/setup-dart@v0.3
with:
release-channel: dev
- run: dart --version
sdk: dev
- id: checkout
uses: actions/checkout@v2
- id: mono_repo_pub_upgrade
Expand All @@ -58,10 +57,9 @@ jobs:
os:ubuntu-latest;pub-cache-hosted;dart:dev
os:ubuntu-latest;pub-cache-hosted
os:ubuntu-latest
- uses: cedx/setup-dart@v2
- uses: dart-lang/setup-dart@v0.3
with:
release-channel: dev
- run: dart --version
sdk: dev
- id: checkout
uses: actions/checkout@v2
- id: mono_repo_pub_upgrade
Expand Down Expand Up @@ -104,11 +102,10 @@ jobs:
os:ubuntu-latest;pub-cache-hosted;dart:2.7.0
os:ubuntu-latest;pub-cache-hosted
os:ubuntu-latest
- uses: cedx/setup-dart@v2
- uses: dart-lang/setup-dart@v0.3
with:
release-channel: stable
version: "2.7.0"
- run: dart --version
- id: checkout
uses: actions/checkout@v2
- id: mono_repo_pub_upgrade
Expand All @@ -128,16 +125,15 @@ jobs:
uses: actions/cache@v2
with:
path: "~/.pub-cache/hosted"
key: "os:ubuntu-latest;pub-cache-hosted;dart:edge;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:edge;packages:test_pkg
os:ubuntu-latest;pub-cache-hosted;dart:edge
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: cedx/setup-dart@v2
- uses: dart-lang/setup-dart@v0.3
with:
release-channel: edge
- run: dart --version
sdk: main
- id: checkout
uses: actions/checkout@v2
- id: test_pkg_pub_upgrade
Expand Down Expand Up @@ -167,11 +163,10 @@ jobs:
os:ubuntu-latest;pub-cache-hosted;dart:2.12.0-0.0.dev
os:ubuntu-latest;pub-cache-hosted
os:ubuntu-latest
- uses: cedx/setup-dart@v2
- uses: dart-lang/setup-dart@v0.3
with:
release-channel: dev
version: "2.12.0-0.0.dev"
- run: dart --version
- id: checkout
uses: actions/checkout@v2
- id: test_pkg_pub_upgrade
Expand Down Expand Up @@ -201,10 +196,9 @@ jobs:
os:ubuntu-latest;pub-cache-hosted;dart:beta
os:ubuntu-latest;pub-cache-hosted
os:ubuntu-latest
- uses: cedx/setup-dart@v2
- uses: dart-lang/setup-dart@v0.3
with:
release-channel: beta
- run: dart --version
sdk: beta
- id: checkout
uses: actions/checkout@v2
- id: test_pkg_pub_upgrade
Expand Down Expand Up @@ -234,11 +228,10 @@ jobs:
os:ubuntu-latest;pub-cache-hosted;dart:2.12.0-29.10.beta
os:ubuntu-latest;pub-cache-hosted
os:ubuntu-latest
- uses: cedx/setup-dart@v2
- uses: dart-lang/setup-dart@v0.3
with:
release-channel: beta
version: "2.12.0-29.10.beta"
- run: dart --version
- id: checkout
uses: actions/checkout@v2
- id: test_pkg_pub_upgrade
Expand Down Expand Up @@ -268,10 +261,9 @@ jobs:
os:ubuntu-latest;pub-cache-hosted;dart:stable
os:ubuntu-latest;pub-cache-hosted
os:ubuntu-latest
- uses: cedx/setup-dart@v2
- uses: dart-lang/setup-dart@v0.3
with:
release-channel: stable
- run: dart --version
sdk: stable
- id: checkout
uses: actions/checkout@v2
- id: test_pkg_pub_upgrade
Expand Down Expand Up @@ -301,11 +293,10 @@ jobs:
os:ubuntu-latest;pub-cache-hosted;dart:2.10.4
os:ubuntu-latest;pub-cache-hosted
os:ubuntu-latest
- uses: cedx/setup-dart@v2
- uses: dart-lang/setup-dart@v0.3
with:
release-channel: stable
version: "2.10.4"
- run: dart --version
- id: checkout
uses: actions/checkout@v2
- id: test_pkg_pub_upgrade
Expand Down Expand Up @@ -335,11 +326,10 @@ jobs:
os:ubuntu-latest;pub-cache-hosted;dart:2.7.0
os:ubuntu-latest;pub-cache-hosted
os:ubuntu-latest
- uses: cedx/setup-dart@v2
- uses: dart-lang/setup-dart@v0.3
with:
release-channel: stable
version: "2.7.0"
- run: dart --version
- id: checkout
uses: actions/checkout@v2
- id: mono_repo_pub_upgrade
Expand All @@ -365,11 +355,10 @@ jobs:
name: "unit_test; windows; Dart 2.7.0; PKG: mono_repo; `pub run test -x yaml -P presubmit --test-randomize-ordering-seed=random`"
runs-on: windows-latest
steps:
- uses: cedx/setup-dart@v2
- uses: dart-lang/setup-dart@v0.3
with:
release-channel: stable
version: "2.7.0"
- run: dart --version
- id: checkout
uses: actions/checkout@v2
- id: mono_repo_pub_upgrade
Expand Down Expand Up @@ -405,10 +394,9 @@ jobs:
os:ubuntu-latest;pub-cache-hosted;dart:dev
os:ubuntu-latest;pub-cache-hosted
os:ubuntu-latest
- uses: cedx/setup-dart@v2
- uses: dart-lang/setup-dart@v0.3
with:
release-channel: dev
- run: dart --version
sdk: dev
- id: checkout
uses: actions/checkout@v2
- id: mono_repo_pub_upgrade
Expand All @@ -434,10 +422,9 @@ jobs:
name: "unit_test; windows; Dart dev; PKG: mono_repo; `pub run test -x yaml -P presubmit --test-randomize-ordering-seed=random`"
runs-on: windows-latest
steps:
- uses: cedx/setup-dart@v2
- uses: dart-lang/setup-dart@v0.3
with:
release-channel: dev
- run: dart --version
sdk: dev
- id: checkout
uses: actions/checkout@v2
- id: mono_repo_pub_upgrade
Expand Down Expand Up @@ -473,11 +460,10 @@ jobs:
os:ubuntu-latest;pub-cache-hosted;dart:2.7.0
os:ubuntu-latest;pub-cache-hosted
os:ubuntu-latest
- uses: cedx/setup-dart@v2
- uses: dart-lang/setup-dart@v0.3
with:
release-channel: stable
version: "2.7.0"
- run: dart --version
- id: checkout
uses: actions/checkout@v2
- id: mono_repo_pub_upgrade
Expand Down Expand Up @@ -513,10 +499,9 @@ jobs:
os:ubuntu-latest;pub-cache-hosted;dart:dev
os:ubuntu-latest;pub-cache-hosted
os:ubuntu-latest
- uses: cedx/setup-dart@v2
- uses: dart-lang/setup-dart@v0.3
with:
release-channel: dev
- run: dart --version
sdk: dev
- id: checkout
uses: actions/checkout@v2
- id: mono_repo_pub_upgrade
Expand Down Expand Up @@ -552,10 +537,9 @@ jobs:
os:ubuntu-latest;pub-cache-hosted;dart:dev
os:ubuntu-latest;pub-cache-hosted
os:ubuntu-latest
- uses: cedx/setup-dart@v2
- uses: dart-lang/setup-dart@v0.3
with:
release-channel: dev
- run: dart --version
sdk: dev
- id: checkout
uses: actions/checkout@v2
- id: test_pkg_pub_upgrade
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Created with package:mono_repo v3.4.4
# Created with package:mono_repo v3.4.5
language: dart

jobs:
Expand Down
8 changes: 8 additions & 0 deletions mono_repo/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## 3.4.5

### GitHub Actions

- Move to use [dart-lang/setup-dart](https://github.com/dart-lang/setup-dart)
to setup the Dart SDK.
- Remove explicit `dart --version` call. This is handled in the new action.

## 3.4.4

### GitHub Actions
Expand Down
16 changes: 11 additions & 5 deletions mono_repo/lib/src/commands/github/github_yaml.dart
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ extension on CIJobEntry {
includeStage: true,
),
_githubJobOs,
job.sdk,
job.githubSdk,
commandEntries,
additionalCacheKeys: {
'packages': packages.join('-'),
Expand Down Expand Up @@ -334,14 +334,21 @@ Map<String, dynamic> _createDartSetup(String sdk) {
'release-channel': channel,
'version': sdk,
};
} else if (const {'beta', 'dev', 'stable', 'edge'}.contains(sdk)) {
withMap = {'release-channel': sdk};
} else if (const {
'beta',
'dev',
'stable',
CIJob.githubSetupMainSdk,
}.contains(sdk)) {
withMap = {
'sdk': sdk,
};
} else {
unsupported();
}

final map = {
'uses': 'cedx/setup-dart@v2',
'uses': 'dart-lang/setup-dart@v0.3',
'with': withMap,
};

Expand Down Expand Up @@ -385,7 +392,6 @@ Map<String, dynamic> _githubJobYaml(
},
),
_createDartSetup(dartVersion),
{'run': 'dart --version'},
{
'id': 'checkout',
'uses': 'actions/checkout@v2',
Expand Down
10 changes: 7 additions & 3 deletions mono_repo/lib/src/package_config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,10 @@ abstract class HasStageName {

@JsonSerializable(explicitToJson: true)
class CIJob implements HasStageName {
static const _edgeSdk = 'edge';
static const _travisEdgeSdk = 'be/raw/latest';
static const _supportedSdkLiterals = {'edge', 'dev', 'beta', 'stable'};
static const githubSetupMainSdk = 'main';
static const _supportedSdkLiterals = {_edgeSdk, 'dev', 'beta', 'stable'};

@JsonKey(includeIfNull: false)
final String description;
Expand All @@ -190,7 +192,9 @@ class CIJob implements HasStageName {
String get name => description ?? _taskCommandsTickQuoted.join(', ');

/// Same as [sdk] except it handles Travis-specific naming for the edge SDK.
String get travisSdk => sdk == 'edge' ? _travisEdgeSdk : sdk;
String get travisSdk => sdk == _edgeSdk ? _travisEdgeSdk : sdk;

String get githubSdk => sdk == _edgeSdk ? githubSetupMainSdk : sdk;

CIJob(
this.os,
Expand Down Expand Up @@ -232,7 +236,7 @@ class CIJob implements HasStageName {
return CIJob(
os,
package,
sdk == _travisEdgeSdk ? 'edge' : sdk,
{_travisEdgeSdk, githubSetupMainSdk}.contains(sdk) ? _edgeSdk : sdk,
stageName,
tasks,
description: description,
Expand Down
2 changes: 1 addition & 1 deletion mono_repo/lib/src/version.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion mono_repo/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: mono_repo
description: >-
CLI tools to make it easier to manage a single source repository containing
multiple Dart packages.
version: 3.4.4
version: 3.4.5
repository: https://github.com/google/mono_repo.dart

environment:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,9 @@ jobs:
os:ubuntu-latest;pub-cache-hosted;dart:dev
os:ubuntu-latest;pub-cache-hosted
os:ubuntu-latest
- uses: cedx/setup-dart@v2
- uses: dart-lang/setup-dart@v0.3
with:
release-channel: dev
- run: dart --version
sdk: dev
- id: checkout
uses: actions/checkout@v2
- id: sub_pkg_pub_upgrade
Expand All @@ -59,10 +58,9 @@ jobs:
os:ubuntu-latest;pub-cache-hosted;dart:dev
os:ubuntu-latest;pub-cache-hosted
os:ubuntu-latest
- uses: cedx/setup-dart@v2
- uses: dart-lang/setup-dart@v0.3
with:
release-channel: dev
- run: dart --version
sdk: dev
- id: checkout
uses: actions/checkout@v2
- id: sub_pkg_pub_upgrade
Expand All @@ -81,10 +79,9 @@ jobs:
name: "cron; windows; `pub run test`"
runs-on: windows-latest
steps:
- uses: cedx/setup-dart@v2
- uses: dart-lang/setup-dart@v0.3
with:
release-channel: dev
- run: dart --version
sdk: dev
- id: checkout
uses: actions/checkout@v2
- id: sub_pkg_pub_upgrade
Expand Down
Loading