From 366cc829f208a6a3286e6aa5dcf2b476e52cc2ab Mon Sep 17 00:00:00 2001 From: Tommy Parnell Date: Wed, 17 Jun 2015 15:08:38 -0700 Subject: [PATCH 1/4] see if I can get travis to work --- .gitignore | 5 +- .travis.yml | 13 +++++ Gemfile | 5 ++ Rakefile | 54 +++++++++++++++++++ assets/puppet/init.pp | 12 +++++ assets/puppet/site.pp | 3 ++ assets/tools.rake | 37 +++++++++++++ .../Exception/TestBaseUntappdException.cs | 3 +- .../Request/TestRepository.cs | 2 +- 9 files changed, 130 insertions(+), 4 deletions(-) create mode 100644 .travis.yml create mode 100644 Gemfile create mode 100644 Rakefile create mode 100644 assets/puppet/init.pp create mode 100644 assets/puppet/site.pp create mode 100644 assets/tools.rake diff --git a/.gitignore b/.gitignore index cee0cb8..e30f673 100644 --- a/.gitignore +++ b/.gitignore @@ -9,7 +9,8 @@ *.DotSettings # User-specific files (MonoDevelop/Xamarin Studio) *.userprefs - +*.lock +tools/ **/.settings NDependOut *.ndproj @@ -132,7 +133,7 @@ publish/ # Publish Web Output *.[Pp]ublish.xml *.azurePubxml -# TODO: Comment the next line if you want to checkin your web deploy settings +# TODO: Comment the next line if you want to checkin your web deploy settings # but database connection strings (with potential passwords) will be unencrypted *.pubxml *.publishproj diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..2daf098 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,13 @@ +language: ruby +install: + - sudo apt-get update + - sudo apt-get install puppet + - puppet module install puppetlabs-apt + - puppet apply assets/puppet/site.pp + - bundle +script: + - bundle exec rake preflight +notifications: + email: + - tparnell8@gmail.com +gemfile: Gemfile diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..0f793be --- /dev/null +++ b/Gemfile @@ -0,0 +1,5 @@ +source 'http://rubygems.org' +gem 'rake' +gem 'os' +gem 'albacore' +gem 'nokogiri' diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..466d753 --- /dev/null +++ b/Rakefile @@ -0,0 +1,54 @@ +require 'bundler/setup' +require 'rake/clean' +require 'albacore' +require 'open-uri' +require 'fileutils' +require 'os' +require 'nokogiri' +import 'assets/tools.rake' + + +PACKAGES = File.expand_path("packages") +TOOLS = File.expand_path("tools") +NUGET = File.expand_path("#{TOOLS}/nuget") +Configuration = ENV['CONFIGURATION'] || 'Release' + +desc 'retrieve dependencies' +task :retrieve => ['tools:nuget_fetch'] + +desc 'build the project' +task :build => [:compile] + +desc 'Run the tests' +task :test => [:nunit] + +desc 'Retrieve, Build, Test' +task :preflight => [:retrieve, :build, :test] + + + +build :compile => ['tools:nuget_fetch'] do |b| + b.prop 'Configuration', Configuration + b.sln = 'Untappd.Net.sln' +end + +task :tp do + puts NUNIT +end + +test_runner :nunit do |tests| + tests.files = FileList["src/**/*UnitTests/bin/#{Configuration}/*UnitTests.dll"] # dll files with test + tests.exe = "packages/NUnit.Runners.2.6.4/tools/nunit-console.exe" # executable to run tests with +end + +# task :tests => :'tests:unit' + +#task :ensure_nuget_key do +# raise 'missing env NUGET_KEY value' unless ENV['NUGET_KEY'] +#end + +#Albacore::Tasks::Release.new :release, +# pkg_dir: 'build/pkg', +# depend_on: [:create_nugets, :ensure_nuget_key], +# nuget_exe: 'packages/NuGet.CommandLine/tools/NuGet.exe', +# api_key: ENV['NUGET_KEY'] diff --git a/assets/puppet/init.pp b/assets/puppet/init.pp new file mode 100644 index 0000000..1634259 --- /dev/null +++ b/assets/puppet/init.pp @@ -0,0 +1,12 @@ +include apt +class mono { + package { "mono-devel" : + ensure => "installed" + } + package { "mono-gmcs" : + ensure => "installed" + } + package { "mono-vbnc" : + ensure => "installed" + } +} diff --git a/assets/puppet/site.pp b/assets/puppet/site.pp new file mode 100644 index 0000000..a1a3c92 --- /dev/null +++ b/assets/puppet/site.pp @@ -0,0 +1,3 @@ +import 'init.pp' + +include mono diff --git a/assets/tools.rake b/assets/tools.rake new file mode 100644 index 0000000..f5ed8c9 --- /dev/null +++ b/assets/tools.rake @@ -0,0 +1,37 @@ +namespace :tools do + + # If we don't have a copy of nuget, download it + task :nuget_bootstrap do + puts 'Ensuring NuGet exists in tools/NuGet' + + if !FileTest.exist?("#{NUGET}/nuget.exe") + puts 'Downloading nuget from nuget.org' + + FileUtils.mkdir_p("#{NUGET}") + File.open("#{NUGET}/nuget.exe", "wb") do |file| + file.write open('http://nuget.org/nuget.exe').read + end + end + end + + # Fetch nuget dependencies for all packages + task :nuget_fetch => :nuget_bootstrap do + + # If we aren't running under windows, assume we're using mono + CMD_PREFIX = "" + if !OS.windows? + CMD_PREFIX = "mono" + begin + sh "mozroots --import --sync" #attempt to sync ssl things... + rescue + end + end + + # Make sure we get solution-level deps + sh "#{CMD_PREFIX} #{NUGET}/nuget.exe i .nuget/packages.config -o packages" + + FileList["**/packages.config"].each { |filepath| + sh "#{CMD_PREFIX} #{NUGET}/nuget.exe i #{filepath} -o packages" + } + end +end diff --git a/src/Untappd.Net.UnitTests/Exception/TestBaseUntappdException.cs b/src/Untappd.Net.UnitTests/Exception/TestBaseUntappdException.cs index 04b0064..b115a88 100644 --- a/src/Untappd.Net.UnitTests/Exception/TestBaseUntappdException.cs +++ b/src/Untappd.Net.UnitTests/Exception/TestBaseUntappdException.cs @@ -1,6 +1,5 @@ using NUnit.Framework; using Untappd.Net.Exception; - namespace Untappd.Net.UnitTests.Exception { [TestFixture] @@ -24,5 +23,7 @@ namespace Untappd.Net.UnitTests.Exception { throw new BaseUntappdException("messageHere", new System.Exception("innerException!")); } + + } } diff --git a/src/Untappd.Net.UnitTests/Request/TestRepository.cs b/src/Untappd.Net.UnitTests/Request/TestRepository.cs index 7f170ae..25ec1e3 100644 --- a/src/Untappd.Net.UnitTests/Request/TestRepository.cs +++ b/src/Untappd.Net.UnitTests/Request/TestRepository.cs @@ -31,7 +31,7 @@ namespace Untappd.Net.UnitTests.Request request.Setup(a => a.AddParameter(It.IsAny(), It.IsAny())); var response = new Mock(); - response.Setup(a => a.Content).Returns(File.ReadAllText("../../Responses/json/BeerInfo.json")); + response.Setup(a => a.Content).Returns(File.ReadAllText("../../Responses/Json/BeerInfo.json")); client.Setup(a => a.Execute(It.IsAny())).Callback(() => { }).Returns(response.Object); From 84c27b6c9d2de9b31920c7415a4c37b1191c99af Mon Sep 17 00:00:00 2001 From: Tommy Parnell Date: Wed, 17 Jun 2015 15:27:58 -0700 Subject: [PATCH 2/4] mono try2 --- .travis.yml | 17 +++++------------ Rakefile | 4 ---- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2daf098..727ac31 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,13 +1,6 @@ -language: ruby -install: - - sudo apt-get update - - sudo apt-get install puppet - - puppet module install puppetlabs-apt - - puppet apply assets/puppet/site.pp - - bundle +language: csharp +solution: Untappd.Net.sln script: - - bundle exec rake preflight -notifications: - email: - - tparnell8@gmail.com -gemfile: Gemfile + - xbuild /p:Configuration=Release Untappd.Net.sln + - mono ./packages/NUnit.Runners.*/tools/nunit-console.exe ./src/*Tests/bin/Release/*Tests.dll +sudo:false diff --git a/Rakefile b/Rakefile index 466d753..22b9648 100644 --- a/Rakefile +++ b/Rakefile @@ -32,10 +32,6 @@ build :compile => ['tools:nuget_fetch'] do |b| b.sln = 'Untappd.Net.sln' end -task :tp do - puts NUNIT -end - test_runner :nunit do |tests| tests.files = FileList["src/**/*UnitTests/bin/#{Configuration}/*UnitTests.dll"] # dll files with test tests.exe = "packages/NUnit.Runners.2.6.4/tools/nunit-console.exe" # executable to run tests with From 53988c61208e99a87d427e811f926190b886bff4 Mon Sep 17 00:00:00 2001 From: Tommy Parnell Date: Wed, 17 Jun 2015 15:29:25 -0700 Subject: [PATCH 3/4] fix yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 727ac31..39ffb1b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,4 +3,4 @@ solution: Untappd.Net.sln script: - xbuild /p:Configuration=Release Untappd.Net.sln - mono ./packages/NUnit.Runners.*/tools/nunit-console.exe ./src/*Tests/bin/Release/*Tests.dll -sudo:false +sudo: false From 230345ee662f5360a6940386f400be45a1a30e5f Mon Sep 17 00:00:00 2001 From: Tommy Parnell Date: Wed, 17 Jun 2015 15:35:02 -0700 Subject: [PATCH 4/4] update readme --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c298d33..f7510b3 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ -**Master:** [![Build status](https://ci.appveyor.com/api/projects/status/e21297waldfrso3p/branch/master?svg=true)](https://ci.appveyor.com/project/tparnell8/untappd-net/branch/master) +**Master (Windows):** [![Build status](https://ci.appveyor.com/api/projects/status/e21297waldfrso3p/branch/master?svg=true)](https://ci.appveyor.com/project/tparnell8/untappd-net/branch/master) +**Master (Linux):** [![Build status](https://travis-ci.org/tparnell8/Untappd.Net.svg?branch=master) **Release:**[![Build status](https://ci.appveyor.com/api/projects/status/e21297waldfrso3p/branch/Release?svg=true)](https://ci.appveyor.com/project/tparnell8/untappd-net/branch/Release) **Code Coverage:** [![Coverage Status](https://coveralls.io/repos/tparnell8/Untappd.Net/badge.svg?branch=master)](https://coveralls.io/r/tparnell8/Untappd.Net?branch=master)