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

Simplified astyle travis test to be easier to reason about #9114

Merged
merged 3 commits into from Jan 4, 2019

Conversation

cmonr
Copy link
Contributor

@cmonr cmonr commented Dec 17, 2018

Description

Greatly simplified the commands needed to run the astyle check.

Some commands seemed to be extraneous, but that's what reviews are for :)

The downside is that this simplifies/removes the files-changed delta from the job status back into a simple pass-fail.

An example of it working can be found here: cmonr#42

In the near future, I'd like to toss together a script (Travis has a REST API), to be able to generate this kind of comment: cmonr#41 (comment) (And maaaybe auto run it? Would probably get to way too verbose)

Pull request type

[x] Fix
[ ] Refactor
[ ] Target update
[ ] Functionality change
[ ] Docs update
[ ] Test update
[ ] Breaking change

@cmonr cmonr requested review from geky, 0xc0170 and a team December 17, 2018 03:34
.travis.yml Outdated
| capture(\", (?<files>[0-9]+) files\").files" \
|| echo 0)
- >-
git diff --name-only HEAD..${TRAVIS_BRANCH} \
Copy link
Contributor

Choose a reason for hiding this comment

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

--diff-filter=d should be kept - we should not check removed files

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Counterpoint.

If a file was removed, doesn't that mean/imply that it passed astyle to begin with and wouldn't be flagged anyways?

Copy link
Contributor

@0xc0170 0xc0170 Dec 19, 2018

Choose a reason for hiding this comment

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

True, but we got ignore list. If that one is changed (removed folder from being ignored) and files that do not comply are being removed? In general this should be fine, but still removed files should not be checked

.travis.yml Outdated
git diff --name-only HEAD..${TRAVIS_BRANCH} \
| ( grep '.\(c\|cpp\|h\|hpp\)$' || true ) \
| while read file; do astyle -n --options=.astylerc "${file}"; done
- git diff --exit-code --color
Copy link
Contributor

Choose a reason for hiding this comment

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

We do not need to report number of files needs changing? Is it sufficient to just report a failure (that was happening in the after_success).

Copy link
Contributor

Choose a reason for hiding this comment

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

The downside is that this simplifies/removes the files-changed delta from the job status back into a simple pass-fail.

Should be OK . It was very useful as we had non zero value on master, now it's zero so any non ezro in PR is a failure

Copy link
Contributor Author

Choose a reason for hiding this comment

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

...Did you just answer your own question, or am I missing something?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, rereading the description

@cmonr cmonr requested a review from kegilbert December 19, 2018 03:55
@cmonr cmonr dismissed 0xc0170’s stale review December 19, 2018 17:19

Changes addressed. Please re-review.

Copy link
Contributor

@0xc0170 0xc0170 left a comment

Choose a reason for hiding this comment

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

Can we test few failures here please to verify it works (or reference some PR tests) ?

@cmonr
Copy link
Contributor Author

cmonr commented Dec 28, 2018

@0xc0170

An example of it working can be found here: cmonr#42

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 2, 2019

👍 Let's rebase and make this to CI?

@cmonr
Copy link
Contributor Author

cmonr commented Jan 3, 2019

@kegilbert @geky Thoughts?

@SeppoTakalo I remember you asking about astyle and running it locally. Is this a good intermediate improvement?

@cmonr
Copy link
Contributor Author

cmonr commented Jan 3, 2019

@0xc0170 Rebase complete.

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 3, 2019

I restarted travis, should be green. Waiting for at least one more review and ready for CI

Copy link
Contributor

@kegilbert kegilbert left a comment

Choose a reason for hiding this comment

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

From my hacky Bash knowledge this LGTM. I like the patch auto-commenter you mentioned in the description, pretty neato.

@cmonr
Copy link
Contributor Author

cmonr commented Jan 4, 2019

... I have no idea why the Travis CI tests are failing.

Have ping'd Travis CI for help, but I suspect this may be something with the apt-get cache...

@cmonr
Copy link
Contributor Author

cmonr commented Jan 4, 2019

Should now have the issue resolved.

My diff resolution removed three rather important lines...

@cmonr cmonr closed this Jan 4, 2019
@cmonr cmonr reopened this Jan 4, 2019
@cmonr cmonr removed the needs: CI label Jan 4, 2019
@cmonr cmonr added the needs: CI label Jan 4, 2019
@cmonr
Copy link
Contributor Author

cmonr commented Jan 4, 2019

CI started

@cmonr cmonr merged commit c580260 into ARMmbed:master Jan 4, 2019
@cmonr cmonr deleted the astyle-simplification branch January 11, 2019 04:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants