Pytest and Github Status Page

This is the 4th part of a 5 stage assignment on DevOps, this time we are going to make sure that we can use pytest via the command line and setup a status page that shows the status of the build.

So first things first, we need to have pytest installed, you can use the command: sudo apt install python-pytest

I followed the simple example found here, and this is how the output looks like for a failing test and a passing test:

test1

test2

Now to setup the status page, I used a very basic html based on the apache one that looks like this:

pagepage2

Each time the cron job pulls from the repository, other jobs run the unit test as shown before and update the <p> tag of id “build” and the <div> tag of id “about” with the results of the build with javascript. For this last part I used Rhino which can be downloaded in ubuntu using the command: sudo apt-get install rhino, but other methods can be used to achieve this.

Now how could you update the README page on your repository to reflect the build status using this setup? Maybe at the same time that you are editing the html I could also call a job that edits the README using badges that I can save as images hosted on free services like ImgBB and change them at the beginning of the README and then commit and push those changes.

Leave a comment