Skip to content

Commit

Permalink
AppVeyor artifact collection
Browse files Browse the repository at this point in the history
  • Loading branch information
wouterdevinckbarco authored and wouterdevinck committed May 24, 2018
1 parent 7dabb9e commit 2190bdd
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 18 deletions.
19 changes: 12 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
sudo: false
language: bash
services:
- docker
- docker
os:
- linux
- linux
script:
- make
- make
- "./make/get-simulator-from-appveyor.sh $APPVEYOR_TOKEN `git describe --tags --dirty`"
deploy:
provider: releases
api_key:
secure: GZ0x6DvKDX89P/U7d3OQbvm0ZTU7SjgsY8gLyh6idr60hz+R1qxgo8jn2kGuvKMYdq5OBtNz5fygEM7jjJIxbXGXbD+KFz7ynj8anXKIUi+LINUhIP7vtx0dm8ETKVwi+AUVTyAijlbbzYM0YbuM4na0D2wDPB2Am53R/bOccOJn4H1DEhHHXEX8NmrwP9ke7yikkdnCGG6+E/9R5X7YBt5xEueUd57na3ioM5N20r7f4kIePF/o5OmGcADUYvvig8H55oNZEYtKrnO+/+R6pBAzYCRrIF8dsm2m8QH/fihlryHJexdGtyw1UtvKD8V5d6+gllcR09uSoGZp/eyC25gX/bGP7uruqn/cWOm0l5hRXSb4q+M8zDFJPDvYLYRlTidBfKvwRAO206ExeWFvBzTtvxKvpQozt1nUv04Rg6EKalJNfCQqPryKMdrN4RDa/5z5MuVL5eisrIA9g31q++nj49Kf4SNxxYMaILZQxuYly5uR3SzDOWzONpOn9Pl8nGdF4/qOnxYRI+vD11nPc/bcVwdji/xO0hfWRO+46J9+QVC722+QvgWeeKQ/pwLU9UjuzYvlK1mA5dkcTcN1h4r+LPKs7ADlGX0F6f5Q3qU2qQsh933mcaFFyfxzLleta02vDXk2ge7FdnSQVXSDtzjBAf1/3QUvE0xfZ5PoNP0=
file:
- "out/factory/bootloader.bin"
- "out/factory/partitions.bin"
- "out/factory/lamp.bin"
- out/factory/bootloader.bin
- out/factory/partitions.bin
- out/factory/lamp.bin
- out/simulator/simulator.zip
skip_cleanup: true
on:
tags: true
tags: true
env:
global:
secure: njJX1olFqCc9+2Yg7vtfd0rj7+Kv51EJ/hGghQ4LhEjuZwsmVRqARNTQkOMieNGoKU4jFspGUJt0PgwToruv7coyUSW3dLwTt4rqrCJpyB8jr4I665ubjnAou97JuF/JwesrnE/GgykvC9pCXrMbYP96iwqI7mALV7bX1XrTVzbjBxUoW8CMPSqiyOLAGQjfJJukSqK17A1tTTuamf7AhKwWJdtWxuxgobXFJzcrJ6CrKwsowVb47MVDI1p4KjLU5S7lKE0a841oHWzPoTOr9ALU+XchZRsztAzZMbVbQVpyOX+YU2NbJeyJ4TQ4Tq49tvNypa+Dntoe60g4UaneejVMNBkXo6siatpe6zDvWqm8c8axu1bVi8G72ZC27YHI46tk6K9e+whJkj+S7S8s/y2A7qsF+p+hfJi9rrGbErVMmh29PwnRR7bPXcFzmDfl2iVuXJ9jkTXPiQSsiQq+Bo+QVbrkB6Aa4bbUiS80oCY3V/IJMOJcdlyjNR3d5CE0YhFXs6awA2a0Sw0nwaW0XF+6qw/eMyamB/+/rdn5mndqg8c0185faJEx/bI3LCMeYIegLE2nad1ICSHaRWf08+8QHGWg2lU/rm+OSTHMIpRpFGJfZ67h3sgfqVH/J/aX3ZLRVQmsfhuRrePx3XJBwTbjFju3Yj4Di/aJnXyxSiI=
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ image: Visual Studio 2017
configuration: Release
before_build:
- ps: >-
$Version = git describe --tags --dirty
$Version = git describe --tags --dirty;
Update-AppveyorBuild -Version $Version
build:
project: test\simulator\Lamp.sln
Expand Down
47 changes: 37 additions & 10 deletions make/get-simulator-from-appveyor.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,47 @@
#!/bin/bash

# TODO get from arguments and check
TOKEN=xx
VERSION=0.1.0-5-g9675350
set -e

BASEURL=https://ci.appveyor.com/api
PROJECT=wouterdevinck/lamp
ARTIFACTSRC=test%2Fsimulator%2FLamp.Simulator%2Fbin%2Fsimulator.zip
ARTIFACT=simulator.zip
ARTIFACTDIR=out/simulator
ARTIFACT=$ARTIFACTDIR/simulator.zip

if [ "$#" -ne 2 ]; then
echo "Usage: ./get-simulator-from-appveyor.sh <token> <version>"
exit 2
fi

# TODO: while null (with timeout?), then check for success or fail
TOKEN=$1
VERSION=$2

RESPONSE=`curl -H "Authorization: Bearer $TOKEN" -H "Accept: application/json" -X GET $BASEURL/projects/$PROJECT/build/$VERSION`
i="0"
STATUS="null"

echo $RESPONSE | jq -r .build.status
while [[ $i -lt 300 && "$STATUS" = "null" ]]
do
echo "[INFO] AppVeyor: checking build status"
RESPONSE=`curl -s -H "Authorization: Bearer $TOKEN" \
-H "Accept: application/json" \
-X GET $BASEURL/projects/$PROJECT/build/$VERSION`
STATUS=`echo $RESPONSE | jq -r .build.status`
i=$[$i+1]
sleep 1s
done

echo $RESPONSE | jq -r .build.jobs[0].jobId`
if [ "$STATUS" = "null" ]
then
echo "[ERROR] AppVeyor: timeout!"
exit 2
fi

wget $BASEURL/buildjobs/$JOBID/artifacts/$ARTIFACTSRC -O $ARTIFACT
if [ "$STATUS" = "success" ]
then
JOBID=`echo $RESPONSE | jq -r .build.jobs[0].jobId`
echo "[INFO] AppVeyor: downloading artifacts"
mkdir -p $ARTIFACTDIR
wget $BASEURL/buildjobs/$JOBID/artifacts/$ARTIFACTSRC -O $ARTIFACT
else
echo "[ERROR] AppVeyor: build failed"
exit 2
fi

0 comments on commit 2190bdd

Please sign in to comment.