FSharp FAKE - Tracing Process Output - f#

I have a FAKE task where I am calling Visual Studio to build a setup project. I have been playing around with ExecProcess and ExecProcessRedirected, but am unable to get tracing to work. In other words, I want to log all of the build output messages from VS as it runs.

My honest opinion is: don't use VS during a build. You'll end up installing VS on CI servers and everything will become worse. Try to find a different way. You can use WiX which has already a FAKE task or other installer tools which don't require VS.

Related

How to adjust test configuration in TFS 2015 Visual Studio Test task

I'm trying to setup our TFS 2015 server to run automated tests. I've got it running, but we need to run our tests in Debug mode (for various reasons I can't really adjust). The problem is that I can't seem to figure out a way to switch the configuration in the Test task.
The help that the task links to (here) says that it's as easy as selecting Platform and Configuration, but the problem is that those options don't exist for me (they exist under Reporting, but the help there suggests that they will simply compare the results to other builds with that configuration).
I've also investigated the vstest.console.exe parameters (help I found was this one) as well as modifying the runsettings file, but these only allow me to modify the platform.
Overall, my question is a)is there a reason why I don't see the Platform/configuration options in TFS, and b) given that I don't see them, how can I modify the configuration that the tests are running under?
If it helps, TFS is reporting the version as Version 14.95.25122.0, which corresponds to Update 2. I checked the logs for 2.1 and 3, but wasn't able to find anything that suggested that this was added in later versions (though I could be wrong).
UPDATE:
I've realized that I misread the Test documentation and that the Platform/Configuration options were always for reporting only.
My question is then if I can actually set this in the tests somehow.
Thank you very much for any help.
Assuming you want to compile your test project in Debug mode. You can add a VS Build step to specify the BuildConfiguration variable, and define debug for variable BuildConfiguration. Check the screenshots below:
Then in VS Test step, specify the Test Assembly as **\$(BuildConfiguration)\*test*.dll to test the assemble under Debug folder:

Automated Ant build - any open source projects that discover changes in a file system to fire off a build?

Has anybody discovered any means to fire an ant build process automatically based on file system changes?
I basically want my ant build system to begin building similar to an IDE (compile java classes) but from some sort of command line service.
If not, there's always coding one up with Java and integrating the Ant API into it.
I am familiar with continuous integration systems like Jenkins and the like, however I need the build to be fired not check-in. Also I would like it to be independent of the IDE, as that could work on post-save.
I'm looking for an independent build service without source control requirements.
Since you are using ant I assume a java based directory polling program will help here. You can write a program using IO notification api
Notes from the page
When to Use and Not Use This API
The Watch Service API is designed for applications that need to be
notified about file change events. It is well suited for any
application, like an editor or IDE, that potentially has many open
files and needs to ensure that the files are synchronized with the
file system. It is also well suited for an application server that
watches a directory, perhaps waiting for .jsp or .jar files to drop,
in order to deploy them.
This API is not designed for indexing a hard drive. Most file system
implementations have native support for file change notification. The
Watch Service API takes advantage of this support where available.
However, when a file system does not support this mechanism, the Watch
Service will poll the file system, waiting for events.
Edit
After I wrote that this question and its answer seems to be more useful here: Is there a sophisticated file system monitor for Java which is freeware or open source?
The widely practiced way is a way of "continuous build" / "continuous integration". A sample work-flow:
You check in your code into a source control repository
Continues Integration server picks up changes from the repository and starts a build process
The build process results in either success or failure giving you a fast feedback
Lot's of continuous integration servers (Bamboo, Jenkins, Go) support Ant natively.
You can also set up post-save hooks in your IDE. Most modern ones support it: IntelliJ, NetBeans, Eclipse.
Look up "continuous integration" in google.
A friend pointed me to this:
https://serverfault.com/questions/179706/how-can-i-trigger-a-script-to-run-after-the-rsyncdaemon-received-file-changes-to
A little script to monitor for changes and execute and independent task.
If anyone has a better method that works with ANT scripts directly, let me know.

Requirements for TFS automated build and publish

I'm new to TFS and we're trying to automate the test / build / deploy process for our builds.
The problem I'm experiencing is that when I try to start a build with automatic deployment (for a webpage) using the MSBuild Arguments it complains that it doesn't have the necessary DLLs and I've figured out so far that they get installed with Visual Studio Premium or Ultimate, but then other people complained that something like Visual Studio shouldn't get installed on a Server =)
The TFS is also the build server for now and I'd like the know if there are any known requirements for these things to work:
Automated UI Testing
Automated deployment
Automated publish
Code Analysis
I'm working with TFS 2010 and Visual Studio 2010 (Premium). Any help, comments or different approaches are welcome =)
The way we handle that on my team is to actually check all the references needed to build the product in to source control. Anything beyond the .NET framework itself, and whatever you get for installing a build controller/build agent, gets checked in..
Positive bits:
Setting up a build agent is trivial (just "Install Server 2K8R2, install build agent, start building").
Don't have to worry about complicated SDK installation to match people's dev boxes.. References are all the exact version checked in to source control.
You get binary version control, which means if you need to do a maintenance release and build against last year's version of a particular API, it's super easy.
Negative bits:
Bloats your source control a bit
Feels weird checking binaries in to source control
Need to be very vigilant about maintaining structure and cleanliness of how you check in the binaries, otherwise it can easily get out of control
Beyond that, as far as making the test bits work from your build agent.. Probably the easiest way would be to install the test agent. The UI automation stuff in VS2010 is the "CodedUI Test" framework.. It extends the normal VS Unit Test framework, but requires some additional registrations to work.
More complicated, but super useful longer term is to set up the full "Visual Studio Lab Management" platform. Downside is, to fully leverage it you'll need to hook up a System Center Virtual Machine Manager server and at least one Hyper-V host, and build out a virtual machine with a "Clean" VM snapshot (everything except the product you're testing installed). Once all that's in place you get a really slick end-to-end build-deploy-test experience.. You trigger the product build via the build system, once that completes your environment is restored to that absolutely clean state (no worries about leftover bits from last version corrupting your testing, etc), the product gets published to this test environment, and then it executes your tests.
Not sure if you're using TFS for workitem tracking, testcase management, project planning, and whatnot.. If not, the lab management stuff may be too heavy-weight to mess with. More info here if you're interested in messing with that part. :)
Your build server needs the appropriate versions of Visual Studio. For instance, if you want to do database unit tests, then the build server needs VS Ultimate to be installed.
If there's an issue with having "client" software installed on a server, then use a separate build server. It makes perfect sense for a build server to have the necessary tools installed to perform builds.

