Another long weekend, wrapping up a public project on GitHub. As part of my “trying new stuff” effort, I decided to add a small React application to the QR Azure Function I released a few weeks ago.
Azure has a Static Web Application that is designed to work with their Function APIs. My goals were to create a simple application that can create both Url and WiFi QR codes. This application had to be fully automated from GitHub and be cheap to host. The outcome is available at https://qrap.io/
I didn’t get everything right. I didn’t include the service as a Managed API so I had to sort out the CORS issue. I was trying to keep the download package small so I used HTML validation and it’s pretty “meh”. I also skimped on the graphics and the “menu” is questionable at best. That said, it works fairly well and someone may find the app or the project helpful.
I failed a test in public today. Technically, my build on a public repository was set up to fail. I wanted to see what happens when non-passing code ends up getting checked in.
One of the many cool things about hosting a project on GitHub is that they have a simple process for setting up automated builds. One step of building should be running the tests included in the solution. For the QR project I posted on GitHub to test actions (https://github.com/zimjoe/QRAzureFunctions/wiki) I added tests to check all the validation.
Setting up this step on a GitHub action is very simple. With one line of YAML, you can kick off the tests. Full source located here: https://github.com/zimjoe/QRAzureFunctions/blob/main/.github/workflows/main_joesazurefunction(integration).yml
- name: Test
run: dotnet test --no-restore --verbosity normal
Now, I don’t have to worry about breaking something I thought to write a test for. Now I just have to worry about all the stuff I didn’t think of.
At my new position they are moving to a micro services infrastructure using Azure Functions. I figured I had better get up to speed on all things Azure Functions. I built a few sample projects on my computer, but that doesn’t show me what is looks like in “real life”.
This project started as a simple Azure function to test deployment processes from GitHub Actions and kind took off from there. There are still places in the namespace that refer to AzureFunction and I may go back and refactor that at some point. Since this started as a test, I just jammed all the code in a single project for simplicity’s sake. That said, it seems like Microsoft wants functions to be small instead of big “Clean” multi projects affairs.
The rest of the project just sort of happened like in the book “If you give a Pig a Pancake”. (Once he had a pancake, he wanted syrup and it keeps going from there)
The generator lives on my development account on Azure. You can test it below. Feel free to make some QR codes until my budget for the month runs out.
// post to https://joesazurefunction.azurewebsites.net/api/WifiQR
// post to https://joesazurefunction.azurewebsites.net/api/UrlQR
Read more at the wiki for the project: https://github.com/zimjoe/QRAzureFunctions/wiki