diff --git a/.travis.yml b/.travis.yml index d359e1a..b255414 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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: diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..9b02459 --- /dev/null +++ b/Dockerfile @@ -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