Pre-build step in eclipse (CDT) - eclipse

I am trying to use a pre-build step in eclipse in CDT. According to description here: http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.cdt.doc.user%2Freference%2Fcdt_u_prop_build_settings_steps.htm
The pre-build step is not executed if the state of the main build is
determined to be up to date; otherwise it is executed. An attempt to
execute the main build will occur regardless of the success or failure
of executing the pre-build step.
I have 2 problems with it:
1. The pre-build step is always executed even if the main build has nothing to build.
2. The prebuild step is executed after the main build.
Is this a bug or I am just doing something wrong?
Thanks.

Related

Executing tests in another build.gradle project

I am finishing a Continuous Integration system with Jenkins and Gradle for a REST service. It will build the App and dependent sub-libraries, build a Docker, start main docker and secondary ones (database, ...) all in Gradle.
As it is a REST service I have a separate project that executes the REST tests completely from outside my project just as it is a REST client, and works ok...
Once my project is built and everything running I need to execute the build in the other project (which is just for tests) as a subproject, and wether it passes or not the tests I want to continue the main script as Dockers need to be stopped and deleted. What is the best approach for this?
Thanks
You just need to create a task with type: GradleBuild in parameter
Example:
task buildAnotherProjectTask(type: GradleBuild) {
buildFile = '../pathToBuildFileInTheOtherProject/build.gradle'
tasks = ['build'] // You can run any task like that
tasks = ['test']
}
and to run it u can use the following command
gradle buildAnotherProjectTask
This is worked with me when i tried it.
Hope my answer will help :)

How can I generate a code coverage report for a failed Jenkins build

I'm trying to build my Perl project with Jenkins in such a way that I get a JUnit report and a test coverage report. I'm having trouble getting my code report when my build fails. Here's how the build is configured:
perl Build.PL; ./Build;
cover -delete;
PERL5OPT=-MDevel::Cover prove -b --formatter=TAP::Formatter::JUnit t/ > junit.xml;
cover;
The problem with this is when prove exits with a non-zero status (i.e. when some of my tests fail) the cover command never runs; the build aborts, reporting:
Build step 'Execute shell' marked build as failure
Is there a good way to get a test coverage report, even when some of the tests are currently failing?
You could put the cover part into a Post Build task so it always executed and you wouldn't need any additional logic to check status as you go along

jenkins + ghprbhook - how to set status message?

I've installed the ghprbhook plugin to my jenkins system. It triggers when I send a PR but isn't setting the result text properly. The 'success' / 'failure' message is working but the rest is Build finished. No test results found.
The disconnect seems to be between the gradle build plugin and the ghprbhook service. In the ghprbhook source it's checking for hudson.tasks.junit.TestResultAction to be set and apparently it isn't.
Question:
Is it possible to have gradle set the appropriate values? If so, how?
Turns out that I was looking in the wrong place. The way to get useful values to show up in github is to add the Publish JUnit Test Result Report post-build step to your jenkins job. Assuming that you have gradle and junit outputting xml you should see the output in github when you build.

End to end/integration testing - jenkins build

I am currently in a process of setting up Jenkins-CI for my Scala/Akka project.
I managed to create build that is integrated with BitBucket and executes builds when new pull reuqest is created/old pull request is updated.
As a testing framework we are using Specs2 which is also integrated with Jenkins by using JUnit post-build action. Now I am wondering how to properly execute e2e tests in my build.
Basically in git repository we have 2 projects, lets call them main-project and rest-tests. rest-tests contains e2e tests that are written using REST-assured library. To execute them I need to start main-project application (which uses Spray library to set up HTTP server) and then execute test task in sbt project of rest-test.
My idea was to execute main-project startup script (generated by sbt-native-packager) whith something like this:
$WORKSPACE/main-project/target/universal/stage/bin/main-project & echo $! > /tmp/main-project.pid
then execute test task of rest-tests project and finally kill process with PID that is saved in /tmp/main-project.pid file.
The last step should be implemented using https://wiki.jenkins-ci.org/display/JENKINS/Post+build+task because if some rest-testswill fail the next steps of build will not be executed (or at least that is what I am thinking) and I could end with my instance of application running after the build is finished.
This is first time when I am setting up CI system and my solution seems to be a little hacky (at least to me). I am wondering if there is a better/more idiomatic way of solving my problem of running e2e tests which require another application running.

Sonar job in Jenkins never terminates

In a specific project built in Jenkins/Sonar, the build job never terminates.
In the console, we can see:
[INFO] ... ANALYSIS SUCCESSFUL, you can browse ....
[INFO] ... Executing post-job class org.sonar.plugins.core.batch.IndexProjectPostJob
In every run, the build halts at the same line in the console. If we enter the sonar report, all information from the new build seems to be up to date.
Other projects works like a charm.
Any ideas about what might be wrong?