I have a nuget package that runs Travis CI for its builds. Here is my yml:
language: csharp
solution: TreasureGen.sln
install:
- nuget restore TreasureGen.sln
After much fiddling and experimentation, I finally found a solution.
.travis.yml
language: csharp
solution: TreasureGen.sln
install:
- nuget restore TreasureGen.sln
- nuget install NUnit.Runners -OutputDirectory testrunner
script:
- xbuild TreasureGen.sln /p:TargetFrameworkVersion="v4.5" /p:Configuration=Stress
- mono ./testrunner/NUnit.ConsoleRunner.*/tools/nunit3-console.exe ./TreasureGen.Tests.Unit/bin/Stress/TreasureGen.Tests.Unit.dll
- mono ./testrunner/NUnit.ConsoleRunner.*/tools/nunit3-console.exe ./TreasureGen.Tests.Integration.IoC/bin/Stress/TreasureGen.Tests.Integration.IoC.dll
- mono ./testrunner/NUnit.ConsoleRunner.*/tools/nunit3-console.exe ./TreasureGen.Tests.Integration.Tables/bin/Stress/TreasureGen.Tests.Integration.Tables.dll
- mono ./testrunner/NUnit.ConsoleRunner.*/tools/nunit3-console.exe ./TreasureGen.Tests.Integration.Stress/bin/Stress/TreasureGen.Tests.Integration.Stress.dll
deploy:
skip_cleanup: true
provider: script
script: chmod +x ./deploy/deploy.sh && ./deploy/deploy.sh $NUGET_API_KEY $NUGET_SOURCE
on:
branch: master
deploy.sh
ApiKey=$1
Source=$2
nuget pack ./TreasureGen/TreasureGen.nuspec -Verbosity detailed
nuget pack ./TreasureGen.Domain/TreasureGen.Domain.nuspec -Verbosity detailed
nuget push ./DnDGen.TreasureGen.*.nupkg -Verbosity detailed -ApiKey $ApiKey -Source $Source
nuget push ./DnDGen.TreasureGen.Domain.*.nupkg -Verbosity detailed -ApiKey $ApiKey -Source $Source
Here are some of the key things to remember:
skip_cleanup: true
- this allows you to reuse
your previous build command results for your nuget packagechmod +x ./deploy/deploy.sh
allows for the script to be executable