Skip to content

Commit

Permalink
Prefer to run mono via Docker
Browse files Browse the repository at this point in the history
This lets us choose which version of Mono to be use without having to
install it.

This is important because the version currently preinstalled on App-
Veyor has a regression that breaks our build, and installing another
Mono version on AppVeyor is both slow and error-prone.
  • Loading branch information
stakx committed May 2, 2020
1 parent f3d337a commit 961d227
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Most of these requirements should be covered by Visual Studio 2017.

Compilation requires an up-to-date .NET Core SDK.

Running the unit tests additionally requires Mono and the .NET Core 1.1 runtime to be installed. We recommend Mono 5.10+, though older versions (4.6.1+) might still work as well.
Running the unit tests additionally requires the .NET Core 1.1 runtime to be installed, as well as either Docker or Mono. For the latter, we recommend Mono 5.10+, though older versions (4.6.1+) might still work as well.

:information_source: **Mono runtime support:** Castle Core runs with minor limitations and defects on Mono 4.0.2+ (however 4.6.1+ is highly recommended, or 5.10+ if your code uses new C# 7.x language features such as `in` parameters).

Expand Down
1 change: 0 additions & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ for:
# build and run tests
build_script:
- uname -a
- mono --version
- ./build.sh

# upload test results
Expand Down
16 changes: 12 additions & 4 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,27 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# ****************************************************************************
shopt -s expand_aliases

DOTNETPATH=$(which dotnet)
if [ ! -f "$DOTNETPATH" ]; then
echo "Please install Microsoft/netcore from: https://www.microsoft.com/net/core"
exit 1
fi
MONOPATH=$(which mono)

if [ ! -f "$MONOPATH" ]; then
echo "Please install Xamarin/mono from: http://www.mono-project.com/docs/getting-started/install/"
exit 1
DOCKERPATH=$(which docker)
if [ -f "$DOCKERPATH" ]; then
alias mono="$PWD/buildscripts/docker-run-mono.sh"
else
MONOPATH=$(which mono)
if [ ! -f "$MONOPATH" ]; then
echo "Please install either Docker, or Xamarin/Mono from http://www.mono-project.com/docs/getting-started/install/"
exit 1
fi
fi

mono --version

# Linux/Darwin
OSNAME=$(uname -s)
echo "OSNAME: $OSNAME"
Expand Down
4 changes: 4 additions & 0 deletions buildscripts/docker-run-mono.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
set -e
MONO_TAG=${MONO_TAG:-6.0.0.334}
docker run --rm -v "$PWD":'/project' -w='/project' mono:$MONO_TAG mono "$@"

0 comments on commit 961d227

Please sign in to comment.