introduces PUBLISHMETA build step, attempt to pass travis job id

This commit is contained in:
Paul Rogalinski 2015-04-01 16:00:42 +02:00
parent 50fcb3b235
commit 96a8004934
3 changed files with 44 additions and 12 deletions

View File

@ -1,34 +1,46 @@
#!/bin/bash #!/bin/bash
# A hacky way of running the unit tests at the same time as the normal builds. # A hacky way of running the unit tests at the same time as the normal builds.
REVISION=$(git rev-parse --short HEAD)
BRANCH=$(git rev-parse --abbrev-ref HEAD)
REVISION=$(git rev-parse --short HEAD)
LAST_COMMIT_DATE=$(git log -1 --date=short --format="%cd")
TARGET_FILE=obj/cleanflight_${TARGET}
if [ $RUNTESTS ] ; then if [ $RUNTESTS ] ; then
cd ./src/test && make test cd ./src/test && make test
elif [ $PUBLISHMETA ] && [ $PUBLISH_URL ] ; then
RECENT_COMMITS=$(git shortlog -n25)
echo publishing
curl \
--form "recent_commits=${RECENT_COMMITS}" \
--form "revision=${REVISION}" \
--form "branch=${BRANCH}" \
--form "last_commit_date=${LAST_COMMIT_DATE}" \
--form "travis_job_id=${TRAVIS_JOB_ID}" \
${PUBLISH_URL}
else else
if [ $PUBLISH_URL ] ; then if [ $PUBLISH_URL ] ; then
make -j2 make -j4
BRANCH=$(git rev-parse --abbrev-ref HEAD)
REVISION=$(git rev-parse --short HEAD)
RECENT_COMMITS=$(git shortlog -n25)
TARGET_FILE=obj/cleanflight_${TARGET}
if [ -f ${TARGET_FILE}.bin ]; if [ -f ${TARGET_FILE}.bin ] ; then
then
TARGET_FILE=${TARGET_FILE}.bin TARGET_FILE=${TARGET_FILE}.bin
elif [ -f ${TARGET_FILE}.hex ]; elif [ -f ${TARGET_FILE}.hex ] ; then
then
TARGET_FILE=${TARGET_FILE}.hex TARGET_FILE=${TARGET_FILE}.hex
else else
echo "build artifact (hex or bin) for ${TARGET_FILE} not found, aborting"; echo "build artifact (hex or bin) for ${TARGET_FILE} not found, aborting";
exit 1 exit 1
fi fi
curl \ curl \
--form "file=@${TARGET_FILE}" \ --form "file=@${TARGET_FILE}" \
--form "revision=${REVISION}" \ --form "revision=${REVISION}" \
--form "branch=${BRANCH}" \ --form "branch=${BRANCH}" \
--form "recent_commits=${RECENT_COMMITS}" ${PUBLISH_URL} --form "last_commit_date=${LAST_COMMIT_DATE}" \
--form "travis_job_id=${TRAVIS_JOB_ID}" \
${PUBLISH_URL}
else else
make -j2 make -j2
fi fi
fi fi

View File

@ -1,5 +1,6 @@
env: env:
- RUNTESTS=True - RUNTESTS=True
- PUBLISHMETA=True
- TARGET=CC3D - TARGET=CC3D
- TARGET=CC3D OPBL=yes - TARGET=CC3D OPBL=yes
- TARGET=CHEBUZZF3 - TARGET=CHEBUZZF3

19
fake_travis_build.sh Executable file
View File

@ -0,0 +1,19 @@
#!/bin/bash
targets=("PUBLISHMETA=True" "RUNTESTS=True" \
"TARGET=CC3D" "TARGET=CC3D OPBL=yes" "TARGET=CHEBUZZF3" "TARGET=CJMCU" \
"TARGET=EUSTM32F103RC" "TARGET=SPRACINGF3" "TARGET=NAZE" "TARGET=NAZE32PRO" \
"TARGET=OLIMEXINO" "TARGET=PORT103R" "TARGET=SPARKY" "TARGET=STM32F3DISCOVERY" \
"TARGET=ALIENWIIF1" "TARGET=ALIENWIIF3")
export TRAVIS_JOB_ID=$(date +%s)
for target in "${targets[@]}"
do
unset RUNTESTS PUBLISHMETA TARGET OPBL
eval "export $target"
make clean
./.travis.sh
done