-
Notifications
You must be signed in to change notification settings - Fork 38
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
Jenkins Integration #186
Merged
Merged
Jenkins Integration #186
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
983791a
Adding Jenkinsfile for firmware
e187562
Updating jenkinsfile and adding lint script.
bfb75c4
Updating Jenkinsfile and test/Makefile to support junit test reports.
5161301
Updating clang_patch script to only check files modified by current PR
84586d8
Updating Jenkinsfile for coverage, adding comment to clang_patch bash…
5eb836e
Adding src/main.c to commit to verify linter
d99c8bf
Updating Jenkinsfile to track coverage results with Cobertura plugin.
d7aa9e3
Merge branch 'master' into jenkins_file
834bf4e
Fixing default LCOV_FILE in coverage.py script.
3309172
Updating coverage script to be more robust. Moving jenkins scripts to…
b2db5be
Updating Jenkinsfile to point to new script dir
e95a47e
Adding warning cflags to ci build to track more warnings with Jenkins.
9119a75
Updating clang_patch to compare to origin/master instead of local mas…
dd403f6
Adding headers to scripts and removing empty line from main.c
b1be82e
Lint error for Jenkins to catch
f00aef2
Fix lint issue, add unit test failure for Jenkins to catch
4ac7d07
Fixing unit test modification.
0003280
Fixing last lint error
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* Copyright (c) 2018-present, Facebook, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. An additional grant | ||
* of patent rights can be found in the PATENTS file in the same directory. | ||
*/ | ||
|
||
node { | ||
currentBuild.result = 'SUCCESS' | ||
withEnv(["UNITY_ROOT=$HOME/Unity", "TOOLCHAIN=$HOME/gcc-arm-none-eabi", "OCWARE_DIR=./"]) { | ||
stage('Checkout') { | ||
step([$class: 'WsCleanup']) | ||
echo 'Checking out SCM' | ||
checkout scm | ||
} | ||
|
||
try { | ||
stage('Static Analysis') { | ||
sh 'bash firmware/utilities/jenkins/clang_patch' | ||
} | ||
} catch (err) { | ||
currentBuild.result = 'ERROR' | ||
} finally { | ||
archiveArtifacts '**/clang_format.patch' | ||
} | ||
|
||
try { | ||
stage('Build and Unit Test') { | ||
dir ("firmware/ec"){ | ||
sh 'make ci' | ||
sh 'python3 ../utilities/jenkins/coverage.py' | ||
} | ||
} | ||
} catch (err) { | ||
currentBuild.result = 'FAILURE' | ||
} finally { | ||
warnings consoleParsers: [[parserName: 'GNU Make + GNU C Compiler (gcc)']] | ||
junit 'firmware/ec/test/build/results/unit-test-results.xml' | ||
step([$class: 'CoberturaPublisher', autoUpdateHealth: false, autoUpdateStability: false,\ | ||
coberturaReportFile: '**/test-coverage.xml', failUnhealthy: false, failUnstable: false,\ | ||
maxNumberOfBuilds: 0, onlyStable: false, sourceEncoding: 'ASCII', zoomCoverageChart: false]) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/bash | ||
# | ||
# Copyright (c) 2018-present, Facebook, Inc. | ||
# All rights reserved. | ||
# | ||
# This source code is licensed under the BSD-style license found in the | ||
# LICENSE file in the root directory of this source tree. An additional grant | ||
# of patent rights can be found in the PATENTS file in the same directory. | ||
|
||
# Get all files that are different from master and only lint those. | ||
fileList=`git --no-pager diff --name-only HEAD origin/master ./firmware/ec | grep ".\.c$\|.\.h$"` | ||
for f in $fileList; do | ||
clang-format -style=file -i ${f} | ||
done | ||
echo "Linting the following files:" | ||
echo $fileList | ||
git diff > clang_format.patch | ||
|
||
# Delete if 0 size and exit with 0 | ||
if [ ! -s clang_format.patch ] | ||
then | ||
exit 0 | ||
fi | ||
|
||
# There were lint issues and should exit with error | ||
exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
#!/usr/bin/env python3 | ||
# | ||
# Copyright (c) 2018-present, Facebook, Inc. | ||
# All rights reserved. | ||
# | ||
# This source code is licensed under the BSD-style license found in the | ||
# LICENSE file in the root directory of this source tree. An additional grant | ||
# of patent rights can be found in the PATENTS file in the same directory. | ||
|
||
"""" | ||
Script to convert lcov generated coverage data to Jenkins readable Cobertura | ||
XML coverage formatted data. | ||
""" | ||
|
||
import argparse | ||
import glob | ||
import os | ||
import sys | ||
from lcov_cobertura import LcovCobertura | ||
|
||
|
||
def main(args): | ||
# Auto set arguments if none were provided | ||
|
||
# If no sourcefile was provided, find the test-coverage.info file. | ||
# This assumes that the first file found is the desired one, so if multiple | ||
# exist then the sourceFile must be specified on the command line. | ||
if not args.sourceFile: | ||
f = glob.glob('**/test-coverage.info', recursive=True) | ||
if f: | ||
sourceFile = f[0] | ||
else: | ||
sys.exit("No lcov output file found below current directory.") | ||
else: | ||
sourceFile = args.sourceFile | ||
|
||
# If no output file was provided, then place it in the same directory as | ||
# the source file. | ||
if not args.outFile: | ||
outFile = os.path.dirname(sourceFile) + '/test-coverage.xml' | ||
else: | ||
outFile = args.outFile | ||
|
||
# Read all the data from the lcov output file | ||
with open(sourceFile) as fr: | ||
data = fr.read() | ||
|
||
# Create a converter and convert coverage data | ||
converter = LcovCobertura(data) | ||
res = converter.convert() | ||
|
||
# Write all output data to the destination file. | ||
with open(outFile, 'w') as fw: | ||
fw.write(res) | ||
|
||
if __name__ == "__main__": | ||
|
||
parser = argparse.ArgumentParser() | ||
|
||
# lcov data source file | ||
parser.add_argument( | ||
'-i', | ||
dest='sourceFile', | ||
action='store', | ||
default='', | ||
type=str, | ||
help='lcov data file to extract coverage information from. If not \ | ||
provided, will recursively search from cwd for test-coverage.info\ | ||
to use. If it finds multiple, will use the first one found', | ||
) | ||
|
||
# Output file name | ||
parser.add_argument( | ||
'-o', | ||
dest='outFile', | ||
action='store', | ||
default='', | ||
type=str, | ||
help='Name of file to write xml coverage data to. If not provided, will\ | ||
default to test-coverage.xml in the same directory as sourceFile', | ||
) | ||
|
||
main(parser.parse_args()) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we add some headers for all the new files