One of the Doctor’s objectives, a documentation tool that converts markdown to SharePoint pages, was to make it usable cross-platform. Initially, I created this as an internal tool for Valo and would only be used on Azure DevOps or GitHub Actions. In the first release, I focussed on making the tool available to others like you and seeing if there was any interest in it.
Once the first version was released, one of the first tasks was to get this cross-platform support in place. Each OS has its challenges, but Windows was the worst of all. As Doctor uses the CLI for Microsoft 365, the JSON data provided to the commands had to be formatted correctly. Where on macOS and Linux, it is relatively easy. On Windows, it took some time to get it right. For instance, the string replacement looks like for getting JSON within a JSON object to work.
There are also some differences between the standard command prompt and the PowerShell prompt. That is why I wanted to find a way to make sure that I can quickly check if it still works on each of them.
GitHub Actions
GitHub Actions is the perfect fit for this, as you can create various flows from build/release/testing. In Doctor’s case, I went for a flow that runs on each PR and validates if the project builds, retrieves the sample site repository, and checks if it can publish on Windows, Linux, and macOS.
Here is what it looks like:
In the actions, you can see that four builds are happening. Two of them are running in a matrix strategy. I took Windows out of the matrix strategy as I wanted to specify the shell to use. Setting the shell in a matrix is currently not possible, it seems.
When you would open a PR, it would start the flow of the same actions.
These actions make it easier to validate if the incoming PR is not breaking any of the logic which is currently in place.
You can find the code of this GitHub Action here: Test Build and Publish.
Can you still live without all these automation tools? I definitely cannot anymore. It will not take human testing away completely, but for sure, it makes things a lot easier and quality better.
Article was first published on https://www.eliostruyf.com/devhack-cross-platform-testing-tool-github-actions/
Top comments (0)