Introduction: GitHub Build Status Server
If you have an ESP8266 and want to monitor the build status of your GitHub repository while sitting on the couch, then this instructable is for you. We will be using GitHub's API to fetch, view and serve a given repository's build status as a simple webpage that can be viewed from any device on the same WiFi network as the ESP8266. Let's get started.
This project was done by me, Nikhil Raghavendra, a Diploma in Computer
Engineering student from Singapore Polytechnic, School of Electrical and Electronic Engineering, under the guidance of my mentor Mr Teo Shin Jen.
Step 1: Build the Project on Travis CI
To serve the build status of your repository, head over to Travis CI (I prefer Travis because it's very simple, you can choose any service you like) and sign in with your GitHub credentials. Then click on the plus symbol to add more repositories to build. Scroll down and search for the repository you are interested in and flick the repository switch. You should then see a tick on the repository switch. The next thing you are supposed to do is to add a .travis.yml file to your repository. Every project has it's own .travis.yml file that is dependent on the primary language the project was coded in and I strongly encourage you to search the web and configure a suitable one for your project. Then trigger your first build with a git push.
It will take some time for Travis to build your project, and once it's done you should see a green coloured, "build: passing" label beside the project name. If your build fails, it could mean two things, there could be a misconfiguration in your .travis.yml file or there could be an error in your latest commit. But for this instructable, it doesn't really matter if your build is successful or not (but it's good to be successful right?).
Step 2: Coding the Web Server
Before we start coding, we should note that GitHub's API is served via HTTPS and we can only access the API if we perform a GET request over a secured network. So we use WiFiClientSecure instead of WiFiClient. Download the code found below and load it into your ESP8266 via a USB to micro USB cable. Make sure to provide your WiFi SSID, WiFi password, and the repository name before uploading. The repository name is in the following format,
If you have looked at the code, you would have noticed that we do not have a process to verify the SHA1 fingerprint of the GitHub server. Trying to verify the identity of a server might raise benign warnings that are actually not necessary, so I've completely avoided that in my code (you can code a verifier if you want).
Step 3: The Results
Once you have uploaded your code onto the ESP8266, fire up the serial monitor and you will see the IP address of the ESP8266 on the monitor, copy the IP address and head over to the browser of your choice. Paste the IP address into the search bar and *boom* you should see the build status of your GitHub project.
We have a be nice policy.
Please be positive and constructive.