Skip to content

Commit

Permalink
Add test coverage via coveralls
Browse files Browse the repository at this point in the history
  • Loading branch information
condemil committed Feb 18, 2019
1 parent 53139c6 commit f0df378
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 10 deletions.
24 changes: 14 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
language: csharp

sudo: false

solution: byndercsharpsdk.sln

install:
- nuget restore byndercsharpsdk.sln
- nuget install NUnit.Runners -Version 3.8.0 -OutputDirectory testrunner
- docker --version

script:
- msbuild /p:Configuration=Release byndercsharpsdk.sln
- mono ./testrunner/NUnit.ConsoleRunner.3.8.0/tools/nunit3-console.exe ./Bynder/Test/bin/Release/net461/Bynder.Test.dll
- docker build
--build-arg CI=$CI
--build-arg TRAVIS=$TRAVIS
--build-arg TRAVIS_BRANCH=$TRAVIS_BRANCH
--build-arg TRAVIS_COMMIT=$TRAVIS_COMMIT
--build-arg TRAVIS_JOB_ID=$TRAVIS_JOB_ID
--build-arg TRAVIS_JOB_NUMBER=$TRAVIS_JOB_NUMBER
--build-arg TRAVIS_OS_NAME=$TRAVIS_OS_NAME
--build-arg TRAVIS_PULL_REQUEST=$TRAVIS_PULL_REQUEST
--build-arg TRAVIS_PULL_REQUEST_SHA=$TRAVIS_PULL_REQUEST_SHA
--build-arg TRAVIS_REPO_SLUG=$TRAVIS_REPO_SLUG
--build-arg TRAVIS_TAG=$TRAVIS_TAG
.

notifications:
email:
Expand Down
31 changes: 31 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
FROM microsoft/dotnet:2.2-sdk-alpine

ARG CI
ARG TRAVIS
ARG TRAVIS_BRANCH
ARG TRAVIS_COMMIT
ARG TRAVIS_JOB_ID
ARG TRAVIS_JOB_NUMBER
ARG TRAVIS_OS_NAME
ARG TRAVIS_PULL_REQUEST
ARG TRAVIS_PULL_REQUEST_SHA
ARG TRAVIS_REPO_SLUG
ARG TRAVIS_TAG

ARG SKIP_TEST
ARG SKIP_COVERALLS

ENV PATH="${PATH}:/root/.dotnet/tools"

WORKDIR /app
ADD . /app

# test
RUN if [ -z "$SKIP_TEST" ]; then \
cd /app/Bynder/Test/ && dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=opencover && cd /app; \
else echo "skip test"; fi

# submit coverage to coverals if COVERALLS_TOKEN in env
RUN if [ -z "$SKIP_COVERALLS" ] && [ -z "$SKIP_TEST" ]; then \
dotnet tool install -g coveralls.net && csmacnz.Coveralls --opencover -i /app/Bynder/Test/coverage.opencover.xml --useRelativePaths || echo "coverall failed!"; \
else echo "skip coveralls"; fi

0 comments on commit f0df378

Please sign in to comment.