Skip to content
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

Add a grind script to sanity-check a release #563

Merged
merged 2 commits into from
Jan 10, 2019
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
9 changes: 7 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,15 @@ script: tool/travis/test.sh

jobs:
include:
# Deploy to GitHub.
- stage: deploy 1
# Sanity check before releasing anywhere.
- stage: sanity check
if: &deploy-if
(type IN (push, api)) AND (repo = sass/dart-sass) AND tag =~ ^\d+\.\d+\.\d+([+-].*)?$
script: pub run grinder sanity-check-before-release

# Deploy to GitHub.
- stage: deploy 1
if: *deploy-if
env: &github-env
- GITHUB_USER=sassbot
# GITHUB_AUTH="..."
Expand Down
1 change: 1 addition & 0 deletions tool/grind.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export 'grind/chocolatey.dart';
export 'grind/github.dart';
export 'grind/homebrew.dart';
export 'grind/npm.dart';
export 'grind/sanity_check.dart';
export 'grind/standalone.dart';
export 'grind/synchronize.dart';

Expand Down
29 changes: 29 additions & 0 deletions tool/grind/sanity_check.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Copyright 2019 Google Inc. Use of this source code is governed by an
// MIT-style license that can be found in the LICENSE file or at
// https://opensource.org/licenses/MIT.

import 'dart:io';

import 'package:collection/collection.dart';
import 'package:grinder/grinder.dart';
import 'package:pub_semver/pub_semver.dart';

import 'utils.dart';

@Task('Verify that the package is in a good state to release.')
sanityCheckBeforeRelease() {
var travisTag = environment("TRAVIS_TAG");
if (travisTag != version) {
fail("TRAVIS_TAG $travisTag is different than pubspec version $version.");
}

if (const ListEquality().equals(Version.parse(version).preRelease, ["dev"])) {
fail("$version is a dev release.");
}

var versionHeader =
RegExp("^## ${RegExp.escape(version)}\$", multiLine: true);
if (!File("CHANGELOG.md").readAsStringSync().contains(versionHeader)) {
fail("There's no CHANGELOG entry for $version.");
}
}