Show current state of Jenkins build on GitHub repo

前端 未结 12 1610
遥遥无期
遥遥无期 2020-11-28 17:34

Is there a way to show the Jenkins build status on my project\'s GitHub Readme.md?

I use Jenkins to run continuous integration builds. After each commit it ensures

12条回答
  •  鱼传尺愫
    2020-11-28 17:49

    Edit:

    I'm no longer using this approach, please use one of the other answers.

    Update: what I ended up doing, for our specific case: (above answers were great - thanks!)

    Because our build server is not on the internet, we have a script to publish the build status to the gh-pages branch in github.

    • Start of build stamps failing
    • End of build stamps success
    • Project runs after main project to publish results -> build-status, API docs, test reports and test coverage.

    GitHub caches images, so we created .htaccess file, that instructs a short cache timeout for the build-status image.

    Put this in the directory with the build-status image:

    ExpiresByType image/png "access plus 2 minutes"
    

    Here's the build script. The target that publishes to gh-pages is '--publish.site.dry.run'

    With less than 400 lines of config, we have:

    • Compile checks
    • unit & integration tests
    • Test Reports
    • Code Coverage Reports
    • API Docs
    • Publishing to Github

    . . and this script can be run in or outside of Jenkins, so that:

    • Developers can run this script before commit, reducing the chance of a broken build that impacts others.
    • A failure is easy to reproduce locally.

    The Results:

    Project main page has the build status, updated after each build, along with latest API Docs, test results and test coverage.

提交回复
热议问题