Continuous integration server for Erlang code

What kind of agile tools are you using for Erlang development? What continuous integration (CI) server are you using to build Erlang code? The only reference I got was from Quora question How do I integrate Erlang unit tests in Jenkins (Hudson)?.
I am also interested in the nifty details of setting them up and making talk to each other.
As a company using Erlang actively, Klarna (www.klarna.com) use Jenkins (formerly Hudson) for daily regression test on nearly every dev commit. It's an org with about 80 people total in rnd and we use distribute mode of Jenkins which allows us to have more than 10 build slaves mastered by only one Jenkins server. Basically we have a code base with Eralng code which is version controlled by tools like svn or git. All these testcases are under common test framework and all works well under Jenkins.
Previously, we tried Cruise Control and gave it up since Jenkins does much better.
As Lukas mentioned, you probably will need a tool to gen xml files sine common test doesn't export them directly. Haven't really tried that module though, we do have an implementation of common test event handler to do the job, but it was abandoned due to performance, we do have a a critical requirement on test time. right now, we use a own made script to export xml from common test log directly.
There are a lot more you could do with Erlang and Jenkins, like code coverage analyze if you compile properly and export formatted xml to Cobertour plugin, gui test with selenium etc.
For setting up Jenkins, I think Jenkins home page has a good introduction.
Regarding agile tools, I guess it's really hard to define what a agile tool. Also what I believe is it's very much depend on the size of you org. You will probably need a good process view tool (team level or depart level), a good ticket tracking tool, code review tool, communication tool. There are bunch of them implemented under open source. According to our exp, none of them seems to be able to work seamlessly with Jenkins which means you will need to select and tweak by your own requirement. BUT that's the beauty of open source isn't it :)?
If you want to do it using Jenkins, I have written a common test hook which generates JUnit XML output for your tests which Jenkins can use to produce test statistics.
https://github.com/garazdawi/cth_tools/blob/master/src/cth_junit.erl
We use Jenkins for our Python code, so I think you may use Jenkins with Erlang code.
We use buildbot with our own recipes to hook unit tests.

Working with MSBuild and TFS

I'm trying to work with MSBuild and TFS.
I've managed to create my own MSBuild script, that works great from the command-line. The script works with csproj files, and compiles, obfuscate, sign and copies everything that's needed.
However, looking at the documentation of TFS & Team Build, it appears that it expect solutions as the "input" for the script.
Also, I haven't found an easy/intuitive way of performing a "Get Latest Version" from the TFS as part of the script. I'm assuming that the Team Build automatically do a "Get Latest" on the solutions it's suppose to compile, but again - I don't (want to) work with solutions...
Any insights? any pointers? any links?
Team Build defines about 25 targets of its own. When you queue a Team Build, they are automatically run for you in the predefined order listed # MSDN. Don't modify this process. Instead, simply set a couple of these properties that determine how the tasks behave. For example, set <IncrementalGet> to "true" if you want ordinary Get behavior, or "false" if you want something closer to tf get /force.
As far as running your own MSBuild script, again this shouldn't be necessary. Start with the TFSBuild.proj file that's provided for you. It should only require minimal modifications to do everything you describe. Call your obfuscation & signing code by overriding a task like AfterCompile or AfterTest. Put your auto-deploy code in AfterDropBuild. Etc.
Even really complex scenarios are possible if you refactor appropriately. See past answers #1 #2.
As far as the actual compile, you're right that Team Build operates on solutions. I recommend giving it what it wants. I'll be the first to admit that *.sln files are ugly and largely undocumented, but at least you're offloading the work to a well tested & supported product.
If you really wanted to, you could give it a blank/dummy solution and override the CoreCompile task with your custom compiler logic. But this is really asking for trouble. At bare minimum, you lose all of Team Build's flexibility WRT building multiple platforms and flavors. More practically, you're bound to spend a lot of time debugging something that's designed to "just work" -- and there are no good MSBuild debuggers yet (that I know of). Not worth it, IMO.
BTW, the solution files do not affect the Get process. As you can see in the 1st link, the Get is done very early on, long before Team Build even reads the solution file(s). Apart from a few options like <IncrementalGet>, this is not controlled from MSBuild at all -- in particular, the paths to be downloaded are determined by the workspace mappings associated with the build definition. I.e., they are stored in the Team Build SQL database, not the filesystem, and managed with tools (like Team Explorer) that call the TFS webservice API.

Resources