Skip to content

Commit

Permalink
ci: added artifact deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
JaCzekanski committed Jul 29, 2019
1 parent a70c382 commit 79b15f7
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 20 deletions.
16 changes: 8 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@ matrix:
script: "./.travis/macos/build.sh"
after_success: "./.travis/notify-discord.sh success $WEBHOOK_URL"
after_failure: "./.travis/notify-discord.sh failure $WEBHOOK_URL"

notifications:
- email: false

deploy:
provider: s3
bucket: "avocado-build"
region: us-east-2
local_dir: upload
provider: script
script: "./.travis/deploy.sh $DEPLOY_KEY upload/*"
skip_cleanup: true
on:
all_branches: true
secret_access_key:
secure: A+A/qeIsqVp8YlYCqo19TDXmFaGHYzjaMLNmILPtK+D1o5mjlG4DyTQTgCi3nESu/I+2aBhHTbhJX+JSabX/pogGtGJSnfLd8VmxSNSvCBd6pZ2pczjQoC4ufeR87LjAS63JnGZLIBORDY6o+bKUrs1kLQclEfCeieH5sBW/1Em0Ec1amY3uKZP6MA1biaI3iSRbRGzCisWdjcIpF6vOILiG3w4Xpx+hTMSJPn72/kd3dVilHGyWnQkZDYbj6LB5CT4p42xnbM3B5HkBvykYeeqQSskVqM0y1gtTF/3JmjVnW4jB7pUQVpfCyzEOF23zQkoivlwBpMJBpcTa2fYfcjb0vDPu8ELtg5IZ1WPXyXCh/IAXkD0qTUjuNjlYHVNIUlWj2FXevyLUxDoBAgPA+4POkt9p6072gIATBPrd9Ajr48yDrYLVG41AWUT9FNUW5FHZaBsg6sJSEwMkBjpyQFp9+2ufgMTrcBIMFayDXLpvZGPy4uyS4Iu/Lts5KkG780DYva7kKZwxmpo5tlVwn11ndaYwgd9H2a+wgPGmw/1yAkWocV6XS7dq5cl7jcOJ6AmqtCyqixxtQk6zK7ylmwPuV3YGsOltgLJ5sA4g4G/9849HYKAs4Tv/q4xr3y8QnlBSUAUtXjdJ2KOzu8uYpP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ar5IIeVbNMTK+CJ2ljVQtEardN6OGAvhgsFzCsiQ5AADz4bxqzgtQ2XdkIM+1N9j6nbTxK4B14veM0J1/IrMO/TzV/lZ2GcHqrxiSlj+NBu68ov/i6GvyCqOQ/5H6MVybKyFWIr9i4N5R6Vp+1eugRzo7lsA7NesZeW7Y4Kz5g0rNoalP/GEmVc549wpU9eHFJAhcjiYJF0lPdJPsmZnlNXa+LS1oJFC6972+fK0GSru5fX8qlJALG0kSpygiZR8dq/q1pEVRKtIz1uvIOY526GqEeIfch39Bp0hMCqhJ/AQfXTSzFTwJtnCo0lZO7lNPifwkJ8PHn1WTLI=
5 changes: 2 additions & 3 deletions .travis/android/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ export COMMIT=`git rev-parse --short=7 HEAD`
export ARTIFACT=avocado-$OS-$DATE-$COMMIT.apk
export ASSETS_DIR=android/app/src/main/assets
export TARGET_DIR=android/app/build/outputs/apk/debug
export UPLOAD_DIR=$DATE-$COMMIT
export NDK_CCACHE="$(which ccache)"

# Configure cache
Expand Down Expand Up @@ -37,5 +36,5 @@ popd
# No test suite for Android right now

# Package and prepare upload artifact
mkdir -p upload/$UPLOAD_DIR
cp $TARGET_DIR/app-debug.apk upload/$UPLOAD_DIR/$ARTIFACT
mkdir -p upload
cp $TARGET_DIR/app-debug.apk upload/$ARTIFACT
36 changes: 36 additions & 0 deletions .travis/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash -e

if [ "$#" -ne 2 ]; then
echo "usage: $0 <API_KEY> <FILE>"
exit 1
fi

FILES=""

