From 89de55081ceeac91238fd17457bc6c616d710381 Mon Sep 17 00:00:00 2001 From: Petrutiu Mihai Date: Wed, 13 Jul 2016 13:51:36 +0300 Subject: [PATCH] Add build.sh and travis.yml --- .travis.yml | 34 +++++++++++++++++++++++++++++++ BehavioralPatterns.sln | 2 ++ README.md | 2 ++ build.sh | 46 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 84 insertions(+) create mode 100644 .travis.yml create mode 100644 build.sh diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..b7415da --- /dev/null +++ b/.travis.yml @@ -0,0 +1,34 @@ +language: csharp +sudo: required +dist: trusty +addons: + apt: + packages: + - gettext + - libcurl4-openssl-dev + - libicu-dev + - libssl-dev + - libunwind8 + - zlib1g +mono: + - 4.0.5 +os: + - linux + - osx +osx_image: xcode7.1 +branches: + only: + - master + - release + - dev + - /^(.*\/)?ci-.*$/ +before_install: + - if test "$TRAVIS_OS_NAME" == "osx"; then brew update; brew install openssl; brew link --force openssl; fi +script: + - ./build.sh --quiet verify +notifications: + webhooks: + secure: "imfp26oc8QAWwRdbLoeyNWhkJnE/fD/80B7GD3jac0MEfjJiNjox1bKzgXfUlxZE8MITQk5F+TX00fm4/YYHQSQQqzQSUM1P/02OM+PAbSyVX8MqII2+ECJC1x5UcoCI/hbQW5wAVzhCv9qDirJSbRFAAv0c3+alBrZs4RuYf4w=" + on_success: always + on_failure: always + on_start: always \ No newline at end of file diff --git a/BehavioralPatterns.sln b/BehavioralPatterns.sln index 4e2e187..c19d1d8 100644 --- a/BehavioralPatterns.sln +++ b/BehavioralPatterns.sln @@ -7,6 +7,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{3820200F-354 EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{4780CECA-2B6F-4F79-97C5-D1B483CFC881}" ProjectSection(SolutionItems) = preProject + .travis.yml = .travis.yml + build.sh = build.sh global.json = global.json README.md = README.md EndProjectSection diff --git a/README.md b/README.md index 0aebaed..b064050 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +[![Build Status](https://travis-ci.org/MihaiTheCoder/BehavioralPatterns.svg?branch=master)](https://travis-ci.org/MihaiTheCoder/BehavioralPatterns) + BehavioralPatterns ================== Behavioral Patterns is a .NET core solution that shows some ways to implement the behavioral patterns described by the Gang of Four. diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..f420810 --- /dev/null +++ b/build.sh @@ -0,0 +1,46 @@ +#!/usr/bin/env bash +repoFolder="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +cd $repoFolder + +koreBuildZip="https://github.com/aspnet/KoreBuild/archive/dev.zip" +if [ ! -z $KOREBUILD_ZIP ]; then + koreBuildZip=$KOREBUILD_ZIP +fi + +buildFolder=".build" +buildFile="$buildFolder/KoreBuild.sh" + +if test ! -d $buildFolder; then + echo "Downloading KoreBuild from $koreBuildZip" + + tempFolder="/tmp/KoreBuild-$(uuidgen)" + mkdir $tempFolder + + localZipFile="$tempFolder/korebuild.zip" + + retries=6 + until (wget -O $localZipFile $koreBuildZip 2>/dev/null || curl -o $localZipFile --location $koreBuildZip 2>/dev/null) + do + echo "Failed to download '$koreBuildZip'" + if [ "$retries" -le 0 ]; then + exit 1 + fi + retries=$((retries - 1)) + echo "Waiting 10 seconds before retrying. Retries left: $retries" + sleep 10s + done + + unzip -q -d $tempFolder $localZipFile + + mkdir $buildFolder + cp -r $tempFolder/**/build/** $buildFolder + + chmod +x $buildFile + + # Cleanup + if test ! -d $tempFolder; then + rm -rf $tempFolder + fi +fi + +$buildFile -r $repoFolder "$@" \ No newline at end of file