Fix TravisCI build
This commit is contained in:
Родитель
9faaaf90b1
Коммит
15f2c6a9c5
106
.travis.yml
106
.travis.yml
|
@ -1,12 +1,4 @@
|
|||
---
|
||||
sudo: false
|
||||
language: c++
|
||||
# dotnet cli require Ubuntu 14.04
|
||||
sudo: required
|
||||
dist: trusty
|
||||
|
||||
# dotnet cli require OSX 10.10
|
||||
osx_image: xcode7.1
|
||||
language: generic
|
||||
|
||||
addons:
|
||||
apt:
|
||||
|
@ -18,32 +10,39 @@ addons:
|
|||
- libunwind8
|
||||
- zlib1g
|
||||
|
||||
os:
|
||||
- osx
|
||||
- linux
|
||||
|
||||
env:
|
||||
matrix:
|
||||
- CLI_VERSION: Latest
|
||||
Configuration: Debug
|
||||
- CLI_VERSION: Latest
|
||||
Configuration: Release
|
||||
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 update;
|
||||
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
|
||||
|
||||
# Download script to install dotnet cli
|
||||
- curl -L --create-dirs https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0/scripts/obtain/dotnet-install.sh -o ./scripts/install.sh
|
||||
|
||||
- export DOTNET_INSTALL_DIR="$PWD/.dotnetcli"
|
||||
|
||||
# Install the latest versio of dotnet CLI
|
||||
- bash ./scripts/install.sh --version "$CLI_VERSION" --install-dir "$DOTNET_INSTALL_DIR" --no-path
|
||||
# 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"
|
||||
|
@ -59,12 +58,65 @@ install:
|
|||
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/NUnit.Portable.Agent.Tests/project.json';
|
||||
#
|
||||
# // read and parse JSON as object (aka CommonJS magic)
|
||||
# data = require(jsonPath);
|
||||
#
|
||||
# // FileSystem API handle
|
||||
# fs = require('fs');
|
||||
#
|
||||
# // delete framework 45 key from the object
|
||||
# delete data.frameworks.net45;
|
||||
#
|
||||
# // 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='./test/NUnit.Portable.Agent.Tests/project.json';data=require(jsonPath);fs=require('fs');delete data.frameworks.net45;fs.writeFileSync(jsonPath, JSON.stringify(data, null, 2))"
|
||||
|
||||
# Restore dependencies
|
||||
- dotnet restore
|
||||
|
||||
# Build projects
|
||||
- dotnet build -c $Configuration -f netcoreapp1.0 ./test/NUnit.Portable.Agent.Tests
|
||||
- dotnet build -c $CONFIGURATION -f netstandard1.3 ./src/NUnit.Portable.Agent
|
||||
|
||||
script:
|
||||
# Run tests
|
||||
- dotnet run -c $Configuration -f netcoreapp1.0 -p ./test/NUnit.Portable.Agent.Tests
|
||||
- dotnet run -c $CONFIGURATION -f netcoreapp1.0 -p ./test/NUnit.Portable.Agent.Tests
|
||||
|
|
Загрузка…
Ссылка в новой задаче