-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Travis: Build new binding pull requests with tests #5389
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
e9a0be2
Travis: Build new binding pull requests with tests
a24a822
Move shell script into own file and keep the yaml file for the config…
c7fb80b
Overwrite travis default behaviour
9934de1
Some finetuning to filter out download progress and include all warni…
martinvw 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 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 |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
.DS_Store | ||
*.iml | ||
npm-debug.log | ||
.build.log | ||
|
||
.metadata/ | ||
bin/ | ||
|
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,59 @@ | ||
#!/bin/bash | ||
|
||
function prevent_timeout() { | ||
local i=0 | ||
while [ -e /proc/$1 ]; do | ||
# print zero width char every 3 minutes while building | ||
if [ "$i" -eq "180" ]; then printf %b '\u200b'; i=0; else i=$((i+1)); fi | ||
sleep 1 | ||
done | ||
} | ||
|
||
function print_reactor_summary() { | ||
sed -ne '/\[INFO\] Reactor Summary:/,$ p' "$1" | sed 's/\[INFO\] //' | ||
} | ||
|
||
function mvnp() { | ||
set -o pipefail # exit build with error when pipes fail | ||
local command=(mvn $@) | ||
exec "${command[@]}" 2>&1 | # execute, redirect stderr to stdout | ||
stdbuf -o0 grep -vE "Download(ed|ing) from [a-z.]+: https:" | # filter out downloads | ||
tee .build.log | # write output to log | ||
stdbuf -oL grep -E '^\[INFO\] Building .+ \[.+\]$' | # filter progress | ||
stdbuf -o0 sed -uE 's/^\[INFO\] Building (.*[^ ])[ ]+\[([0-9]+\/[0-9]+)\]$/\2| \1/' | # prefix project name with progress | ||
stdbuf -o0 sed -e :a -e 's/^.\{1,6\}|/ &/;ta' & # right align progress with padding | ||
local pid=$! | ||
prevent_timeout $pid & | ||
wait $pid | ||
} | ||
|
||
# Determine if this is a new addon -> Perform tests + integration tests and all SAT checks with increased warning level | ||
CHANGED_DIR=`git diff --diff-filter=A --dirstat=files,0 master...HEAD bundles/ | sed 's/^[ 0-9.]\+% bundles\///g' | grep -o -P "^([^/]*)" | uniq` | ||
CDIR=`pwd` | ||
|
||
if [ ! -z "$CHANGED_DIR" ] && [ -e "bundles/$CHANGED_DIR" ]; then | ||
echo "New addon pull request: Building $CHANGED_DIR" | ||
echo "MAVEN_OPTS='-Xms1g -Xmx2g -Dorg.slf4j.simpleLogger.log.org.openhab.tools.analysis.report.ReportUtility=DEBUG -Dorg.slf4j.simpleLogger.defaultLogLevel=WARN'" > ~/.mavenrc | ||
cd "bundles/$CHANGED_DIR" | ||
mvn clean install -B 2>&1 | | ||
stdbuf -o0 grep -vE "Download(ed|ing) from [a-z.]+: https:" | # Filter out Download(s) | ||
stdbuf -o0 grep -v "target/code-analysis" | # filter out some debug code from reporting utility | ||
tee $CDIR/.build.log | ||
if [ -e "../itests/$CHANGED_DIR" ]; then | ||
echo "New addon pull request: Building itest $CHANGED_DIR" | ||
cd "../itests/$CHANGED_DIR" | ||
mvn clean install -B 2>&1 | | ||
stdbuf -o0 grep -vE "Download(ed|ing) from [a-z.]+: https:" | # Filter out Download(s) | ||
stdbuf -o0 grep -v "target/code-analysis" | # filter out some debug code from reporting utility | ||
tee -a $CDIR/.build.log | ||
fi | ||
else | ||
echo "Build all" | ||
echo "MAVEN_OPTS='-Xms1g -Xmx2g -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn'" > ~/.mavenrc | ||
mvnp clean install -B -DskipChecks=true -DskipTests=true | ||
if [ $? -eq 0 ]; then | ||
print_reactor_summary .build.log | ||
else | ||
tail -n 1000 .build.log | ||
fi | ||
fi |
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,22 @@ | ||
## Travis tests have failed | ||
Hey @{{pullRequestAuthor}}, | ||
please read the following log in order to understand the failure reason. There might also be some helpful tips along the way. | ||
It'll be awesome if you fix what's wrong and commit the changes. | ||
|
||
{{#jobs}} | ||
### {{displayName}} | ||
{{#scripts}} | ||
<details> | ||
<summary> | ||
<strong> | ||
Expand here | ||
</strong> | ||
</summary> | ||
|
||
``` | ||
{{&contents}} | ||
``` | ||
</details> | ||
<br /> | ||
{{/scripts}} | ||
{{/jobs}} |
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,21 @@ | ||
## Travis tests were successful | ||
Hey @{{pullRequestAuthor}}, | ||
we found no major flaws with your code. Still you might want to look at this logfile, as we usually suggest some optional improvements. | ||
|
||
{{#jobs}} | ||
### {{displayName}} | ||
{{#scripts}} | ||
<details> | ||
<summary> | ||
<strong> | ||
{{command}} | ||
</strong> | ||
</summary> | ||
|
||
``` | ||
{{&contents}} | ||
``` | ||
</details> | ||
<br /> | ||
{{/scripts}} | ||
{{/jobs}} |
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.
Should we also have a special build for people changing only files in a single module, now it only focuses on either new contributions or it does the complete build.