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

Set up CI with Azure Pipelines that checks that sources are clang-format'd #132

Merged
merged 23 commits into from
Sep 25, 2019

Conversation

BillyONeal
Copy link
Member

@BillyONeal BillyONeal commented Sep 24, 2019

This script runs clang-format on the sources, then runs git status --porcelain on the result, redirected to stderr. If any output goes to stderr, Azure Pipelines marks the build as failed, which enforces that no changes were made to the repo by the clang-format pass.

Resolves #88

@BillyONeal BillyONeal requested a review from a team as a code owner September 24, 2019 23:58
@BillyONeal
Copy link
Member Author

/AzurePipelines run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@BillyONeal BillyONeal closed this Sep 25, 2019
@BillyONeal BillyONeal deleted the azure-pipelines branch September 25, 2019 00:06
@BillyONeal BillyONeal restored the azure-pipelines branch September 25, 2019 00:33
@BillyONeal BillyONeal reopened this Sep 25, 2019
@BillyONeal
Copy link
Member Author

/AzurePipelines run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@BillyONeal BillyONeal changed the title Set up CI with Azure Pipelines Set up CI with Azure Pipelines that checks that sources are clang-format'd Sep 25, 2019
@BillyONeal
Copy link
Member Author

@Microsoft/vclibs Can you folks review this now?

@BillyONeal
Copy link
Member Author

@StephanTLavavej Can you take a look at the readme.md changes?

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
- task: BatchScript@1
inputs:
filename: 'ado/enforce-clang-format.cmd'
failOnStandardError: true
Copy link
Member

Choose a reason for hiding this comment

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

Can you add a newline to the end of this file?

azure-pipelines.yml Show resolved Hide resolved
@@ -0,0 +1,4 @@
@echo off
Copy link
Member

Choose a reason for hiding this comment

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

Please add our license banner as a comment.

@@ -0,0 +1,4 @@
@echo off
clang-format -style=file -i stl/inc/** stl/src/** 2>&1
Copy link
Member

Choose a reason for hiding this comment

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

These ** double stars are interesting; who is parsing them? According to my understanding, this is not cmd syntax.

Copy link
Member

Choose a reason for hiding this comment

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

Same: Billy replied to my comment that clang-format parses them.

Copy link
Member

Choose a reason for hiding this comment

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

...judging from later changes, that must not have been the case. @BillyONeal?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep!

@@ -0,0 +1,4 @@
@echo off
clang-format -style=file -i stl/inc/** stl/src/** 2>&1
Copy link
Member

Choose a reason for hiding this comment

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

How do we know what version of clang-format is being used? Where does it come from?

Copy link
Member Author

Choose a reason for hiding this comment

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

It comes from "that's how Billy set up the hardware this task runs on". I'm going to put the list of what I did on the wiki.

Copy link
Member Author

Choose a reason for hiding this comment

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

@@ -0,0 +1,4 @@
@echo off
Copy link
Member

Choose a reason for hiding this comment

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

I suspect that we shouldn't abbreviate Azure DevOps to ado, even in the directory tree.

README.md Outdated
@@ -31,7 +31,9 @@ soon as possible.)
* Tests: **Coming soon.** We rely on three test suites: devcrt, tr1, and [libcxx][]. We need to replace our current test
harness, which extensively uses Microsoft-internal machinery.

* Continuous Integration: **Coming soon.** We need tests first.
* Continuous Integration: **In progress.** We have set up Azure Pipelines to validate changes of the repository.
However, that infrastructure still requires manual review before building community submitted pull requests, as we
Copy link
Member

Choose a reason for hiding this comment

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

Should probably hyphenate community-submitted as a compound adjective.

Copy link
Member Author

Choose a reason for hiding this comment

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

You and Casey think alike.

README.md Outdated
@@ -31,7 +31,9 @@ soon as possible.)
* Tests: **Coming soon.** We rely on three test suites: devcrt, tr1, and [libcxx][]. We need to replace our current test
harness, which extensively uses Microsoft-internal machinery.

* Continuous Integration: **Coming soon.** We need tests first.
* Continuous Integration: **In progress.** We have set up Azure Pipelines to validate changes to the repository.
Copy link
Member

Choose a reason for hiding this comment

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

Nitpick: "We've" would be more consistent with the tone elsewhere. Similarly, "haven't yet hardened it".

azure-devops/enforce-clang-format.cmd Show resolved Hide resolved
:: Copyright (c) Microsoft Corporation.
:: SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
clang-format -style=file -i stl/inc/* stl/inc/cvt/* stl/inc/experimental/* stl/src/* 2>&1
echo If your build fails here, you need to format the following files with clang-format 8.0.1
Copy link
Member

Choose a reason for hiding this comment

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

End with a period?

@@ -0,0 +1,12 @@
#
Copy link
Member

Choose a reason for hiding this comment

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

I think the leading and trailing # should be dropped, and instead separated with a newline - unless there is some auto-formatter fighting against this.

inputs:
filename: 'azure-devops/enforce-clang-format.cmd'
failOnStandardError: true
displayName: 'Verify clang-format'
Copy link
Member

Choose a reason for hiding this comment

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

Enforce, or verify? Terminology should be consistent. ALL SHALL LOVE CLANG-FORMAT AND DESPAIR.

@microsoft microsoft deleted a comment from BillyONeal Sep 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GitHub: PR system should enforce clang-format rules
3 participants