Over at the Ubuntu/WSL repository, we developed some GitHub actions to make your life easier when running your CI in WSL. This is needed because GitHub runners do not support WSL. Just setting up an Azure VM will not cut it either, because the runner will run in session 0, which means that Microsoft Store applications such as WSL cannot be run.
run.cmd
batch file in your actions runner).You're done! Your CI yaml files will need some extra work, however, as you need to allocate and deallocate the VM on demand. The runner needs to run on Windows and not directly on WSL, as WSL instances will shut themselves down automatically, so we implemented some utilities to install and update WSL and the distro, as well as to run scripts.
You can find these actions and some more in-depth explanation for the setup here.
This repository contains a very simple library src.py
with a function that returns different results inside and outside WSL.
To test it properly, we run a test on each platform: