This repository has been archived by the owner on Nov 27, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
/
.travis.yml
122 lines (111 loc) · 3.41 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
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='./test/dotnet-test-nunit.test.runner/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 ./test/dotnet-test-nunit.test.runner
script:
# Run tests
- dotnet run -c $CONFIGURATION -f netcoreapp1.0 -p ./test/dotnet-test-nunit.test.runner