Skip to content

Latest commit

 

History

History
103 lines (69 loc) · 2.34 KB

ci.md

File metadata and controls

103 lines (69 loc) · 2.34 KB

CI: Makefile/Docker/Vagrant testing

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 VM images (e.g. github actions/virtual-environments).
  • You can run it locally on any host having a linux docker image support.
  • Most CI provide runner with docker and Makefile installed.

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.

Usage

To get the help simply type:

make

note: you can also use from top directory

make --directory=cmake

Example

For example to test Python inside an Alpine container:

make alpine_python_test

Docker

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

Layers

Dockerfile is split in several stages. docker

Vagrant

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).

Basic usage

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