mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-07-14 18:48:10 +00:00
travis: trigger build of trezor-core when python-trezor is pushed
This commit is contained in:
parent
43f14ac760
commit
6c033bd810
@ -36,6 +36,9 @@ install:
|
|||||||
- export PATH="$(pwd)/protoc/bin:$PATH"
|
- export PATH="$(pwd)/protoc/bin:$PATH"
|
||||||
- pip install "protobuf == ${PROTOBUF_VERSION}"
|
- pip install "protobuf == ${PROTOBUF_VERSION}"
|
||||||
|
|
||||||
|
before_script:
|
||||||
|
- ./trigger-travis.sh
|
||||||
|
|
||||||
script:
|
script:
|
||||||
# check that generated protobuf messages are identical to in-tree ones
|
# check that generated protobuf messages are identical to in-tree ones
|
||||||
- ./tools/build_protobuf messages.tmp && diff -ur messages.tmp trezorlib/messages && rm -r messages.tmp
|
- ./tools/build_protobuf messages.tmp && diff -ur messages.tmp trezorlib/messages && rm -r messages.tmp
|
||||||
|
52
trigger-travis.sh
Executable file
52
trigger-travis.sh
Executable file
@ -0,0 +1,52 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# adapted from https://github.com/stephanmg/travis-dependent-builds
|
||||||
|
|
||||||
|
# variables
|
||||||
|
USER=trezor
|
||||||
|
REPO=trezor-core
|
||||||
|
BRANCH=master
|
||||||
|
SOURCE=trezor/python-trezor
|
||||||
|
|
||||||
|
if [ "$TRAVIS_REPO_SLUG" != "$SOURCE" ]; then
|
||||||
|
echo "not triggering from $TRAVIS_REPO_SLUG"
|
||||||
|
exit 0;
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$TRAVIS_PULL_REQUEST" != "false"]; then
|
||||||
|
echo "not triggering from pull requests"
|
||||||
|
exit 0;
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$TRAVIS_JOB_NUMBER" != *.1 ]]; then
|
||||||
|
echo "not triggering for job number $TRAVIS_JOB_NUMBER (not first job in set)"
|
||||||
|
exit 0;
|
||||||
|
fi
|
||||||
|
|
||||||
|
MESSAGE=",\"message\": \"Triggered from upstream build of $TRAVIS_REPO_SLUG by commit "`git rev-parse --short HEAD`"\""
|
||||||
|
|
||||||
|
# curl POST request content body
|
||||||
|
BODY="{
|
||||||
|
\"request\": {
|
||||||
|
\"branch\":\"$BRANCH\"
|
||||||
|
$MESSAGE
|
||||||
|
}}"
|
||||||
|
|
||||||
|
echo "attempting to trigger build of $USER/$REPO"
|
||||||
|
# make a POST request with curl (note %2F could be replaced with
|
||||||
|
# / and additional curl arguments, however this works too!)
|
||||||
|
curl -s -X POST \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-H "Accept: application/json" \
|
||||||
|
-H "Travis-API-Version: 3" \
|
||||||
|
-H "Authorization: token ${TRAVIS_TOKEN}" \
|
||||||
|
-d "$BODY" \
|
||||||
|
https://api.travis-ci.org/repo/${USER}%2F${REPO}/requests \
|
||||||
|
| tee /tmp/travis-request-output.$$.txt
|
||||||
|
|
||||||
|
if grep -q '"@type": "error"' /tmp/travis-request-output.$$.txt; then
|
||||||
|
cat /tmp/travis-request-output.$$.txt
|
||||||
|
exit 1
|
||||||
|
elif grep -q 'access denied' /tmp/travis-request-output.$$.txt; then
|
||||||
|
cat /tmp/travis-request-output.$$.txt
|
||||||
|
exit 1
|
||||||
|
fi
|
Loading…
Reference in New Issue
Block a user