Skip to content

Commit

Permalink
Add formatting job on CI (#3420)
Browse files Browse the repository at this point in the history
Add formatting job on CI
  • Loading branch information
taketwo authored Oct 17, 2019
2 parents 076efc1 + e42ecad commit a8f6435
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 2 deletions.
31 changes: 31 additions & 0 deletions .ci/azure-pipelines/formatting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
resources:
containers:
- container: fmt
image: pointcloudlibrary/fmt

jobs:
- job: formatting
displayName: Check code formatting
pool:
vmImage: 'Ubuntu 16.04'
container: fmt
steps:
- script: ./.dev/format.sh $(which clang-format-8) .
displayName: 'Run clang-format'
- script: git diff > formatting.patch
displayName: 'Compute diff'
- script: cat formatting.patch
displayName: 'Show diff'
- task: CopyFiles@2
inputs:
sourceFolder: '$(Build.SourcesDirectory)'
contents: 'formatting.patch'
targetFolder: '$(Build.ArtifactStagingDirectory)'
displayName: 'Copy diff to staging directory'
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: formatting
displayName: 'Publish diff'
- script: "[ ! -s formatting.patch ]"
displayName: 'Set job exit status'
2 changes: 1 addition & 1 deletion .dev/format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

format() {
# don't use a directory with whitespace
local whitelist="2d cuda gpu ml simulation stereo tracking"
local whitelist="2d ml simulation stereo"

local PCL_DIR="${2}"
local formatter="${1}"
Expand Down
2 changes: 1 addition & 1 deletion cmake/clang-format.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
find_package(ClangFormat 6)
find_package(ClangFormat 7)
# search for version number in clang-format without version number
if(ClangFormat_FOUND)
message(STATUS "Adding target 'format'")
Expand Down

0 comments on commit a8f6435

Please sign in to comment.