Skip to content

Commit

Permalink
Added travis
Browse files Browse the repository at this point in the history
  • Loading branch information
devedse committed Sep 20, 2016
1 parent 0af15fb commit a76fc5c
Showing 1 changed file with 119 additions and 2 deletions.
121 changes: 119 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,121 @@
language: csharp
solution: DeveMazeGenerator.sln
language: generic

addons:
apt:
packages:
- gettext
- libcurl4-openssl-dev
- libicu-dev
- libssl-dev
- libunwind8
- zlib1g

matrix:
include:
- os: linux
dist: trusty # Ubuntu 14.04
sudo: required
env: CONFIGURATION=Debug
- os: linux
dist: trusty
sudo: required
env: CONFIGURATION=Release
- os: osx
osx_image: xcode7.2 # macOS 10.11
env: CONFIGURATION=Debug
- os: osx
osx_image: xcode7.2
env: CONFIGURATION=Release

before_install:
# Install OpenSSL
- if test "$TRAVIS_OS_NAME" == "osx"; then
brew install openssl;
brew link --force openssl;
export DOTNET_SDK_URL="https://go.microsoft.com/fwlink/?LinkID=809128";
else
export DOTNET_SDK_URL="https://go.microsoft.com/fwlink/?LinkID=809129";
fi

- export DOTNET_INSTALL_DIR="$PWD/.dotnetcli"

# Install .NET CLI
- mkdir $DOTNET_INSTALL_DIR
- curl -L $DOTNET_SDK_URL -o dotnet_package
- tar -xvzf dotnet_package -C $DOTNET_INSTALL_DIR

# Add dotnet to PATH
- export PATH="$DOTNET_INSTALL_DIR:$PATH"

install:
# Display dotnet version info
- which dotnet;
if [ $? -eq 0 ]; then
echo "Using dotnet:";
dotnet --info;
else
echo "dotnet.exe not found"
exit 1;
fi

# [WORKAROUND]
#
# SYNOPSIS:
#
# dotnet-cli has introduced a bug with .NET Core RTM (wasn't there till RC2);
# that is, the dotnet-run command ignores --framework option and therefore
# demands mono PCL reference assemblies to be present on Unix systems, even
# though when we intend to build for netcoreapp or netstandard TxM.
#
# See: https://github.com/dotnet/cli/issues/3658
#
# The workaround is to rewrite the JSON without net451 framework node in the
# runnable (or testable) project's JSON file for CI. This work around must be
# applied before executing dotnet-restore command.
#
# Written in JavaScript to be executable with node.js
# (JavaScript being the most native langauge for JSON processing)
#
# Travis CI job when running under different langauge provides nvm (the node.js version manager)
# but not node.js itself. So we first run:
#
# > $HOME/.nvm/nvm.sh
#
# then install stable node
#
# > nvm install stable && nvm use stable
#
# now, we have node.js in PATH. We will run the following program in evaluation
# mode as one-liner:
#
# ```javascript
# // the file to manipulate
# jsonPath = './test/dotnet-test-nunit.test.runner/project.json';
#
# // read and parse JSON as object (aka CommonJS magic)
# data = require(jsonPath);
#
# // FileSystem API handle
# fs = require('fs');
#
# // delete framework 451 key from the object
# delete data.frameworks.net451;
#
# // write back to file
# fs.writeFileSync(jsonPath, JSON.stringify(data, null, 2));
# ```
# Now the actual one-liner (compressed) version:
#
- if test "$TRAVIS_OS_NAME" == "linux"; then
nvm install stable && nvm use stable;
fi
- node -e "jsonPath='./src/DeveMazeGenerator/project.json';data=require(jsonPath);fs=require('fs');delete data.frameworks.net451;fs.writeFileSync(jsonPath, JSON.stringify(data, null, 2))"

# Restore dependencies
- dotnet restore

# Build projects
- dotnet build -c $CONFIGURATION -f netcoreapp1.0 ./src/DeveMazeGenerator

notifications:
email: false

0 comments on commit a76fc5c

Please sign in to comment.