1
0
mirror of https://github.com/google/cpu_features.git synced 2025-07-01 05:11:15 +02:00

ci: Add docker based test framework

* Add documentation
* Add .dockerignore: minimize docker context size to improve speed
* Add Makefile: to easily run various docker stages
* Add a CMake sample project to check CMake install rules
This commit is contained in:
Corentin Le Molgat
2021-10-25 16:06:43 +02:00
committed by Mizux
parent ca84b91d34
commit ccc3a51e4c
10 changed files with 835 additions and 0 deletions

31
.dockerignore Normal file
View File

@ -0,0 +1,31 @@
# Project Files unneeded by docker
ci/Makefile
ci/docker
ci/doc
ci/cache
.git
.gitignore
.github
.dockerignore
.clang-format
appveyor.yml
.travis.yml
AUTHORS
CONTRIBUTING.md
CONTRIBUTORS
LICENSE
README.md
build/
cmake_build/
build_cross/
cmake-build-*/
out/
# Editor directories and files
.idea/
.vagrant/
.vscode/
.vs/
*.user
*.swp

240
ci/Makefile Normal file
View File

@ -0,0 +1,240 @@
PROJECT := cpu_features
BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
SHA1 := $(shell git rev-parse --verify HEAD)
# General commands
.PHONY: help
BOLD=\e[1m
RESET=\e[0m
help:
@echo -e "${BOLD}SYNOPSIS${RESET}"
@echo -e "\tmake <target> [NOCACHE=1]"
@echo
@echo -e "${BOLD}DESCRIPTION${RESET}"
@echo -e "\ttest build inside docker container to have a reproductible build."
@echo
@echo -e "${BOLD}MAKE TARGETS${RESET}"
@echo -e "\t${BOLD}help${RESET}: display this help and exit."
@echo
@echo -e "\t${BOLD}amd64_<stage>${RESET}: build <stage> docker image using an Ubuntu:latest x86_64 base image."
@echo -e "\t${BOLD}save_amd64_<stage>${RESET}: Save the <stage> docker image."
@echo -e "\t${BOLD}sh_amd64_<stage>${RESET}: run a container using the <stage> docker image (debug purpose)."
@echo -e "\t${BOLD}clean_amd64_<stage>${RESET}: Remove cache and docker image."
@echo
@echo -e "\tWith ${BOLD}<stage>${RESET}:"
@echo -e "\t\t${BOLD}env${RESET}"
@echo -e "\t\t${BOLD}devel${RESET}"
@echo -e "\t\t${BOLD}build${RESET}"
@echo -e "\t\t${BOLD}test${RESET}"
@echo -e "\t\t${BOLD}install_env${RESET}"
@echo -e "\t\t${BOLD}install_devel${RESET}"
@echo -e "\t\t${BOLD}install_build${RESET}"
@echo -e "\t\t${BOLD}install_test${RESET}"
@echo -e "\te.g. 'make amd64_build'"
@echo
@echo -e "\t${BOLD}<target>_<toolchain_stage>${RESET}: build <stage> docker image for a specific toolchain target."
@echo -e "\t${BOLD}save_<target>_<toolchain_stage>${RESET}: Save the <stage> docker image for a specific platform."
@echo -e "\t${BOLD}sh_<target>_<toolchain_stage>${RESET}: run a container using the <stage> docker image specified (debug purpose)."
@echo -e "\t${BOLD}clean_<target>_<toolchain_stage>${RESET}: Remove cache and docker image."
@echo
@echo -e "\tWith ${BOLD}<target>${RESET}:"
@echo -e "\t\t${BOLD}arm-linux-gnueabihf${RESET} (linaro toolchain)"
@echo -e "\t\t${BOLD}armv8l-linux-gnueabihf${RESET} (linaro toolchain)"
@echo -e "\t\t${BOLD}arm-linux-gnueabi${RESET} (linaro toolchain)"
@echo -e "\t\t${BOLD}armeb-linux-gnueabihf${RESET} (linaro toolchain)"
@echo -e "\t\t${BOLD}armeb-linux-gnueabi${RESET} (linaro toolchain)"
@echo -e "\t\t${BOLD}aarch64-linux-gnu${RESET} (linaro toolchain)"
@echo -e "\t\t${BOLD}aarch64_be-linux-gnu${RESET} (linaro toolchain)"
@echo -e "\t\t${BOLD}mips32${RESET} (codespace toolchain)"
@echo -e "\t\t${BOLD}mips64${RESET} (codespace toolchain)"
@echo -e "\t\t${BOLD}mips32el${RESET} (codespace toolchain)"
@echo -e "\t\t${BOLD}mips64el${RESET} (codespace toolchain)"
@echo
@echo -e "\tWith ${BOLD}<toolchain_stage>${RESET}:"
@echo -e "\t\t${BOLD}env${RESET}"
@echo -e "\t\t${BOLD}devel${RESET}"
@echo -e "\t\t${BOLD}build${RESET}"
@echo -e "\t\t${BOLD}test${RESET}"
@echo -e "\te.g. 'make aarch64_test'"
@echo
@echo -e "\t${BOLD}<VM>${RESET}: build the vagrant <VM> virtual machine."
@echo -e "\t${BOLD}clean_<VM>${RESET}: Remove virtual machine for the specified vm."
@echo
@echo -e "\t${BOLD}<VM>${RESET}:"
@echo -e "\t\t${BOLD}freebsd${RESET} (FreeBSD)"
@echo
@echo -e "\t${BOLD}clean${RESET}: Remove cache and ALL docker images."
@echo
@echo -e "\t${BOLD}NOCACHE=1${RESET}: use 'docker build --no-cache' when building container (default use cache)."
@echo
@echo -e "branch: $(BRANCH)"
@echo -e "sha1: $(SHA1)"
# Need to add cmd_platform to PHONY otherwise target are ignored since they do not
# contain recipe (using FORCE do not work here)
.PHONY: all
all: build
# Delete all implicit rules to speed up makefile
MAKEFLAGS += --no-builtin-rules
.SUFFIXES:
# Remove some rules from gmake that .SUFFIXES does not remove.
SUFFIXES =
# Keep all intermediate files
# ToDo: try to remove it later
.SECONDARY:
# Docker image name prefix.
IMAGE := ${PROJECT}
ifdef NOCACHE
DOCKER_BUILD_CMD := docker build --no-cache
else
DOCKER_BUILD_CMD := docker build
endif
DOCKER_RUN_CMD := docker run --rm --init --net=host
# $* stem
# $< first prerequist
# $@ target name
############
## NATIVE ##
############
STAGES = env devel build test install_env install_devel install_build install_test
targets_amd64 = $(addprefix amd64_, $(STAGES))
.PHONY: $(targets_amd64)
$(targets_amd64): amd64_%: docker/amd64/Dockerfile
#@docker image rm -f ${IMAGE}:amd64_$* 2>/dev/null
${DOCKER_BUILD_CMD} \
--tag ${IMAGE}:amd64_$* \
--target=$* \
-f $< \
..
#$(info Create targets: save_amd64 $(addprefix save_amd64_, $(STAGES)) (debug).)
save_targets_amd64 = $(addprefix save_amd64_, $(STAGES))
.PHONY: $(save_targets_amd64)
$(save_targets_amd64): save_amd64_%: cache/amd64/docker_%.tar
cache/amd64/docker_%.tar: amd64_%
@rm -f $@
mkdir -p cache/amd64
docker save ${IMAGE}:amd64_$* -o $@
#$(info Create targets: $(addprefix sh_amd64_, $(STAGES)) (debug).)
sh_targets_amd64 = $(addprefix sh_amd64_, $(STAGES))
.PHONY: $(sh_targets_amd64)
$(sh_targets_amd64): sh_amd64_%: amd64_%
${DOCKER_RUN_CMD} -it --name ${IMAGE}_amd64_$* ${IMAGE}:amd64_$*
#$(info Create targets: $(addprefix clean_amd64_, $(STAGES)).)
clean_targets_amd64 = $(addprefix clean_amd64_, $(STAGES))
.PHONY: clean_amd64 $(clean_targets_amd64)
clean_amd64: $(clean_targets_amd64)
$(clean_targets_amd64): clean_amd64_%:
docker image rm -f ${IMAGE}:amd64_$* 2>/dev/null
rm -f cache/amd64/docker_$*.tar
###############
## TOOLCHAIN ##
###############
TOOLCHAIN_TARGETS = \
arm-linux-gnueabihf armv8l-linux-gnueabihf arm-linux-gnueabi armeb-linux-gnueabihf armeb-linux-gnueabi \
aarch64-linux-gnu aarch64_be-linux-gnu \
mips32 mips32el mips64 mips64el
TOOLCHAIN_STAGES = env devel build test
define toolchain-stage-target =
#$$(info STAGE: $1)
#$$(info Create targets: toolchain_$1 $(addsuffix _$1, $(TOOLCHAIN_TARGETS)).)
targets_toolchain_$1 = $(addsuffix _$1, $(TOOLCHAIN_TARGETS))
.PHONY: toolchain_$1 $$(targets_toolchain_$1)
toolchain_$1: $$(targets_toolchain_$1)
$$(targets_toolchain_$1): %_$1: docker/toolchain/Dockerfile
#@docker image rm -f ${IMAGE}:$$*_$1 2>/dev/null
${DOCKER_BUILD_CMD} \
--tag ${IMAGE}:$$*_$1 \
--build-arg TARGET=$$* \
--target=$1 \
-f $$< \
..
#$$(info Create targets: save_toolchain_$1 $(addprefix save_, $(addsuffix _$1, $(TOOLCHAIN_TARGETS))) (debug).)
save_targets_toolchain_$1 = $(addprefix save_, $(addsuffix _$1, $(TOOLCHAIN_TARGETS)))
.PHONY: save_toolchain_$1 $$(save_targets_toolchain_$1)
save_toolchain_$1: $$(save_targets_toolchain_$1)
$$(save_targets_toolchain_$1): save_%_$1: cache/%/docker_$1.tar
cache/%/docker_$1.tar: %_$1
@rm -f $$@
mkdir -p cache/$$*
docker save ${IMAGE}:$$*_$1 -o $$@
#$$(info Create targets: $(addprefix sh_, $(addsuffix _$1, $(TOOLCHAIN_TARGETS))) (debug).)
sh_targets_toolchain_$1 = $(addprefix sh_, $(addsuffix _$1, $(TOOLCHAIN_TARGETS)))
.PHONY: $$(sh_targets_toolchain_$1)
$$(sh_targets_toolchain_$1): sh_%_$1: %_$1
${DOCKER_RUN_CMD} -it --name ${IMAGE}_$$*_$1 ${IMAGE}:$$*_$1
#$$(info Create targets: clean_toolchain_$1 $(addprefix clean_, $(addsuffix _$1, $(TOOLCHAIN_TARGETS))).)
clean_targets_toolchain_$1 = $(addprefix clean_, $(addsuffix _$1, $(TOOLCHAIN_TARGETS)))
.PHONY: clean_toolchain_$1 $$(clean_targets_toolchain_$1)
clean_toolchain_$1: $$(clean_targets_toolchain_$1)
$$(clean_targets_toolchain_$1): clean_%_$1:
docker image rm -f ${IMAGE}:$$*_$1 2>/dev/null
rm -f cache/$$*/docker_$1.tar
endef
$(foreach stage,$(TOOLCHAIN_STAGES),$(eval $(call toolchain-stage-target,$(stage))))
## MERGE ##
.PHONY: clean_toolchain
clean_toolchain: $(addprefix clean_toolchain_, $(TOOLCHAIN_STAGES))
-rmdir $(addprefix cache/, $(TOOLCHAIN_TARGETS))
.PHONY: env devel build test
env: amd64_env toolchain_env
devel: amd64_devel toolchain_devel
build: amd64_build toolchain_build
test: amd64_test toolchain_test
.PHONY: install_env install_devel install_build install_test
install_env: amd64_install_env
install_devel: amd64_install_devel
install_build: amd64_install_build
install_test: amd64_install_test
#############
## VAGRANT ##
#############
VMS = freebsd
vms_targets = $(addsuffix _build, $(VMS))
.PHONY: $(vms_targets)
$(vms_targets): %_build: vagrant/%/Vagrantfile
@cd vagrant/$* && vagrant destroy -f
cd vagrant/$* && vagrant up
clean_vms_targets = $(addprefix clean_, $(VMS))
.PHONY: clean_vms $(clean_vms_targets)
clean_vms: $(clean_vms_targets)
$(clean_vms_targets): clean_%:
cd vagrant/$* && vagrant destroy -f
-rm -rf vagrant/$*/.vagrant
###########
## CLEAN ##
###########
.PHONY: clean
clean: clean_amd64 clean_toolchain clean_vms
docker container prune -f
docker image prune -f
-rmdir cache
.PHONY: distclean
distclean: clean
-docker container rm -f $$(docker container ls -aq)
-docker image rm -f $$(docker image ls -aq)
-vagrant box remove -f generic/freebsd12

66
ci/README.md Normal file
View File

@ -0,0 +1,66 @@
# GitHub-CI Status
| OS | x86_64 | AArch64 | ARM | MIPS |
|:-------- | :----: | :-----: | :-: | :--: |
| FreeBSD | [![Status][freebsd_svg]][freebsd_link] | N/A | N/A | N/A |
| Linux | [![Status][linux_svg]][linux_link] | [![Status][linux_aarch64_svg]][linux_aarch64_link] | [![Status][linux_arm_svg]][linux_arm_link] | [![Status][linux_mips_svg]][linux_mips_link] |
| MacOS | [![Status][macos_svg]][macos_link] | N/A | N/A | N/A |
| Windows | [![Status][windows_svg]][windows_link] | N/A | N/A | N/A |
[freebsd_svg]: https://github.com/google/cpu_features/actions/workflows/x86_freebsd.yml/badge.svg?branch=master
[freebsd_link]: https://github.com/google/cpu_features/actions/workflows/x86_freebsd.yml
[linux_svg]: https://github.com/google/cpu_features/actions/workflows/x86_linux.yml/badge.svg?branch=master
[linux_link]: https://github.com/google/cpu_features/actions/workflows/x86_linux.yml
[linux_aarch64_svg]: https://github.com/google/cpu_features/actions/workflows/aarch64_linux.yml/badge.svg?branch=master
[linux_aarch64_link]: https://github.com/google/cpu_features/actions/workflows/aarch64_linux.yml
[linux_arm_svg]: https://github.com/google/cpu_features/actions/workflows/arm_linux.yml/badge.svg?branch=master
[linux_arm_link]: https://github.com/google/cpu_features/actions/workflows/arm_linux.yml
[linux_mips_svg]: https://github.com/google/cpu_features/actions/workflows/mips_linux.yml/badge.svg?branch=master
[linux_mips_link]: https://github.com/google/cpu_features/actions/workflows/mips_linux.yml
[macos_svg]: https://github.com/google/cpu_features/actions/workflows/x86_darwin.yml/badge.svg?branch=master
[macos_link]: https://github.com/google/cpu_features/actions/workflows/x86_darwin.yml
[windows_svg]: https://github.com/google/cpu_features/actions/workflows/x86_windows.yml/badge.svg?branch=master
[windows_link]: https://github.com/google/cpu_features/actions/workflows/x86_windows.yml
## Makefile/Docker testing
To test the build on various distro, we are using docker containers and a Makefile for orchestration.
pros:
* You are independent of third party CI runner config
(e.g. [github action virtual-environnments](https://github.com/actions/virtual-environments)).
* You can run it locally on your linux system.
* Most CI provide runners with docker and Makefile installed.
cons:
* Only GNU/Linux distro supported.
### Usage
To get the help simply type:
```sh
make
```
note: you can also use from top directory
```sh
make --directory=ci
```
### Example
For example to test mips32 inside an container:
```sh
make mips32_test
```
### Docker layers
Dockerfile is splitted in several stages.
![docker](doc/docker.svg)
## Makefile/Vagrant testing
To test build for FreeBSD we are using Vagrant and VirtualBox box.
This is similar to the docker stuff but use `vagrant` as `docker` cli and
VirtuaBox to replace the docker engine daemon.

64
ci/doc/docker.dot Normal file
View File

@ -0,0 +1,64 @@
@startdot
digraph DockerDeps {
//rankdir=BT;
rankdir=TD;
node [shape=cylinder, style="rounded,filled", color=black, fillcolor=royalblue];
DISTRO_IMG [label="ubuntu:latest"];
PKG [label="packages\ne.g. cmake, g++", shape=box3d];
SRC [label="git repo", shape=folder];
SPL [label="sample", shape=folder];
subgraph clusterDockerfile {
ENV_IMG [label="cpu_features:amd64_env\nenv"];
DEVEL_IMG [label="cpu_features:amd64_devel\ndevel"];
BUILD_IMG [label="cpu_features:amd64_build\nbuild"];
TEST_IMG [label="cpu_features:amd64_test\ntest"];
INSTALL_ENV_IMG [label="cpu_features:amd64_install_env\ninstall_env"];
INSTALL_DEVEL_IMG [label="cpu_features:amd64_install_devel\ninstall_devel"];
INSTALL_BUILD_IMG [label="cpu_features:amd64_install_build\ninstall_build"];
INSTALL_TEST_IMG [label="cpu_features:amd64_install_test\ninstall_test"];
ENV_IMG -> DEVEL_IMG;
DEVEL_IMG -> BUILD_IMG;
BUILD_IMG -> TEST_IMG;
ENV_IMG -> INSTALL_ENV_IMG;
BUILD_IMG -> INSTALL_ENV_IMG [label="copy install", style="dashed"];
INSTALL_ENV_IMG -> INSTALL_DEVEL_IMG;
SPL -> INSTALL_DEVEL_IMG [label="copy", style="dashed"];
INSTALL_DEVEL_IMG -> INSTALL_BUILD_IMG;
INSTALL_BUILD_IMG -> INSTALL_TEST_IMG;
color=royalblue;
label = "docker/amd64/Dockerfile";
}
DISTRO_IMG -> ENV_IMG;
PKG -> ENV_IMG [label="install", style="dashed"];
SRC -> DEVEL_IMG [label="copy", style="dashed"];
subgraph clusterCache {
node [shape=note, style="rounded,filled", color=black, fillcolor=royalblue];
ENV_TAR [label="docker_amd64_env.tar"];
DEVEL_TAR [label="docker_amd64_devel.tar"];
BUILD_TAR [label="docker_amd64_build.tar"];
TEST_TAR [label="docker_amd64_test.tar"];
INSTALL_ENV_TAR [label="docker_amd64_install_env.tar"];
INSTALL_DEVEL_TAR [label="docker_amd64_install_devel.tar"];
INSTALL_BUILD_TAR [label="docker_amd64_install_build.tar"];
INSTALL_TEST_TAR [label="docker_amd64_install_test.tar"];
edge [color=red];
ENV_IMG -> ENV_TAR [label="make save_amd64_env"];
DEVEL_IMG -> DEVEL_TAR [label="make save_amd64_devel"];
BUILD_IMG -> BUILD_TAR [label="make save_amd64_build"];
TEST_IMG -> TEST_TAR [label="make save_amd64_test"];
INSTALL_ENV_IMG -> INSTALL_ENV_TAR [label="make save_amd64_install_env"];
INSTALL_DEVEL_IMG -> INSTALL_DEVEL_TAR [label="make save_amd64_install_devel"];
INSTALL_BUILD_IMG -> INSTALL_BUILD_TAR [label="make save_amd64_install_build"];
INSTALL_TEST_IMG -> INSTALL_TEST_TAR [label="make save_amd64_install_test"];
color=royalblue;
label = "cache/amd64/";
}
}
@enddot

312
ci/doc/docker.svg Normal file
View File

@ -0,0 +1,312 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 2.49.2 (0)
-->
<!-- Title: DockerDeps Pages: 1 -->
<svg width="1904pt" height="900pt"
viewBox="0.00 0.00 1904.00 899.75" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 895.75)">
<title>DockerDeps</title>
<polygon fill="white" stroke="transparent" points="-4,4 -4,-895.75 1900,-895.75 1900,4 -4,4"/>
<g id="clust1" class="cluster">
<title>clusterDockerfile</title>
<polygon fill="none" stroke="royalblue" points="691,-116 691,-812.75 1253,-812.75 1253,-116 691,-116"/>
<text text-anchor="middle" x="972" y="-797.55" font-family="Times,serif" font-size="14.00">docker/amd64/Dockerfile</text>
</g>
<g id="clust2" class="cluster">
<title>clusterCache</title>
<polygon fill="none" stroke="royalblue" points="8,-8 8,-83 1826,-83 1826,-8 8,-8"/>
<text text-anchor="middle" x="917" y="-67.8" font-family="Times,serif" font-size="14.00">cache/amd64/</text>
</g>
<!-- DISTRO_IMG -->
<g id="node1" class="node">
<title>DISTRO_IMG</title>
<path fill="royalblue" stroke="black" d="M893.5,-887.48C893.5,-889.28 868.18,-890.75 837,-890.75 805.82,-890.75 780.5,-889.28 780.5,-887.48 780.5,-887.48 780.5,-858.02 780.5,-858.02 780.5,-856.22 805.82,-854.75 837,-854.75 868.18,-854.75 893.5,-856.22 893.5,-858.02 893.5,-858.02 893.5,-887.48 893.5,-887.48"/>
<path fill="none" stroke="black" d="M893.5,-887.48C893.5,-885.67 868.18,-884.2 837,-884.2 805.82,-884.2 780.5,-885.67 780.5,-887.48"/>
<text text-anchor="middle" x="837" y="-869.05" font-family="Times,serif" font-size="14.00">ubuntu:latest</text>
</g>
<!-- ENV_IMG -->
<g id="node5" class="node">
<title>ENV_IMG</title>
<path fill="royalblue" stroke="black" d="M1005,-777.1C1005,-779.74 961.52,-781.88 908,-781.88 854.48,-781.88 811,-779.74 811,-777.1 811,-777.1 811,-734.15 811,-734.15 811,-731.51 854.48,-729.37 908,-729.37 961.52,-729.37 1005,-731.51 1005,-734.15 1005,-734.15 1005,-777.1 1005,-777.1"/>
<path fill="none" stroke="black" d="M1005,-777.1C1005,-774.47 961.52,-772.33 908,-772.33 854.48,-772.33 811,-774.47 811,-777.1"/>
<text text-anchor="middle" x="908" y="-759.42" font-family="Times,serif" font-size="14.00">cpu_features:amd64_env</text>
<text text-anchor="middle" x="908" y="-744.42" font-family="Times,serif" font-size="14.00">env</text>
</g>
<!-- DISTRO_IMG&#45;&gt;ENV_IMG -->
<g id="edge10" class="edge">
<title>DISTRO_IMG&#45;&gt;ENV_IMG</title>
<path fill="none" stroke="black" d="M847.78,-854.26C858.17,-837.42 874.16,-811.49 887.05,-790.59"/>
<polygon fill="black" stroke="black" points="890.09,-792.33 892.37,-781.98 884.14,-788.65 890.09,-792.33"/>
</g>
<!-- PKG -->
<g id="node2" class="node">
<title>PKG</title>
<polygon fill="royalblue" stroke="black" points="1046.5,-891.75 915.5,-891.75 911.5,-887.75 911.5,-853.75 1042.5,-853.75 1046.5,-857.75 1046.5,-891.75"/>
<polyline fill="none" stroke="black" points="1042.5,-887.75 911.5,-887.75 "/>
<polyline fill="none" stroke="black" points="1042.5,-887.75 1042.5,-853.75 "/>
<polyline fill="none" stroke="black" points="1042.5,-887.75 1046.5,-891.75 "/>
<text text-anchor="middle" x="979" y="-876.55" font-family="Times,serif" font-size="14.00">packages</text>
<text text-anchor="middle" x="979" y="-861.55" font-family="Times,serif" font-size="14.00">e.g. cmake, g++</text>
</g>
<!-- PKG&#45;&gt;ENV_IMG -->
<g id="edge11" class="edge">
<title>PKG&#45;&gt;ENV_IMG</title>
<path fill="none" stroke="black" stroke-dasharray="5,2" d="M967.75,-853.51C957.4,-836.72 941.77,-811.38 929.09,-790.83"/>
<polygon fill="black" stroke="black" points="931.91,-788.73 923.69,-782.06 925.96,-792.41 931.91,-788.73"/>
<text text-anchor="middle" x="978.5" y="-824.55" font-family="Times,serif" font-size="14.00">install</text>
</g>
<!-- SRC -->
<g id="node3" class="node">
<title>SRC</title>
<polygon fill="royalblue" stroke="black" points="1334.5,-773.62 1331.5,-777.62 1310.5,-777.62 1307.5,-773.62 1261.5,-773.62 1261.5,-737.62 1334.5,-737.62 1334.5,-773.62"/>
<text text-anchor="middle" x="1298" y="-751.92" font-family="Times,serif" font-size="14.00">git repo</text>
</g>
<!-- DEVEL_IMG -->
<g id="node6" class="node">
<title>DEVEL_IMG</title>
<path fill="royalblue" stroke="black" d="M1189,-673.85C1189,-676.49 1142.83,-678.63 1086,-678.63 1029.17,-678.63 983,-676.49 983,-673.85 983,-673.85 983,-630.9 983,-630.9 983,-628.26 1029.17,-626.12 1086,-626.12 1142.83,-626.12 1189,-628.26 1189,-630.9 1189,-630.9 1189,-673.85 1189,-673.85"/>
<path fill="none" stroke="black" d="M1189,-673.85C1189,-671.22 1142.83,-669.08 1086,-669.08 1029.17,-669.08 983,-671.22 983,-673.85"/>
<text text-anchor="middle" x="1086" y="-656.17" font-family="Times,serif" font-size="14.00">cpu_features:amd64_devel</text>
<text text-anchor="middle" x="1086" y="-641.17" font-family="Times,serif" font-size="14.00">devel</text>
</g>
<!-- SRC&#45;&gt;DEVEL_IMG -->
<g id="edge12" class="edge">
<title>SRC&#45;&gt;DEVEL_IMG</title>
<path fill="none" stroke="black" stroke-dasharray="5,2" d="M1271.39,-737.62C1266.66,-734.8 1261.73,-731.99 1257,-729.5 1224.81,-712.57 1188.08,-695.89 1156.94,-682.48"/>
<polygon fill="black" stroke="black" points="1158.03,-679.14 1147.46,-678.43 1155.28,-685.58 1158.03,-679.14"/>
<text text-anchor="middle" x="1237" y="-700.3" font-family="Times,serif" font-size="14.00">copy</text>
</g>
<!-- SPL -->
<g id="node4" class="node">
<title>SPL</title>
<polygon fill="royalblue" stroke="black" points="767,-477.88 764,-481.88 743,-481.88 740,-477.88 699,-477.88 699,-441.88 767,-441.88 767,-477.88"/>
<text text-anchor="middle" x="733" y="-456.18" font-family="Times,serif" font-size="14.00">sample</text>
</g>
<!-- INSTALL_DEVEL_IMG -->
<g id="node10" class="node">
<title>INSTALL_DEVEL_IMG</title>
<path fill="royalblue" stroke="black" d="M956.5,-378.1C956.5,-380.74 898.9,-382.88 828,-382.88 757.1,-382.88 699.5,-380.74 699.5,-378.1 699.5,-378.1 699.5,-335.15 699.5,-335.15 699.5,-332.51 757.1,-330.37 828,-330.37 898.9,-330.37 956.5,-332.51 956.5,-335.15 956.5,-335.15 956.5,-378.1 956.5,-378.1"/>
<path fill="none" stroke="black" d="M956.5,-378.1C956.5,-375.47 898.9,-373.33 828,-373.33 757.1,-373.33 699.5,-375.47 699.5,-378.1"/>
<text text-anchor="middle" x="828" y="-360.43" font-family="Times,serif" font-size="14.00">cpu_features:amd64_install_devel</text>
<text text-anchor="middle" x="828" y="-345.43" font-family="Times,serif" font-size="14.00">install_devel</text>
</g>
<!-- SPL&#45;&gt;INSTALL_DEVEL_IMG -->
<g id="edge7" class="edge">
<title>SPL&#45;&gt;INSTALL_DEVEL_IMG</title>
<path fill="none" stroke="black" stroke-dasharray="5,2" d="M749.12,-441.7C762.24,-427.71 781.16,-407.54 797.18,-390.47"/>
<polygon fill="black" stroke="black" points="800.02,-392.56 804.31,-382.87 794.91,-387.77 800.02,-392.56"/>
<text text-anchor="middle" x="803" y="-404.55" font-family="Times,serif" font-size="14.00">copy</text>
</g>
<!-- ENV_IMG&#45;&gt;DEVEL_IMG -->
<g id="edge1" class="edge">
<title>ENV_IMG&#45;&gt;DEVEL_IMG</title>
<path fill="none" stroke="black" d="M952.46,-729.34C976.87,-715.45 1007.3,-698.14 1032.95,-683.55"/>
<polygon fill="black" stroke="black" points="1034.84,-686.5 1041.8,-678.52 1031.38,-680.42 1034.84,-686.5"/>
</g>
<!-- INSTALL_ENV_IMG -->
<g id="node9" class="node">
<title>INSTALL_ENV_IMG</title>
<path fill="royalblue" stroke="black" d="M1030.5,-481.35C1030.5,-483.99 975.59,-486.13 908,-486.13 840.41,-486.13 785.5,-483.99 785.5,-481.35 785.5,-481.35 785.5,-438.4 785.5,-438.4 785.5,-435.76 840.41,-433.62 908,-433.62 975.59,-433.62 1030.5,-435.76 1030.5,-438.4 1030.5,-438.4 1030.5,-481.35 1030.5,-481.35"/>
<path fill="none" stroke="black" d="M1030.5,-481.35C1030.5,-478.72 975.59,-476.58 908,-476.58 840.41,-476.58 785.5,-478.72 785.5,-481.35"/>
<text text-anchor="middle" x="908" y="-463.68" font-family="Times,serif" font-size="14.00">cpu_features:amd64_install_env</text>
<text text-anchor="middle" x="908" y="-448.68" font-family="Times,serif" font-size="14.00">install_env</text>
</g>
<!-- ENV_IMG&#45;&gt;INSTALL_ENV_IMG -->
<g id="edge4" class="edge">
<title>ENV_IMG&#45;&gt;INSTALL_ENV_IMG</title>
<path fill="none" stroke="black" d="M908,-729.33C908,-676.94 908,-556.49 908,-496.37"/>
<polygon fill="black" stroke="black" points="911.5,-496.22 908,-486.22 904.5,-496.22 911.5,-496.22"/>
</g>
<!-- ENV_TAR -->
<g id="node13" class="node">
<title>ENV_TAR</title>
<polygon fill="royalblue" stroke="black" points="186,-52 16,-52 16,-16 192,-16 192,-46 186,-52"/>
<polyline fill="none" stroke="black" points="186,-52 186,-46 "/>
<polyline fill="none" stroke="black" points="192,-46 186,-46 "/>
<text text-anchor="middle" x="104" y="-30.3" font-family="Times,serif" font-size="14.00">docker_amd64_env.tar</text>
</g>
<!-- ENV_IMG&#45;&gt;ENV_TAR -->
<g id="edge13" class="edge">
<title>ENV_IMG&#45;&gt;ENV_TAR</title>
<path fill="none" stroke="red" d="M810.87,-751.31C609.47,-743.14 165,-717.82 165,-653.38 165,-653.38 165,-653.38 165,-149.12 165,-115.26 143.85,-81.71 126.46,-59.84"/>
<polygon fill="red" stroke="red" points="129.09,-57.54 120.03,-52.05 123.7,-61.99 129.09,-57.54"/>
<text text-anchor="middle" x="246.5" y="-404.55" font-family="Times,serif" font-size="14.00">make save_amd64_env</text>
</g>
<!-- BUILD_IMG -->
<g id="node7" class="node">
<title>BUILD_IMG</title>
<path fill="royalblue" stroke="black" d="M1245,-584.6C1245,-587.24 1199.28,-589.38 1143,-589.38 1086.72,-589.38 1041,-587.24 1041,-584.6 1041,-584.6 1041,-541.65 1041,-541.65 1041,-539.01 1086.72,-536.87 1143,-536.87 1199.28,-536.87 1245,-539.01 1245,-541.65 1245,-541.65 1245,-584.6 1245,-584.6"/>
<path fill="none" stroke="black" d="M1245,-584.6C1245,-581.97 1199.28,-579.83 1143,-579.83 1086.72,-579.83 1041,-581.97 1041,-584.6"/>
<text text-anchor="middle" x="1143" y="-566.92" font-family="Times,serif" font-size="14.00">cpu_features:amd64_build</text>
<text text-anchor="middle" x="1143" y="-551.92" font-family="Times,serif" font-size="14.00">build</text>
</g>
<!-- DEVEL_IMG&#45;&gt;BUILD_IMG -->
<g id="edge2" class="edge">
<title>DEVEL_IMG&#45;&gt;BUILD_IMG</title>
<path fill="none" stroke="black" d="M1102.49,-626.14C1108.28,-617.28 1114.88,-607.17 1121.04,-597.73"/>
<polygon fill="black" stroke="black" points="1124.01,-599.59 1126.55,-589.3 1118.15,-595.76 1124.01,-599.59"/>
</g>
<!-- DEVEL_TAR -->
<g id="node14" class="node">
<title>DEVEL_TAR</title>
<polygon fill="royalblue" stroke="black" points="395.5,-52 210.5,-52 210.5,-16 401.5,-16 401.5,-46 395.5,-52"/>
<polyline fill="none" stroke="black" points="395.5,-52 395.5,-46 "/>
<polyline fill="none" stroke="black" points="401.5,-46 395.5,-46 "/>
<text text-anchor="middle" x="306" y="-30.3" font-family="Times,serif" font-size="14.00">docker_amd64_devel.tar</text>
</g>
<!-- DEVEL_IMG&#45;&gt;DEVEL_TAR -->
<g id="edge14" class="edge">
<title>DEVEL_IMG&#45;&gt;DEVEL_TAR</title>
<path fill="none" stroke="red" d="M982.94,-648.59C792.56,-642.05 405,-621.67 405,-564.12 405,-564.12 405,-564.12 405,-149.12 405,-110.26 371.83,-78.15 343.9,-58"/>
<polygon fill="red" stroke="red" points="345.65,-54.96 335.44,-52.14 341.66,-60.71 345.65,-54.96"/>
<text text-anchor="middle" x="493" y="-352.93" font-family="Times,serif" font-size="14.00">make save_amd64_devel</text>
</g>
<!-- TEST_IMG -->
<g id="node8" class="node">
<title>TEST_IMG</title>
<path fill="royalblue" stroke="black" d="M1245,-481.35C1245,-483.99 1201.07,-486.13 1147,-486.13 1092.93,-486.13 1049,-483.99 1049,-481.35 1049,-481.35 1049,-438.4 1049,-438.4 1049,-435.76 1092.93,-433.62 1147,-433.62 1201.07,-433.62 1245,-435.76 1245,-438.4 1245,-438.4 1245,-481.35 1245,-481.35"/>
<path fill="none" stroke="black" d="M1245,-481.35C1245,-478.72 1201.07,-476.58 1147,-476.58 1092.93,-476.58 1049,-478.72 1049,-481.35"/>
<text text-anchor="middle" x="1147" y="-463.68" font-family="Times,serif" font-size="14.00">cpu_features:amd64_test</text>
<text text-anchor="middle" x="1147" y="-448.68" font-family="Times,serif" font-size="14.00">test</text>
</g>
<!-- BUILD_IMG&#45;&gt;TEST_IMG -->
<g id="edge3" class="edge">
<title>BUILD_IMG&#45;&gt;TEST_IMG</title>
<path fill="none" stroke="black" d="M1144,-536.84C1144.48,-524.63 1145.07,-509.79 1145.59,-496.47"/>
<polygon fill="black" stroke="black" points="1149.1,-496.32 1146,-486.19 1142.11,-496.05 1149.1,-496.32"/>
</g>
<!-- BUILD_IMG&#45;&gt;INSTALL_ENV_IMG -->
<g id="edge5" class="edge">
<title>BUILD_IMG&#45;&gt;INSTALL_ENV_IMG</title>
<path fill="none" stroke="black" stroke-dasharray="5,2" d="M1084.61,-536.97C1051.68,-522.78 1010.38,-504.99 976,-490.17"/>
<polygon fill="black" stroke="black" points="977.07,-486.82 966.5,-486.08 974.3,-493.25 977.07,-486.82"/>
<text text-anchor="middle" x="1080" y="-507.8" font-family="Times,serif" font-size="14.00">copy install</text>
</g>
<!-- BUILD_TAR -->
<g id="node15" class="node">
<title>BUILD_TAR</title>
<polygon fill="royalblue" stroke="black" points="1812,-52 1630,-52 1630,-16 1818,-16 1818,-46 1812,-52"/>
<polyline fill="none" stroke="black" points="1812,-52 1812,-46 "/>
<polyline fill="none" stroke="black" points="1818,-46 1812,-46 "/>
<text text-anchor="middle" x="1724" y="-30.3" font-family="Times,serif" font-size="14.00">docker_amd64_build.tar</text>
</g>
<!-- BUILD_IMG&#45;&gt;BUILD_TAR -->
<g id="edge15" class="edge">
<title>BUILD_IMG&#45;&gt;BUILD_TAR</title>
<path fill="none" stroke="red" d="M1245.18,-554.53C1411.4,-540.79 1722,-508.71 1722,-460.88 1722,-460.88 1722,-460.88 1722,-149.12 1722,-119.36 1722.69,-85.23 1723.26,-62.11"/>
<polygon fill="red" stroke="red" points="1726.76,-62.1 1723.52,-52.01 1719.76,-61.92 1726.76,-62.1"/>
<text text-anchor="middle" x="1809" y="-301.3" font-family="Times,serif" font-size="14.00">make save_amd64_build</text>
</g>
<!-- TEST_TAR -->
<g id="node16" class="node">
<title>TEST_TAR</title>
<polygon fill="royalblue" stroke="black" points="1606,-52 1432,-52 1432,-16 1612,-16 1612,-46 1606,-52"/>
<polyline fill="none" stroke="black" points="1606,-52 1606,-46 "/>
<polyline fill="none" stroke="black" points="1612,-46 1606,-46 "/>
<text text-anchor="middle" x="1522" y="-30.3" font-family="Times,serif" font-size="14.00">docker_amd64_test.tar</text>
</g>
<!-- TEST_IMG&#45;&gt;TEST_TAR -->
<g id="edge16" class="edge">
<title>TEST_IMG&#45;&gt;TEST_TAR</title>
<path fill="none" stroke="red" d="M1245.07,-451.87C1356.77,-441.13 1524,-415.4 1524,-357.62 1524,-357.62 1524,-357.62 1524,-149.12 1524,-119.36 1523.31,-85.23 1522.74,-62.11"/>
<polygon fill="red" stroke="red" points="1526.24,-61.92 1522.48,-52.01 1519.24,-62.1 1526.24,-61.92"/>
<text text-anchor="middle" x="1607" y="-249.68" font-family="Times,serif" font-size="14.00">make save_amd64_test</text>
</g>
<!-- INSTALL_ENV_IMG&#45;&gt;INSTALL_DEVEL_IMG -->
<g id="edge6" class="edge">
<title>INSTALL_ENV_IMG&#45;&gt;INSTALL_DEVEL_IMG</title>
<path fill="none" stroke="black" d="M888.02,-433.59C877.81,-420.66 865.25,-404.76 854.26,-390.86"/>
<polygon fill="black" stroke="black" points="856.95,-388.62 848,-382.94 851.46,-392.96 856.95,-388.62"/>
</g>
<!-- INSTALL_ENV_TAR -->
<g id="node17" class="node">
<title>INSTALL_ENV_TAR</title>
<polygon fill="royalblue" stroke="black" points="1407.5,-52 1186.5,-52 1186.5,-16 1413.5,-16 1413.5,-46 1407.5,-52"/>
<polyline fill="none" stroke="black" points="1407.5,-52 1407.5,-46 "/>
<polyline fill="none" stroke="black" points="1413.5,-46 1407.5,-46 "/>
<text text-anchor="middle" x="1300" y="-30.3" font-family="Times,serif" font-size="14.00">docker_amd64_install_env.tar</text>
</g>
<!-- INSTALL_ENV_IMG&#45;&gt;INSTALL_ENV_TAR -->
<g id="edge17" class="edge">
<title>INSTALL_ENV_IMG&#45;&gt;INSTALL_ENV_TAR</title>
<path fill="none" stroke="red" d="M1012.88,-434.97C1121.03,-409.58 1274,-371.26 1274,-357.62 1274,-357.62 1274,-357.62 1274,-149.12 1274,-118.64 1282.93,-84.69 1290.32,-61.81"/>
<polygon fill="red" stroke="red" points="1293.71,-62.72 1293.57,-52.12 1287.07,-60.49 1293.71,-62.72"/>
<text text-anchor="middle" x="1381" y="-249.68" font-family="Times,serif" font-size="14.00">make save_amd64_install_env</text>
</g>
<!-- INSTALL_BUILD_IMG -->
<g id="node11" class="node">
<title>INSTALL_BUILD_IMG</title>
<path fill="royalblue" stroke="black" d="M955.5,-274.85C955.5,-277.49 898.35,-279.63 828,-279.63 757.65,-279.63 700.5,-277.49 700.5,-274.85 700.5,-274.85 700.5,-231.9 700.5,-231.9 700.5,-229.26 757.65,-227.12 828,-227.12 898.35,-227.12 955.5,-229.26 955.5,-231.9 955.5,-231.9 955.5,-274.85 955.5,-274.85"/>
<path fill="none" stroke="black" d="M955.5,-274.85C955.5,-272.22 898.35,-270.08 828,-270.08 757.65,-270.08 700.5,-272.22 700.5,-274.85"/>
<text text-anchor="middle" x="828" y="-257.18" font-family="Times,serif" font-size="14.00">cpu_features:amd64_install_build</text>
<text text-anchor="middle" x="828" y="-242.18" font-family="Times,serif" font-size="14.00">install_build</text>
</g>
<!-- INSTALL_DEVEL_IMG&#45;&gt;INSTALL_BUILD_IMG -->
<g id="edge8" class="edge">
<title>INSTALL_DEVEL_IMG&#45;&gt;INSTALL_BUILD_IMG</title>
<path fill="none" stroke="black" d="M828,-330.34C828,-318.13 828,-303.29 828,-289.97"/>
<polygon fill="black" stroke="black" points="831.5,-289.69 828,-279.69 824.5,-289.69 831.5,-289.69"/>
</g>
<!-- INSTALL_DEVEL_TAR -->
<g id="node18" class="node">
<title>INSTALL_DEVEL_TAR</title>
<polygon fill="royalblue" stroke="black" points="656,-52 420,-52 420,-16 662,-16 662,-46 656,-52"/>
<polyline fill="none" stroke="black" points="656,-52 656,-46 "/>
<polyline fill="none" stroke="black" points="662,-46 656,-46 "/>
<text text-anchor="middle" x="541" y="-30.3" font-family="Times,serif" font-size="14.00">docker_amd64_install_devel.tar</text>
</g>
<!-- INSTALL_DEVEL_IMG&#45;&gt;INSTALL_DEVEL_TAR -->
<g id="edge18" class="edge">
<title>INSTALL_DEVEL_IMG&#45;&gt;INSTALL_DEVEL_TAR</title>
<path fill="none" stroke="red" d="M761.39,-330.48C708.37,-307.05 636.42,-266.99 595,-209.25 562.63,-164.12 549.27,-99.06 544.06,-62.54"/>
<polygon fill="red" stroke="red" points="547.47,-61.64 542.7,-52.18 540.53,-62.55 547.47,-61.64"/>
<text text-anchor="middle" x="708.5" y="-198.05" font-family="Times,serif" font-size="14.00">make save_amd64_install_devel</text>
</g>
<!-- INSTALL_TEST_IMG -->
<g id="node12" class="node">
<title>INSTALL_TEST_IMG</title>
<path fill="royalblue" stroke="black" d="M948.5,-171.6C948.5,-174.24 893.15,-176.38 825,-176.38 756.85,-176.38 701.5,-174.24 701.5,-171.6 701.5,-171.6 701.5,-128.65 701.5,-128.65 701.5,-126.01 756.85,-123.87 825,-123.87 893.15,-123.87 948.5,-126.01 948.5,-128.65 948.5,-128.65 948.5,-171.6 948.5,-171.6"/>
<path fill="none" stroke="black" d="M948.5,-171.6C948.5,-168.97 893.15,-166.83 825,-166.83 756.85,-166.83 701.5,-168.97 701.5,-171.6"/>
<text text-anchor="middle" x="825" y="-153.93" font-family="Times,serif" font-size="14.00">cpu_features:amd64_install_test</text>
<text text-anchor="middle" x="825" y="-138.93" font-family="Times,serif" font-size="14.00">install_test</text>
</g>
<!-- INSTALL_BUILD_IMG&#45;&gt;INSTALL_TEST_IMG -->
<g id="edge9" class="edge">
<title>INSTALL_BUILD_IMG&#45;&gt;INSTALL_TEST_IMG</title>
<path fill="none" stroke="black" d="M827.25,-227.09C826.89,-214.88 826.45,-200.04 826.05,-186.72"/>
<polygon fill="black" stroke="black" points="829.54,-186.33 825.75,-176.44 822.55,-186.54 829.54,-186.33"/>
</g>
<!-- INSTALL_BUILD_TAR -->
<g id="node19" class="node">
<title>INSTALL_BUILD_TAR</title>
<polygon fill="royalblue" stroke="black" points="1162.5,-52 929.5,-52 929.5,-16 1168.5,-16 1168.5,-46 1162.5,-52"/>
<polyline fill="none" stroke="black" points="1162.5,-52 1162.5,-46 "/>
<polyline fill="none" stroke="black" points="1168.5,-46 1162.5,-46 "/>
<text text-anchor="middle" x="1049" y="-30.3" font-family="Times,serif" font-size="14.00">docker_amd64_install_build.tar</text>
</g>
<!-- INSTALL_BUILD_IMG&#45;&gt;INSTALL_BUILD_TAR -->
<g id="edge19" class="edge">
<title>INSTALL_BUILD_IMG&#45;&gt;INSTALL_BUILD_TAR</title>
<path fill="none" stroke="red" d="M882.76,-227.11C907.43,-214.09 935.91,-196.66 958,-176.25 994.16,-142.85 1022.19,-92.11 1037.09,-61.41"/>
<polygon fill="red" stroke="red" points="1040.34,-62.72 1041.46,-52.19 1034.02,-59.72 1040.34,-62.72"/>
<text text-anchor="middle" x="1117.5" y="-146.43" font-family="Times,serif" font-size="14.00">make save_amd64_install_build</text>
</g>
<!-- INSTALL_TEST_TAR -->
<g id="node20" class="node">
<title>INSTALL_TEST_TAR</title>
<polygon fill="royalblue" stroke="black" points="905.5,-52 680.5,-52 680.5,-16 911.5,-16 911.5,-46 905.5,-52"/>
<polyline fill="none" stroke="black" points="905.5,-52 905.5,-46 "/>
<polyline fill="none" stroke="black" points="911.5,-46 905.5,-46 "/>
<text text-anchor="middle" x="796" y="-30.3" font-family="Times,serif" font-size="14.00">docker_amd64_install_test.tar</text>
</g>
<!-- INSTALL_TEST_IMG&#45;&gt;INSTALL_TEST_TAR -->
<g id="edge20" class="edge">
<title>INSTALL_TEST_IMG&#45;&gt;INSTALL_TEST_TAR</title>
<path fill="none" stroke="red" d="M799.99,-123.98C795.9,-118.47 792.26,-112.36 790,-106 785.07,-92.11 786.03,-75.77 788.46,-62.27"/>
<polygon fill="red" stroke="red" points="791.96,-62.66 790.65,-52.15 785.12,-61.19 791.96,-62.66"/>
<text text-anchor="middle" x="898.5" y="-94.8" font-family="Times,serif" font-size="14.00">make save_amd64_install_test</text>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 21 KiB

7
ci/doc/generate_image.sh Executable file
View File

@ -0,0 +1,7 @@
#!/usr/bin/env bash
set -ex
rm -f ./*.svg ./*.png
for i in *.dot; do
plantuml -Tsvg "$i";
done

View File

@ -0,0 +1,48 @@
# Create a virtual environment with all tools installed
# ref: https://hub.docker.com/_/ubuntu
FROM ubuntu:latest AS env
LABEL maintainer="corentinl@google.com"
# Install system build dependencies
ENV PATH=/usr/local/bin:$PATH
RUN apt-get update -qq \
&& DEBIAN_FRONTEND=noninteractive apt-get install -yq git wget libssl-dev build-essential \
ninja-build python3 pkgconf libglib2.0-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
ENTRYPOINT ["/usr/bin/bash", "-c"]
CMD ["/usr/bin/bash"]
# Install CMake 3.21.3
RUN wget "https://cmake.org/files/v3.21/cmake-3.21.3-linux-x86_64.sh" \
&& chmod a+x cmake-3.21.3-linux-x86_64.sh \
&& ./cmake-3.21.3-linux-x86_64.sh --prefix=/usr/local/ --skip-license \
&& rm cmake-3.21.3-linux-x86_64.sh
FROM env AS devel
WORKDIR /home/project
COPY . .
FROM devel AS build
RUN cmake -version
RUN cmake -S. -Bbuild
RUN cmake --build build --target all -v
RUN cmake --build build --target install -v
FROM build AS test
ENV CTEST_OUTPUT_ON_FAILURE=1
RUN cmake --build build --target test -v
# Test install rules
FROM env AS install_env
COPY --from=build /usr/local /usr/local/
FROM install_env AS install_devel
WORKDIR /home/sample
COPY ci/sample .
FROM install_devel AS install_build
RUN cmake -S. -Bbuild
RUN cmake --build build --target all -v
FROM install_build AS install_test
RUN cmake --build build --target test

View File

@ -0,0 +1,34 @@
# Create a virtual environment with all tools installed
# ref: https://hub.docker.com/_/ubuntu
FROM ubuntu:latest AS env
LABEL maintainer="corentinl@google.com"
# Install system build dependencies
ENV PATH=/usr/local/bin:$PATH
RUN apt-get update -qq \
&& DEBIAN_FRONTEND=noninteractive apt-get install -yq git wget libssl-dev build-essential \
ninja-build python3 pkgconf libglib2.0-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
ENTRYPOINT ["/usr/bin/bash", "-c"]
CMD ["/usr/bin/bash"]
# Install CMake 3.21.3
RUN wget "https://cmake.org/files/v3.21/cmake-3.21.3-linux-x86_64.sh" \
&& chmod a+x cmake-3.21.3-linux-x86_64.sh \
&& ./cmake-3.21.3-linux-x86_64.sh --prefix=/usr/local/ --skip-license \
&& rm cmake-3.21.3-linux-x86_64.sh
FROM env AS devel
WORKDIR /home/project
COPY . .
ARG TARGET
ENV TARGET ${TARGET:-unknown}
FROM devel AS build
RUN cmake -version
RUN ./scripts/run_integration.sh build
FROM build AS test
RUN ./scripts/run_integration.sh qemu
RUN ./scripts/run_integration.sh test

22
ci/sample/CMakeLists.txt Normal file
View File

@ -0,0 +1,22 @@
cmake_minimum_required(VERSION 3.15)
project(Sample VERSION 1.0.0 LANGUAGES CXX)
include(CTest)
find_package(CpuFeatures REQUIRED)
add_executable(sample main.cpp)
target_compile_features(sample PUBLIC cxx_std_11)
set_target_properties(sample PROPERTIES
CXX_STANDARD 11
CXX_STANDARD_REQUIRED ON
VERSION ${PROJECT_VERSION})
target_link_libraries(sample PRIVATE CpuFeatures::cpu_features)
if(BUILD_TESTING)
add_test(NAME sample_test COMMAND sample)
endif()
include(GNUInstallDirs)
install(TARGETS sample
EXPORT SampleTargets
DESTINATION ${CMAKE_INSTALL_BIN_DIR})

11
ci/sample/main.cpp Normal file
View File

@ -0,0 +1,11 @@
#include <iostream>
#include "cpuinfo_x86.h"
using namespace cpu_features;
int main(int /*argc*/, char** /*argv*/) {
static const X86Features features = GetX86Info().features;
std::cout << std::endl;
return 0;
}