if [ -f "$2" ]; then
FILES="-F file=@\"$2\""
elif [ -d "$2" ]; then
for entry in "$2"/*; do
# skip dirs
[ -f "$entry" ] || continue

FILES="$FILES -F file[]=@\"$entry\""
done
else
echo "$2 does not exist"
exit 2
fi

REVISION="$(git rev-parse --short=7 HEAD)"
AUTHOR="$(git log -1 "$REVISION" --pretty="%aN")"
DATE="$(git log -1 "$REVISION" --pretty="%aI")"
MESSAGE="$(git log -1 "$REVISION" --pretty="%s")"

curl -X POST \
-H "Authorization: Bearer $1" \
-H "X-Commit-Revision: $REVISION" \
-H "X-Commit-Author: $AUTHOR" \
-H "X-Commit-Date: $DATE" \
-H "X-Commit-Message: $MESSAGE" \
$FILES -L \
https://avocado-builds.czekanski.info/api/upload
5 changes: 2 additions & 3 deletions .travis/linux/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ export OS=linux64
export DATE=`date +%Y%m%d`
export COMMIT=`git rev-parse --short=7 HEAD`
export ARTIFACT=avocado-$OS-$DATE-$COMMIT
export UPLOAD_DIR=$DATE-$COMMIT
export CC="ccache clang-6.0 -fcolor-diagnostics"
export CXX="ccache clang++-6.0 -fcolor-diagnostics"

Expand Down Expand Up @@ -39,5 +38,5 @@ cp -r data $ARTIFACT/
# Remove .gitignore
find $ARTIFACT -type f -name .gitignore -exec rm {} \;

mkdir -p upload/$UPLOAD_DIR
tar -zcf upload/$UPLOAD_DIR/$ARTIFACT.tar.gz $ARTIFACT
mkdir -p upload
tar -zcf upload/$ARTIFACT.tar.gz $ARTIFACT
5 changes: 2 additions & 3 deletions .travis/macos/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ export OS=macos
export DATE=`date +%Y%m%d`
export COMMIT=`git rev-parse --short=7 HEAD`
export ARTIFACT=avocado-$OS-$DATE-$COMMIT
export UPLOAD_DIR=$DATE-$COMMIT

# Configure cache
brew install ccache
Expand All @@ -28,5 +27,5 @@ cp -r data $ARTIFACT/avocado.app/Contents/Resources
find $ARTIFACT -type f -name .gitignore -exec rm {} \;

# Prepare upload artifact
mkdir -p upload/$UPLOAD_DIR
zip -r upload/$UPLOAD_DIR/$ARTIFACT.zip $ARTIFACT
mkdir -p upload
zip -r upload/$ARTIFACT.zip $ARTIFACT
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ See [Avocado compatibility list](https://avocado-db.czekanski.info)

Build | Status | Download
--------|--------|---------
Travis CI (Linux) | [![Build Status](https://travis-ci.org/JaCzekanski/Avocado.svg?branch=develop)](https://travis-ci.org/JaCzekanski/Avocado)
Travis CI (macOS) | [![Build Status](https://travis-ci.org/JaCzekanski/Avocado.svg?branch=develop)](https://travis-ci.org/JaCzekanski/Avocado) | Comming soon ...
Travis CI (Android) | [![Build Status](https://travis-ci.org/JaCzekanski/Avocado.svg?branch=develop)](https://travis-ci.org/JaCzekanski/Avocado) | Comming soon ...
Travis CI (Linux) | [![Build Status](https://avocado-builds.czekanski.info/status/linux)](https://travis-ci.org/JaCzekanski/Avocado) |
Travis CI (macOS) | [![Build Status](https://avocado-builds.czekanski.info/status/macos)](https://travis-ci.org/JaCzekanski/Avocado) | [develop](https://avocado-builds.czekanski.info/latest/macos)
Travis CI (Android) | [![Build Status](https://avocado-builds.czekanski.info/status/android)](https://travis-ci.org/JaCzekanski/Avocado) | [develop](https://avocado-builds.czekanski.info/latest/android)
AppVeyor (Windows 64-bit, Visual Studio 2019) | [![Build status](https://ci.appveyor.com/api/projects/status/h1cs3bj1vhskjxgx/branch/develop?svg=true)](https://ci.appveyor.com/project/JaCzekanski/avocado/branch/develop) | **[develop](https://ci.appveyor.com/api/projects/JaCzekanski/avocado/artifacts/avocado.zip?branch=develop&job=Environment%3A+APPVEYOR_BUILD_WORKER_IMAGE%3DVisual+Studio+2019+Preview%2C+TOOLSET%3Dvs2017%2C+platform%3Dx64)**
AppVeyor (Windows 32-bit, Visual Studio 2019) | [![Build status](https://ci.appveyor.com/api/projects/status/h1cs3bj1vhskjxgx/branch/develop?svg=true)](https://ci.appveyor.com/project/JaCzekanski/avocado/branch/develop) | [develop](https://ci.appveyor.com/api/projects/JaCzekanski/avocado/artifacts/avocado.zip?branch=develop&job=Environment%3A+APPVEYOR_BUILD_WORKER_IMAGE%3DVisual+Studio+2019+Preview%2C+TOOLSET%3Dvs2017%2C+platform%3DWin32)
AppVeyor (Windows 64-bit, Visual Studio 2017) | [![Build status](https://ci.appveyor.com/api/projects/status/h1cs3bj1vhskjxgx/branch/develop?svg=true)](https://ci.appveyor.com/project/JaCzekanski/avocado/branch/develop) | [develop](https://ci.appveyor.com/api/projects/JaCzekanski/avocado/artifacts/avocado.zip?branch=develop&job=Environment%3A+APPVEYOR_BUILD_WORKER_IMAGE%3DVisual+Studio+2017%2C+TOOLSET%3Dvs2017%2C+platform%3Dx64)
Expand Down

0 comments on commit 79b15f7

Please sign in to comment.