Skip to content

Commit

Permalink
ci: added artifact deployment
Browse files Browse the repository at this point in the history
readme: add link to builds page
  • Loading branch information
JaCzekanski committed Jul 31, 2019
1 parent 673b01a commit b097849
Show file tree
Hide file tree
Showing 7 changed files with 85 additions and 24 deletions.
21 changes: 17 additions & 4 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ environment:
TOOLSET: vs2017
platform: x64

# TODO: Move to PowerShell script
before_build:
- git submodule update --init --recursive

Expand All @@ -43,12 +44,19 @@ configuration:
build:
project: avocado.sln

# TODO: Move to PowerShell script
after_build:
# Premake renames x86 to Win32 - undo that
- ps: if ($env:platform -eq "Win32") { $env:platform = "x86" }
- ps: if ($env:platform -eq "Win32") { $env:OS = "windows32" }
- ps: if ($env:platform -eq "x64") { $env:OS = "windows64" }
- ps: $env:DATE=date +%Y%m%d
- ps: $env:COMMIT=git rev-parse --short=7 HEAD
- ps: $env:ARTIFACT="avocado-$($env:OS)-$($env:DATE)-$($env:COMMIT).zip"

- mkdir artifact

# Premake renames x86 to Win32 - undo that
- ps: if ($env:platform -eq "Win32") { $env:platform = "x86" }

# copy avocado.exe, SDL2.dll and data directory
- ps: $env:TARGETDIR = "build\$($env:CONFIGURATION)"
- ps: if ($env:platform -ne "x86") { $env:TARGETDIR = $env:TARGETDIR + "_" + $env:platform }
Expand All @@ -57,13 +65,15 @@ after_build:
- ps: Copy-Item externals\SDL2\lib\$env:platform\SDL2.dll artifact\SDL2.dll
- ps: Copy-Item data artifact\ -recurse

# remove .gitignore and asm directory
# remove .gitignore
- ps: Get-ChildItem -Path artifact\data -Include *.gitignore -Recurse | foreach { $_.Delete()}
- ps: Remove-Item artifact\data\asm\ -recurse

# make zip archive
- 7z a avocado.zip %APPVEYOR_BUILD_FOLDER%\artifact\.

- mkdir upload
- ps: Copy-Item avocado.zip -Destination upload/$env:ARTIFACT

test_script:
- .\%TARGETDIR%\avocado_test.exe --success -r junit > test-result.xml || ver > nul

Expand All @@ -81,3 +91,6 @@ on_failure:
artifacts:
- path: avocado.zip
name: avocado

deploy_script:
- bash ./.travis/deploy.sh %DEPLOY_KEY% upload/
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/q4xr3y8QnlBSUAUtXjdJ2KOzu8uYpPzBrNnFdHJBxENq7u+G+5A=
access_key_id:
secure: PK4Fr5SfsLBo9bIM2gp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2XdkIM+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
49 changes: 49 additions & 0 deletions .travis/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/bash -e

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

URL=https://avocado-builds.czekanski.info/api/upload
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

BRANCH=""
if [[ ! -z "${TRAVIS_BRANCH}" ]]; then
BRANCH=$TRAVIS_BRANCH
elif [[ ! -z "${APPVEYOR_REPO_BRANCH}" ]]; then
BRANCH=$APPVEYOR_REPO_BRANCH
else
echo "TRAVIS_BRANCH or APPVEYOR_REPO_BRANCH env not found"
exit 3
fi

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

curl -X POST \
-H "Authorization: Bearer $1" \
-H "X-Commit-Revision: $REVISION" \
-H "X-Commit-Branch: $BRANCH" \
-H "X-Commit-Author: $AUTHOR" \
-H "X-Commit-Message: $MESSAGE" \
-H "X-Commit-Date: $DATE" \
$FILES $URL \
&& echo Upload successful \
|| echo Upload failed
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
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,13 @@ See [Avocado compatibility list](https://avocado-db.czekanski.info)

## Status

Full list: [Avocado Builds](https://avocado-builds.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/linux64)](https://travis-ci.org/JaCzekanski/Avocado) | [develop](https://avocado-builds.czekanski.info/latest/linux64)
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 b097849

Please sign in to comment.