GitHub Actions: How to Automate Code Formatting in Pull Requests

Thursday, October 17, 2019
Many programming languages have auto-formatting tools. The most common way to use these is client-side, either using git-hooks to format on pre-commit, or text editor plugins that format on save. Since they run client-side they all rely on engineers setting these tools up correctly. Failing to format before raising pull requests often means that checks will fail and corrections will need to be made. Wouldn’t it be great to have automated code formatting of pull request branches.

GitHub Actions: How to Create Pull Requests Automatically

Friday, October 11, 2019
Introducing one of the first GitHub Actions I wrote and published to the GitHub Marketplace. A generic action to automatically create a pull request for changes to your repository in the Actions workspace. create-pull-request Changes to a repository in the Actions workspace persist between steps in a workflow. The create-pull-request action is designed to be used in conjunction with other steps that modify or add files to your repository. The local changes will be automatically committed to a new branch and a pull request created.

Containerising Kotlin with Jib

Sunday, June 16, 2019
Writing a Dockerfile to containerise an application can often be a non-trivial task. Many times I’ve spent hours fiddling with different base images and configurations and never being quite satisfied with the result. Well I recently tried Jib, one of Google’s container tools, and I love it! It builds optimised Docker and Open Container Initiative (OCI) spec images for JVM applications. For containerising JVM apps I will definitely try and use Jib where possible in future.

Smoke Testing Containers

Thursday, March 14, 2019
Smoke testing is a class of testing designed to determine if something is ready for more rigorous testing. The terminology appears to have originated from plumbing where smoke is used to test for leaks in a closed system of pipes. It also seems to be widely used in electronics to refer to the practice of turning on a new piece of hardware for the first time and considering it a success if none of the components overheat and start to smoke.

Mutation Testing

Tuesday, July 31, 2018
Mutation testing is a type of testing designed to assess the quality of unit tests. This method is also sometimes described as “fault based testing” as it deliberately creates faults in software. How mutation testing frameworks work Small syntactic changes are made to the application code. Each change, or mutation, is applied to a separate copy of the code thus creating many versions. These versions of the application code are described as “mutants.

Lightweight Architecture Decision Records

Thursday, May 24, 2018
“Lightweight Architecture Decision Records is a technique for capturing important architectural decisions along with their context and consequences.” — “Lightweight Architecture Decision Records”, ThoughtWorks Technology Radar Making architecture and design decisions In my experience architecture decisions are often made verbally while gathered around a whiteboard. This is a great way to hash out the design while you’re still exploring the architecture. However, if no record of that process is made six months later most people will be hard pressed to remember the full context and reason why decisions were made and important details will be forgotten.

How to Host Swagger Documentation With Github Pages

Wednesday, May 2, 2018
This article describes how use the Swagger UI to dynamically generate beautiful documentation for your API and host it for free with GitHub Pages. An example API specification can be seen hosted at https://peter-evans.github.io/swagger-github-pages. Steps Download the latest stable release of the Swagger UI here. Extract the contents and copy the “dist” directory to the root of your repository. Move the file “index.html” from the directory “dist” to the root of your repository.

Candidate Selection Using Iterative Soft-Thresholding

Wednesday, June 21, 2017
This article describes one way to use soft-thresholding to select the statistically best candidates from a sorted list. This algorithm was introduced to me as an alternative to setting a hard threshold, i.e. selecting a fixed number of the best candidates. Using an iterative soft-thresholding algorithm a variable number of candidates can be selected depending on the distribution of the values. In the following example the best candidates are selected from a sorted list.

How to Wait for Container X Before Starting Y

Sunday, March 5, 2017
Since docker-compose version 2.1 file format the healthcheck parameter has been introduced. This allows a check to be configured in order to determine whether or not containers for a service are “healthy.” How can I wait for container X before starting Y? This is a common problem and in earlier versions of docker-compose requires the use of additional tools and scripts such as wait-for-it and dockerize. Using the healthcheck parameter the use of these additional tools and scripts is often no longer necessary.