Skip to content

Add Travis CI #28

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 29, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
root=true
root = true

[*]
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 4

[*.{csproj,json,config,yml}]
indent_size = 2

[*.sh]
end_of_line = lf

[*.{cmd, bat}]
end_of_line = crlf
49 changes: 49 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
language: csharp

#dotnet cli require Ubuntu 14.04
sudo: required
dist: trusty

#dotnet cli require OSX 10.10
osx_image: xcode7.1

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

os:
- linux

env:
global:
- DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
- TMP: /tmp

matrix:
- CLI_VERSION=1.0.0-preview2-003121
- CLI_VERSION=Latest

matrix:
allow_failures:
- env: CLI_VERSION=Latest

before_install:
- if test "$TRAVIS_OS_NAME" == "osx"; then brew update; brew install openssl; brew link --force openssl; fi
# Download script to install dotnet cli
- if test "$CLI_OBTAIN_URL" == ""; then export CLI_OBTAIN_URL="https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0-preview2/scripts/obtain/dotnet-install.sh"; fi
- curl -L --create-dirs $CLI_OBTAIN_URL -o ./scripts/obtain/install.sh
- find ./scripts -name "*.sh" -exec chmod +x {} \;
- export DOTNET_INSTALL_DIR="$PWD/.dotnetcli"
# use bash to workaround bug https://github.com/dotnet/cli/issues/1725
- sudo bash ./scripts/obtain/install.sh --channel "preview" --version "$CLI_VERSION" --install-dir "$DOTNET_INSTALL_DIR" --no-path
# add dotnet to PATH
- export PATH="$DOTNET_INSTALL_DIR:$PATH"

script:
- ./build.sh
12 changes: 12 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
dotnet restore --no-cache
for path in src/*/project.json; do
dirname="$(dirname "${path}")"
dotnet build ${dirname} -f netstandard1.3 -c Release
done

for path in test/*.Tests/project.json; do
dirname="$(dirname "${path}")"
dotnet build ${dirname} -f netcoreapp1.0 -c Release
dotnet test ${dirname} -f netcoreapp1.0 -c Release
done
3 changes: 3 additions & 0 deletions serilog-sinks-file.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{037440DE-440
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "assets", "assets", "{E9D1B5E1-DEB9-4A04-8BAB-24EC7240ADAF}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
.travis.yml = .travis.yml
appveyor.yml = appveyor.yml
Build.ps1 = Build.ps1
build.sh = build.sh
global.json = global.json
NuGet.Config = NuGet.Config
README.md = README.md
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
using System;
using System.Threading;
using Serilog;
using Serilog.Sinks.File.Tests.Support;
using Serilog.Tests.Support;
using Xunit;
using System.IO;

namespace Serilog.Tests
{
public class FileLoggerConfigurationExtensionsTests
{
const string InvalidPath = "/\\";
static readonly string InvalidPath = new string(Path.GetInvalidPathChars());

[Fact]
public void WhenWritingCreationExceptionsAreSuppressed()
Expand Down Expand Up @@ -66,7 +66,6 @@ public void WhenFlushingToDiskReportedFileSinkCanBeCreatedAndDisposed()
}
}

#if ATOMIC_APPEND
[Fact]
public void WhenFlushingToDiskReportedSharedFileSinkCanBeCreatedAndDisposed()
{
Expand All @@ -79,6 +78,5 @@ public void WhenFlushingToDiskReportedSharedFileSinkCanBeCreatedAndDisposed()
Thread.Sleep(TimeSpan.FromSeconds(1));
}
}
#endif
}
}
8 changes: 6 additions & 2 deletions test/Serilog.Sinks.File.Tests/Support/TempFolder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,14 @@ public void Dispose()
}
}

public static TempFolder ForCaller([CallerMemberName] string caller = null)
public static TempFolder ForCaller([CallerMemberName] string caller = null, [CallerFilePath] string sourceFileName = "")
{
if (caller == null) throw new ArgumentNullException(nameof(caller));
return new TempFolder(caller);
if (sourceFileName == null) throw new ArgumentNullException(nameof(sourceFileName));

var folderName = System.IO.Path.GetFileNameWithoutExtension(sourceFileName) + "_" + caller;

return new TempFolder(folderName);
}

public string AllocateFilename(string ext = null)
Expand Down