Skip to content

Commit

Permalink
compile from github branch, clean up cargo dep files
Browse files Browse the repository at this point in the history
  • Loading branch information
yeastplume committed Feb 15, 2019
1 parent 1f613c0 commit f65149c
Show file tree
Hide file tree
Showing 8 changed files with 247 additions and 143 deletions.
69 changes: 69 additions & 0 deletions .auto-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#!/bin/bash

repo_slug="mimblewimble/grin-wallet"
token="$GITHUB_TOKEN"
export CHANGELOG_GITHUB_TOKEN="$token"

tagname=`git describe --tags --exact-match 2>/dev/null || git symbolic-ref -q --short HEAD`

echo 'make a tarball for the release binary...\n'

if [[ $TRAVIS_OS_NAME == 'osx' ]]; then

# Do some custom requirements on OS X
cd target/release ; rm -f *.tgz; tar zcf "grin-wallet-$tagname-$TRAVIS_JOB_ID-osx.tgz" grin
/bin/ls -ls *.tgz | awk '{print $6,$7,$8,$9,$10}'
md5 "grin-wallet-$tagname-$TRAVIS_JOB_ID-osx.tgz" > "grin-wallet-$tagname-$TRAVIS_JOB_ID-osx.tgz"-md5sum.txt
/bin/ls -ls *-md5sum.txt | awk '{print $6,$7,$8,$9,$10}'
cd - > /dev/null;
echo "tarball generated\n"

# Only generate changelog on Linux platform, to avoid duplication
exit 0
else
# Do some custom requirements on Linux
cd target/release ; rm -f *.tgz; tar zcf "grin-wallet-$tagname-$TRAVIS_JOB_ID-linux-amd64.tgz" grin-wallet
/bin/ls -ls *.tgz | awk '{print $6,$7,$8,$9,$10}'
md5sum "grin-wallet-$tagname-$TRAVIS_JOB_ID-linux-amd64.tgz" > "grin-wallet-$tagname-$TRAVIS_JOB_ID-linux-amd64.tgz"-md5sum.txt
/bin/ls -ls *-md5sum.txt | awk '{print $6,$7,$8,$9,$10}'
cd - > /dev/null;
echo "tarball generated\n"
fi

version="$tagname"
branch="`git symbolic-ref -q --short HEAD`"

# automatic changelog generator
gem install github_changelog_generator

LAST_REVISION=$(git rev-list --tags --skip=1 --max-count=1)
LAST_RELEASE_TAG=$(git describe --abbrev=0 --tags ${LAST_REVISION})

# Generate CHANGELOG.md
github_changelog_generator \
-u $(cut -d "/" -f1 <<< $repo_slug) \
-p $(cut -d "/" -f2 <<< $repo_slug) \
--since-tag ${LAST_RELEASE_TAG}

body="$(cat CHANGELOG.md)"

# Overwrite CHANGELOG.md with JSON data for GitHub API
jq -n \
--arg body "$body" \
--arg name "$version" \
--arg tag_name "$version" \
--arg target_commitish "$branch" \
'{
body: $body,
name: $name,
tag_name: $tag_name,
target_commitish: $target_commitish,
draft: false,
prerelease: false
}' > CHANGELOG.md

release_id="$(curl -0 -XGET -H "Authorization: token $token" https://api.github.com/repos/$repo_slug/releases/tags/$tagname 2>/dev/null | grep id | head -n 1 | sed 's/ *"id": *\(.*\),/\1/')"
echo "Updating release $version for repo: $repo_slug, branch: $branch. release id: $release_id"
curl -H "Authorization: token $token" --request PATCH --data @CHANGELOG.md "https://api.github.com/repos/$repo_slug/releases/$release_id"
echo "auto changelog uploaded.\n"

83 changes: 83 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
language: rust

git:
depth: false

dist: trusty
sudo: required

cache:
cargo: true
timeout: 240
directories:
- $HOME/.cargo
- $TRAVIS_BUILD_DIR/target

before_cache:
- rm -rf $TRAVIS_BUILD_DIR/target/tmp

rust:
- stable

addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-5
- cmake
- libcurl4-openssl-dev
- libelf-dev
- libdw-dev
- cmake
- gcc
- binutils-dev

env:
global:
- RUST_BACKTRACE="1"
- RUST_FLAGS="-C debug-assertions"

matrix:
include:
- os: linux
env: TEST_SUITE=config-libwallet-apiwallet
- os: linux
env: TEST_SUITE=refwallet
- os: osx
env: TEST_SUITE=release

script:
- IFS='-' read -r -a DIRS <<< "$TEST_SUITE"; DIR=${DIRS[0]};
echo "start testing on folder $DIR...";
if [[ -n "$DIR" ]] && [[ "$TRAVIS_OS_NAME" == "linux" ]]; then cd $DIR && cargo test --release && cd - > /dev/null; fi;
- IFS='-' read -r -a DIRS <<< "$TEST_SUITE"; DIR=${DIRS[1]};
if [[ -n "$DIR" ]]; then
echo "start testing on folder $DIR...";
cd $DIR && cargo test --release && cd - > /dev/null;
fi;
- IFS='-' read -r -a DIRS <<< "$TEST_SUITE"; DIR=${DIRS[2]};
if [[ -n "$DIR" ]]; then
echo "start testing on folder $DIR...";
cd $DIR && cargo test --release && cd - > /dev/null;
fi;

before_deploy:
- if [[ "$TEST_SUITE" == "pool-p2p-src" ]]; then
cargo clean && cargo build --release && ./.auto-release.sh;
fi
- if [[ "$TEST_SUITE" == "release" ]] && [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
brew update;
cargo clean && cargo build --release && ./.auto-release.sh;
fi

deploy:
provider: releases
api_key:
secure: PBTFcoUmiQITkDdtFzrBlNR/5OgYHTCw+xVWGYu205xwTlj/ARBgw7DNt8dIdptLx+jOM2V5SbJqSFxs/CJ2ZcOHQZ6ubwpAJlRfuk3xDAi5JmuHYfcY+4SQ9l/0MgHnGfuml093xP7vTIYm2Vwwgdq8fd3jdWmvwgk9zgaGXB4UIXQA0yIs3EzxZpqiLg629Ouv7edMfyffwlG+rgQ1koe6sqeMCxIs0N3p97GCx19kNe0TV4dC7XAN74HreMdHmwxPKAK4xG/jtA1Snm0pMQ50Z0Kizt+0yrGOPMLnWwO9sS38iosBn3Vh1R8HKle2xBGflTtT/LG9lHdQZ5NF572q6681x6t7str4OjJ5bboy1PtNLFxG7RJCVIpp9gbouzdxIaJWRTxIdlk8UNQMrD8ieiNE6V1vZtbHGtJHRSJN1vO/XxsLlQDCyakLhG/nmSKXgiT9wIsu+zj/3oDe+LBt5QetEGYGBrCwUewjaQ7EP1rsT7alQrHTMad5DPjYftJuvfR+yBtz1qbzQwZVJpQC1KY1c476mXPQsaywuUrj56hH92p7P3vl6aMN2OPJZP+zENOVSURHc56KeTsDS55+KKzcRjCMA2L0LR1hP33+V5kavMHgCRrWIkxAkZ4eRqnermalzp8vlzL6EEoGm0VFLzv4mJmzrY1mC1LyCHo=
file_glob: true
file: target/release/grin-*.tgz*
skip_cleanup: true
on:
repo: mimblewimble/grin
tags: true
Loading

0 comments on commit f65149c

Please sign in to comment.