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

Fail travis on non updated files #5003

Merged
merged 4 commits into from
Jan 8, 2018
Merged

Conversation

TimvdLippe
Copy link
Contributor

In #4928 we added support for TypeScript by auto-generating types based on the Closure types defined in the library. However, we have to remember that whenever we update our types, that we also regenerate these TypeScript types.

I browsed the man pages of git diff and came across git diff --exit-code: https://git-scm.com/docs/git-diff#git-diff---exit-code This makes git diff fail whenever there are changes.

As such, this PR introduces the git diff in the before_script stage on Travis. This task now runs the generation script of TypeScript types and then verifies that there are no uncommitted changes. Whenever someone updates any Closure types (or adds them with new features), the Travis build will now fail if the developer forgot to update the TypeScript types.

In the commit history of this PR, you can see that the 2nd commit intentionally failed, by updating 1 of our types and not committing the corresponding TypeScript d.ts updates.

This commit is expected to fail, as the library
code has been modified, but the task was
explicitly not run and files are not added.
This commit is supposed to succeed passed the
before_script stage on Travis
Copy link
Member

@aomarks aomarks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Seems like a good simple way to do it.

Copy link
Member

@dfreedm dfreedm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but can you also add the closure externs?

.travis.yml Outdated
@@ -12,6 +12,8 @@ before_script:
- npm install -g bower gulp-cli@1
- bower install
- gulp lint-eslint
- gulp generate-typescript
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also add gulp generate-externs

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done 👍 Edited on GitHub, so let's see if Travis complains

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants