To test the build on various distro, I'm using docker containers and a Makefile for orchestration.
pros:
- You are independent of third party CI runner config (e.g. github actions runners or Travis-CI VM images).
- You can run it locally on your linux system.
- Most CI provide runner with docker and Makefile already installed (e.g. tarvis-ci minimal images.
cons:
- Only GNU/Linux distro supported.
- Could take few GiB (~30 GiB for all distro and all languages)
- ~500MiB OS + C++/CMake tools,
- ~150 MiB Python,
- ~400 MiB dotnet-sdk,
- ~400 MiB java-jdk.
To get the help simply type:
make
note: you can also use from top directory
make --directory=cmake
For example to test Python
inside an Alpine
container:
make alpine_python_test
Docker is a set of platform as a service products that use OS-level virtualization to deliver software in packages called containers.
You can find official base image on the Docker registry Docker Hub
Dockerfile is splitted in several stages.
Vagrant is a tool for building and managing virtual machine environments in a single workflow.
It is currently used to test FreeBSD inside a VirtualBox since we don't have any
FreeBSD machine.
Vagrant call a base image a box.
Vagrant call a container a vagrant machine.
You can find official box on the Vagrant registry Vagrant Cloud
note: Currently only github MacOS runner provide virtualization support (i.e. VirtualBox).
Once vagrant
and VirtualBox
are installed, all commands must be run where the Vagrantfile
is
located.
Generate a Vagrantfile
skeleton, e.g. using the box generic/freebsd12
:
vagrant init generic/freebsd12
Build and run a new vagrant machine:
vagrant up
note: If you run virtualbox
you should see it.
Connect to a vagrant machine:
vagrant ssh
[vagrant@freebsd12 ~]$ ...
Execute few commands:
vagrant ssh -c "pwd; ls project ..."
Stop and delete a vagrant machine:
vagrant destroy -f