trautonen / coveralls-maven-plugin

Maven plugin for submitting Java code coverage reports to Coveralls web service.
MIT License
312 stars 124 forks source link

Can not appear to get these working with CodeShip #2

Closed grandwazir closed 10 years ago

grandwazir commented 11 years ago

Hello. I was attempting to use this plugin in conjunction with Codeship and it appears to not be sending the final report. The following is at the bottom of my Maven build:

[INFO] Using repository token <secret>
[INFO] Git commit c553f4e in c553f4e6db97186733c7ef42179136c63f11a431
[INFO] Writing Coveralls data to /home/rof/clone/target/coveralls.json from coverage      report /home/rof/clone/target/site/cobertura/coverage.xml
[INFO] Successfully wrote Coveralls data in 358ms
[INFO] Submitting Coveralls data to API
[INFO] Successfully submitted Coveralls data in 1589ms for Job #3.1
[INFO] https://coveralls.io/jobs/210049
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 46.348s
[INFO] Finished at: Fri Jun 28 23:36:23 UTC 2013
[INFO] Final Memory: 25M/823M
[INFO] ------------------------------------------------------------------------

The report that is submitted is essentially blank. Full details of the build is available here.

trautonen commented 11 years ago

My guess now is that Coveralls has some issues creating the reports. If you log out from Coveralls and check their front page with the latest updates, you will notice a lot of builds having the same issue. So I'd wait until they get the reports flowing correctly again.

I will add a debugging feature in the next version that tracks the number of lines reported. So it will help to resolve this kinds of issues. If you still want to know for sure what kind of report is generated, you can provide a server that takes in the Coveralls report. You can change the API URL with coverallsUrl parameter. Add your server's url that is accessible from the CI environment and log the file that comes in.

If you check your build you will also notice that the branch is reported wrong. This is because the CI server fetches the repository in detached head state. I don't know how I can resolve the branch with JGit for detached head. Do you know if CodeShip has some environment variable that it sets for the checked out branch so I could add automatic support for branch name fetching.

flomotlik commented 10 years ago

CodeShip has some environment variable that it sets for the checked out branch so I could add automatic support for branch name fetching

We do and it is CI_BRANCH. We talked to the guys at Coveralls about it and came up with this as a good default name. Following are all environment variables we export for a build:

CI true CI_BUILD_NUMBER ID of the build in our service CI_BUILD_URL URL to that build CI_BRANCH Branch of this build CI_COMMIT_ID Commit Hash of the build CI_COMMITTER_NAME Name of the committer CI_COMMITTER_EMAIL Email of the committer CI_COMMITTER_USERNAME Username of the commiter in their SCM service CI_MESSAGE Message of the last commit for that build CI_NAME codeship

trautonen commented 10 years ago

@flomotlik thanks for the verification. I found the required information from the original Ruby client configuration and implemented my new CI service auto detect based on that. The new CI service autodetect system is included 2.0.0+ versions of the plugin. I followed the same scheme of the general CI environment variables which CodeShip uses. The general environment scheme implementation can be found here. I don't use CodeShip myself, but I would be grateful if someone could verify that the plugin detects the environment variables of CodeShip and requires only the Coveralls repo token to be configured.

ckarawani commented 10 years ago

Confirmed! The only thing I needed to do was pass in my Token via an environment var I setup on Codeship..

            <plugin>
                <groupId>org.eluder.coveralls</groupId>
                <artifactId>coveralls-maven-plugin</artifactId>
                <version>2.0.1</version>
                <configuration>
                    <repoToken>${env.COVERALLS_REPO_TOKEN}</repoToken>
                </configuration>
            </plugin>
trautonen commented 10 years ago

Thanks @ckarawani. I see Joov is nicely reported from CodeShip. Will close this issue now.

flomotlik commented 10 years ago

Great work guys. Thanks