ci: Add Bazel CI

* Add Bazel Dockerfile
* Update Bazel doc
* Add Bazel docker diagrams
* Add Github workflow for bazel
* GH workflow disable fail-fast
This commit is contained in:
Mizux Seiha
2020-04-01 14:03:57 +02:00
parent 9c880b2410
commit e1af0c7092
14 changed files with 608 additions and 9 deletions

23
.github/workflows/docker_bazel.yml vendored Normal file
View File

@@ -0,0 +1,23 @@
name: Docker Bazel
on: [push, pull_request]
jobs:
Distros:
runs-on: ubuntu-latest
strategy:
matrix:
distro: [alpine, archlinux, centos, debian, fedora, opensuse, ubuntu]
fail-fast: false
env:
DISTRO: ${{ matrix.distro }}
steps:
- uses: actions/checkout@v2
- name: Build env image
run: make --directory=bazel ${DISTRO}_env
- name: Build devel image
run: make --directory=bazel ${DISTRO}_devel
- name: Build project
run: make --directory=bazel ${DISTRO}_build
- name: Test project
run: make --directory=bazel ${DISTRO}_test

135
bazel/Makefile Normal file
View File

@@ -0,0 +1,135 @@
PROJECT := ortools
BUILD_SYSTEM := bazel
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}<stage>${RESET}: build all <stage> docker images."
@echo -e "\t${BOLD}<distro>_<stage>${RESET}: build the <stage> docker image for a specific distro."
@echo -e "\t${BOLD}save_<stage>${RESET}: Save all <stage> docker images."
@echo -e "\t${BOLD}save_<distro>_<stage>${RESET}: Save the <stage> docker image for a specific distro."
@echo -e "\t${BOLD}sh_<distro>_<stage>${RESET}: run a container using the <stage> docker image (debug purpose)."
@echo
@echo -e "\t${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
@echo -e "\t${BOLD}<distro>${RESET}:"
@echo -e "\t\t${BOLD}alpine${RESET} (edge)"
@echo -e "\t\t${BOLD}archlinux${RESET} (latest)"
@echo -e "\t\t${BOLD}centos${RESET} (latest)"
@echo -e "\t\t${BOLD}debian${RESET} (latest)"
@echo -e "\t\t${BOLD}fedora${RESET} (latest)"
@echo -e "\t\t${BOLD}opensuse${RESET} (tumbleweed)"
@echo -e "\t\t${BOLD}ubuntu${RESET} (rolling)"
@echo -e "\te.g. 'make ubuntu_test'"
@echo
@echo -e "\t${BOLD}clean${RESET}: Remove cache and ALL docker images."
@echo -e "\t${BOLD}clean_<distro>${RESET}: Remove cache and docker images for the specified distro."
@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_distro 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}/${BUILD_SYSTEM}
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
# Currently supported distro
DISTROS = alpine archlinux centos debian fedora opensuse ubuntu
# $* stem
# $< first prerequist
# $@ target name
STAGES = env devel build test
define make-stage-target
#$$(info STAGE: $1)
.PHONY: $1
#$$(info Create targets: $1 $(addsuffix _$1, $(DISTROS)).)
targets_$1 = $(addsuffix _$1, $(DISTROS))
.PHONY: $(targets_$1)
$1: $$(targets_$1)
$$(targets_$1): %_$1: docker/%/Dockerfile
#@docker image rm -f ${IMAGE}:$$*_$1 2>/dev/null
${DOCKER_BUILD_CMD} --target=$1 --tag ${IMAGE}:$$*_$1 -f $$< ..
#$$(info Create targets: save_$1 $(addprefix save_, $(addsuffix _$1, $(DISTROS))) (debug).)
save_targets_$1 = $(addprefix save_, $(addsuffix _$1, $(DISTROS)))
.PHONY: save_$1 $(save_targets_$1)
save_$1: $$(save_targets_$1)
$$(save_targets_$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, $(DISTROS))) (debug).)
sh_targets_$1 = $(addprefix sh_, $(addsuffix _$1, $(DISTROS)))
.PHONY: $(sh_targets_$1)
$$(sh_targets_$1): sh_%_$1: %_$1
${DOCKER_RUN_CMD} -it --name ${PROJECT}_${BUILD_SYSTEM}_$$*_$1 ${IMAGE}:$$*_$1
#$$(info Create targets: $(addprefix clean_, $(addsuffix _$1, $(DISTROS))).)
clean_targets_$1 = $(addprefix clean_, $(addsuffix _$1, $(DISTROS)))
.PHONY: clean_$1 $(clean_targets_$1)
clean_$1: $$(clean_targets_$1)
$$(clean_targets_$1): clean_%_$1:
docker image rm -f ${IMAGE}:$$*_$1 2>/dev/null
rm -f cache/$$*/docker_$1.tar
endef
$(foreach stage,$(STAGES),$(eval $(call make-stage-target,$(stage))))
## CLEAN ##
clean_targets = $(addprefix clean_, $(DISTROS))
.PHONY: clean $(clean_targets)
clean: $(clean_targets)
docker container prune -f
docker image prune -f
-rmdir cache
$(clean_targets): clean_%: $(addprefix clean_%_, $(STAGES))
-rmdir cache/$*
.PHONY: distclean
distclean: clean
-docker container rm -f $$(docker container ls -aq)
-docker image rm -f $$(docker image ls -aq)

View File

@@ -1,6 +1,39 @@
# Docker file for testing
# OR-Tools Bazel Build Instructions
# Bazel Test
```sh
docker build -t bazel -f bazel.Dockerfile ..
```
| OS | |
|:--------|------------------------------------|
| Linux | [![Status][linux_svg]][linux_link] |
| MacOS | [![Status][osx_svg]][osx_link] |
| Windows | [![Status][win_svg]][win_link] |
Dockers: [![Status][docker_svg]][docker_link]
[docker_svg]: https://github.com/google/or-tools/workflows/Docker%20Bazel/badge.svg
[docker_link]: https://github.com/google/or-tools/actions?query=workflow%3A"Docker+Bazel"
## Introduction
<nav for="bazel"> |
<a href="#deps">Dependencies</a> |
<a href="#integration">Integration</a> |
<a href="doc/ci.md">CI</a> |
</nav>
OR-Tools comes with a Bazel based build ([WORKSPACE](../WORKSPACE)) that can be
used on a wide range of platforms. If you don't have Bazel installed already,
you can download it for free from <https://bazel.build/>.
**warning: Currently OR-Tools Bazel doesn't support Python, Java nor .Net, please use
the Makefile or CMake based build instead.**
## [Dependencies](#deps)
OR-Tools depends on severals mandatory libraries.
* Google Abseil-cpp,
* Google Gflags,
* Google Glog,
* Google Protobuf,
* Google Gtest,
* GLPK (GNU Linear Programming Kit)
## [Integrating OR-Tools in your Bazel Project](#integration)
TODO

37
bazel/doc/ci.md Normal file
View File

@@ -0,0 +1,37 @@
# CI: Makefile/Docker 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 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 installed (e.g. tarvis-ci [minimal images](https://docs.travis-ci.com/user/languages/minimal-and-generic/).
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:
```sh
make
```
note: you can also use from top directory
```sh
make --directory=bazel
```
## Example
For example to test inside an `Ubuntu` container:
```sh
make ubuntu_test
```
# Docker Layers
Dockerfile is splitted in several stages.
![docker](docker.svg)

45
bazel/doc/docker.dot Normal file
View File

@@ -0,0 +1,45 @@
@startdot
digraph DockerDeps {
//rankdir=BT;
rankdir=TD;
node [shape=cylinder, style="rounded,filled", color=black, fillcolor=royalblue];
DISTRO_IMG [label="<distro>:latest"];
PKG [label="packages\ne.g. bazel, g++", shape=box3d];
SRC [label="git repo", shape=folder];
subgraph clusterDockerfile {
ENV_IMG [label="ortools/bazel:<distro>_env\nenv"];
DEVEL_IMG [label="ortools/bazel:<distro>_devel\ndevel"];
BUILD_IMG [label="ortools/bazel:<distro>_build\nbuild"];
TEST_IMG [label="ortools/bazel:<distro>_test\ntest"];
edge [color=black];
ENV_IMG -> DEVEL_IMG;
DEVEL_IMG -> BUILD_IMG;
BUILD_IMG -> TEST_IMG;
color=royalblue;
label = "docker/<distro>/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_env.tar"];
DEVEL_TAR [label="docker_devel.tar"];
BUILD_TAR [label="docker_build.tar"];
TEST_TAR [label="docker_test.tar"];
edge [color=red];
ENV_IMG -> ENV_TAR [label="make save_<distro>_env"];
DEVEL_IMG -> DEVEL_TAR [label="make save_<distro>_devel"];
BUILD_IMG -> BUILD_TAR [label="make save_<distro>_build"];
TEST_IMG -> TEST_TAR [label="make save_<distro>_test"];
color=royalblue;
label = "cache/<distro>/";
}
}
@enddot

176
bazel/doc/docker.svg Normal file
View File

@@ -0,0 +1,176 @@
<?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.42.3 (0)
-->
<!-- Title: DockerDeps Pages: 1 -->
<svg width="728pt" height="590pt"
viewBox="0.00 0.00 728.00 590.00" 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 586)">
<title>DockerDeps</title>
<polygon fill="white" stroke="transparent" points="-4,4 -4,-586 724,-586 724,4 -4,4"/>
<g id="clust1" class="cluster">
<title>clusterDockerfile</title>
<polygon fill="none" stroke="royalblue" points="275,-116 275,-503 515,-503 515,-116 275,-116"/>
<text text-anchor="middle" x="395" y="-487.8" font-family="Times,serif" font-size="14.00">docker/&lt;distro&gt;/Dockerfile</text>
</g>
<g id="clust2" class="cluster">
<title>clusterCache</title>
<polygon fill="none" stroke="royalblue" points="8,-8 8,-83 592,-83 592,-8 8,-8"/>
<text text-anchor="middle" x="300" y="-67.8" font-family="Times,serif" font-size="14.00">cache/&lt;distro&gt;/</text>
</g>
<!-- DISTRO_IMG -->
<g id="node1" class="node">
<title>DISTRO_IMG</title>
<path fill="royalblue" stroke="black" d="M382,-577.73C382,-579.53 353.31,-581 318,-581 282.69,-581 254,-579.53 254,-577.73 254,-577.73 254,-548.27 254,-548.27 254,-546.47 282.69,-545 318,-545 353.31,-545 382,-546.47 382,-548.27 382,-548.27 382,-577.73 382,-577.73"/>
<path fill="none" stroke="black" d="M382,-577.73C382,-575.92 353.31,-574.45 318,-574.45 282.69,-574.45 254,-575.92 254,-577.73"/>
<text text-anchor="middle" x="318" y="-559.3" font-family="Times,serif" font-size="14.00">&lt;distro&gt;:latest</text>
</g>
<!-- ENV_IMG -->
<g id="node4" class="node">
<title>ENV_IMG</title>
<path fill="royalblue" stroke="black" d="M496.5,-467.35C496.5,-469.99 449.21,-472.13 391,-472.13 332.79,-472.13 285.5,-469.99 285.5,-467.35 285.5,-467.35 285.5,-424.4 285.5,-424.4 285.5,-421.76 332.79,-419.62 391,-419.62 449.21,-419.62 496.5,-421.76 496.5,-424.4 496.5,-424.4 496.5,-467.35 496.5,-467.35"/>
<path fill="none" stroke="black" d="M496.5,-467.35C496.5,-464.72 449.21,-462.58 391,-462.58 332.79,-462.58 285.5,-464.72 285.5,-467.35"/>
<text text-anchor="middle" x="391" y="-449.68" font-family="Times,serif" font-size="14.00">ortools/bazel:&lt;distro&gt;_env</text>
<text text-anchor="middle" x="391" y="-434.68" font-family="Times,serif" font-size="14.00">env</text>
</g>
<!-- DISTRO_IMG&#45;&gt;ENV_IMG -->
<g id="edge4" class="edge">
<title>DISTRO_IMG&#45;&gt;ENV_IMG</title>
<path fill="none" stroke="black" d="M329.09,-544.51C339.77,-527.67 356.21,-501.74 369.46,-480.84"/>
<polygon fill="black" stroke="black" points="372.53,-482.55 374.92,-472.23 366.61,-478.8 372.53,-482.55"/>
</g>
<!-- PKG -->
<g id="node2" class="node">
<title>PKG</title>
<polygon fill="royalblue" stroke="black" points="527.5,-582 404.5,-582 400.5,-578 400.5,-544 523.5,-544 527.5,-548 527.5,-582"/>
<polyline fill="none" stroke="black" points="523.5,-578 400.5,-578 "/>
<polyline fill="none" stroke="black" points="523.5,-578 523.5,-544 "/>
<polyline fill="none" stroke="black" points="523.5,-578 527.5,-582 "/>
<text text-anchor="middle" x="464" y="-566.8" font-family="Times,serif" font-size="14.00">packages</text>
<text text-anchor="middle" x="464" y="-551.8" font-family="Times,serif" font-size="14.00">e.g. bazel, g++</text>
</g>
<!-- PKG&#45;&gt;ENV_IMG -->
<g id="edge5" class="edge">
<title>PKG&#45;&gt;ENV_IMG</title>
<path fill="none" stroke="black" stroke-dasharray="5,2" d="M452.43,-543.76C441.74,-526.89 425.58,-501.4 412.51,-480.8"/>
<polygon fill="black" stroke="black" points="415.44,-478.88 407.13,-472.31 409.53,-482.63 415.44,-478.88"/>
<text text-anchor="middle" x="462.5" y="-514.8" 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="596.5,-463.88 593.5,-467.88 572.5,-467.88 569.5,-463.88 523.5,-463.88 523.5,-427.88 596.5,-427.88 596.5,-463.88"/>
<text text-anchor="middle" x="560" y="-442.18" font-family="Times,serif" font-size="14.00">git repo</text>
</g>
<!-- DEVEL_IMG -->
<g id="node5" class="node">
<title>DEVEL_IMG</title>
<path fill="royalblue" stroke="black" d="M507,-364.1C507,-366.74 456.8,-368.88 395,-368.88 333.2,-368.88 283,-366.74 283,-364.1 283,-364.1 283,-321.15 283,-321.15 283,-318.51 333.2,-316.37 395,-316.37 456.8,-316.37 507,-318.51 507,-321.15 507,-321.15 507,-364.1 507,-364.1"/>
<path fill="none" stroke="black" d="M507,-364.1C507,-361.47 456.8,-359.33 395,-359.33 333.2,-359.33 283,-361.47 283,-364.1"/>
<text text-anchor="middle" x="395" y="-346.43" font-family="Times,serif" font-size="14.00">ortools/bazel:&lt;distro&gt;_devel</text>
<text text-anchor="middle" x="395" y="-331.43" font-family="Times,serif" font-size="14.00">devel</text>
</g>
<!-- SRC&#45;&gt;DEVEL_IMG -->
<g id="edge6" class="edge">
<title>SRC&#45;&gt;DEVEL_IMG</title>
<path fill="none" stroke="black" stroke-dasharray="5,2" d="M532.01,-427.7C508.18,-413.08 473.37,-391.71 444.79,-374.18"/>
<polygon fill="black" stroke="black" points="446.5,-371.12 436.15,-368.87 442.84,-377.09 446.5,-371.12"/>
<text text-anchor="middle" x="504" y="-390.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="M392,-419.59C392.48,-407.38 393.07,-392.54 393.59,-379.22"/>
<polygon fill="black" stroke="black" points="397.1,-379.07 394,-368.94 390.11,-378.8 397.1,-379.07"/>
</g>
<!-- ENV_TAR -->
<g id="node8" class="node">
<title>ENV_TAR</title>
<polygon fill="royalblue" stroke="black" points="130,-52 16,-52 16,-16 136,-16 136,-46 130,-52"/>
<polyline fill="none" stroke="black" points="130,-52 130,-46 "/>
<polyline fill="none" stroke="black" points="136,-46 130,-46 "/>
<text text-anchor="middle" x="76" y="-30.3" font-family="Times,serif" font-size="14.00">docker_env.tar</text>
</g>
<!-- ENV_IMG&#45;&gt;ENV_TAR -->
<g id="edge7" class="edge">
<title>ENV_IMG&#45;&gt;ENV_TAR</title>
<path fill="none" stroke="red" d="M285.31,-434.45C183.56,-421.4 45,-394.32 45,-343.62 45,-343.62 45,-343.62 45,-149.12 45,-118.18 55.74,-84.12 64.58,-61.34"/>
<polygon fill="red" stroke="red" points="67.85,-62.59 68.34,-52.01 61.35,-59.98 67.85,-62.59"/>
<text text-anchor="middle" x="135.5" y="-249.68" font-family="Times,serif" font-size="14.00">make save_&lt;distro&gt;_env</text>
</g>
<!-- BUILD_IMG -->
<g id="node6" class="node">
<title>BUILD_IMG</title>
<path fill="royalblue" stroke="black" d="M507.5,-274.85C507.5,-277.49 457.97,-279.63 397,-279.63 336.03,-279.63 286.5,-277.49 286.5,-274.85 286.5,-274.85 286.5,-231.9 286.5,-231.9 286.5,-229.26 336.03,-227.12 397,-227.12 457.97,-227.12 507.5,-229.26 507.5,-231.9 507.5,-231.9 507.5,-274.85 507.5,-274.85"/>
<path fill="none" stroke="black" d="M507.5,-274.85C507.5,-272.22 457.97,-270.08 397,-270.08 336.03,-270.08 286.5,-272.22 286.5,-274.85"/>
<text text-anchor="middle" x="397" y="-257.18" font-family="Times,serif" font-size="14.00">ortools/bazel:&lt;distro&gt;_build</text>
<text text-anchor="middle" x="397" y="-242.18" 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="M395.58,-316.39C395.77,-308.07 395.98,-298.66 396.19,-289.72"/>
<polygon fill="black" stroke="black" points="399.69,-289.63 396.42,-279.55 392.69,-289.47 399.69,-289.63"/>
</g>
<!-- DEVEL_TAR -->
<g id="node9" class="node">
<title>DEVEL_TAR</title>
<polygon fill="royalblue" stroke="black" points="283.5,-52 154.5,-52 154.5,-16 289.5,-16 289.5,-46 283.5,-52"/>
<polyline fill="none" stroke="black" points="283.5,-52 283.5,-46 "/>
<polyline fill="none" stroke="black" points="289.5,-46 283.5,-46 "/>
<text text-anchor="middle" x="222" y="-30.3" font-family="Times,serif" font-size="14.00">docker_devel.tar</text>
</g>
<!-- DEVEL_IMG&#45;&gt;DEVEL_TAR -->
<g id="edge8" class="edge">
<title>DEVEL_IMG&#45;&gt;DEVEL_TAR</title>
<path fill="none" stroke="red" d="M328.22,-316.53C310.05,-307.14 291.65,-294.91 278,-279.5 222.98,-217.37 218.84,-112.23 220.32,-62.56"/>
<polygon fill="red" stroke="red" points="223.83,-62.42 220.74,-52.29 216.84,-62.14 223.83,-62.42"/>
<text text-anchor="middle" x="334.5" y="-198.05" font-family="Times,serif" font-size="14.00">make save_&lt;distro&gt;_devel</text>
</g>
<!-- TEST_IMG -->
<g id="node7" class="node">
<title>TEST_IMG</title>
<path fill="royalblue" stroke="black" d="M499.5,-171.6C499.5,-174.24 451.76,-176.38 393,-176.38 334.24,-176.38 286.5,-174.24 286.5,-171.6 286.5,-171.6 286.5,-128.65 286.5,-128.65 286.5,-126.01 334.24,-123.87 393,-123.87 451.76,-123.87 499.5,-126.01 499.5,-128.65 499.5,-128.65 499.5,-171.6 499.5,-171.6"/>
<path fill="none" stroke="black" d="M499.5,-171.6C499.5,-168.97 451.76,-166.83 393,-166.83 334.24,-166.83 286.5,-168.97 286.5,-171.6"/>
<text text-anchor="middle" x="393" y="-153.93" font-family="Times,serif" font-size="14.00">ortools/bazel:&lt;distro&gt;_test</text>
<text text-anchor="middle" x="393" y="-138.93" 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="M437.58,-227.09C447.51,-217.6 453.82,-206.2 448,-194.25 446.23,-190.61 443.99,-187.19 441.42,-183.99"/>
<polygon fill="black" stroke="black" points="443.84,-181.45 434.48,-176.49 438.71,-186.2 443.84,-181.45"/>
</g>
<!-- BUILD_TAR -->
<g id="node10" class="node">
<title>BUILD_TAR</title>
<polygon fill="royalblue" stroke="black" points="577.5,-52 450.5,-52 450.5,-16 583.5,-16 583.5,-46 577.5,-52"/>
<polyline fill="none" stroke="black" points="577.5,-52 577.5,-46 "/>
<polyline fill="none" stroke="black" points="583.5,-46 577.5,-46 "/>
<text text-anchor="middle" x="517" y="-30.3" font-family="Times,serif" font-size="14.00">docker_build.tar</text>
</g>
<!-- BUILD_IMG&#45;&gt;BUILD_TAR -->
<g id="edge9" class="edge">
<title>BUILD_IMG&#45;&gt;BUILD_TAR</title>
<path fill="none" stroke="red" d="M449.52,-227.23C470.79,-214.64 493.86,-197.51 509,-176.25 531.52,-144.63 531.76,-129.64 528,-91 527.08,-81.5 525.29,-71.22 523.42,-62.1"/>
<polygon fill="red" stroke="red" points="526.78,-61.06 521.24,-52.03 519.94,-62.54 526.78,-61.06"/>
<text text-anchor="middle" x="624.5" y="-146.43" font-family="Times,serif" font-size="14.00">make save_&lt;distro&gt;_build</text>
</g>
<!-- TEST_TAR -->
<g id="node11" class="node">
<title>TEST_TAR</title>
<polygon fill="royalblue" stroke="black" points="426.5,-52 307.5,-52 307.5,-16 432.5,-16 432.5,-46 426.5,-52"/>
<polyline fill="none" stroke="black" points="426.5,-52 426.5,-46 "/>
<polyline fill="none" stroke="black" points="432.5,-46 426.5,-46 "/>
<text text-anchor="middle" x="370" y="-30.3" font-family="Times,serif" font-size="14.00">docker_test.tar</text>
</g>
<!-- TEST_IMG&#45;&gt;TEST_TAR -->
<g id="edge10" class="edge">
<title>TEST_IMG&#45;&gt;TEST_TAR</title>
<path fill="none" stroke="red" d="M357.43,-123.79C352.38,-118.52 347.92,-112.55 345,-106 338.51,-91.45 343.87,-74.67 351.26,-61.07"/>
<polygon fill="red" stroke="red" points="354.42,-62.6 356.59,-52.23 348.43,-58.99 354.42,-62.6"/>
<text text-anchor="middle" x="436.5" y="-94.8" font-family="Times,serif" font-size="14.00">make save_&lt;distro&gt;_test</text>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 11 KiB

8
bazel/doc/generate_image.sh Executable file
View File

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

View File

@@ -0,0 +1,19 @@
# Create a virtual environment with all tools installed
# ref: https://hub.docker.com/_/alpine
FROM alpine:edge AS env
LABEL maintainer="corentinl@google.com"
# Install system build dependencies
ENV PATH=/usr/local/bin:$PATH
RUN apk add --no-cache git build-base linux-headers zlib-dev
RUN apk add --no-cache -X http://dl-cdn.alpinelinux.org/alpine/edge/testing bazel
CMD [ "/bin/sh" ]
FROM env AS devel
WORKDIR /home/lib
COPY . .
FROM devel as build
RUN bazel build --curses=no --copt='-Wno-sign-compare' //...:all
FROM build as test
RUN bazel test -c opt --curses=no --copt='-Wno-sign-compare' //...:all

View File

@@ -0,0 +1,18 @@
# Create a virtual environment with all tools installed
# ref: https://hub.docker.com/_/archlinux/
FROM archlinux/base AS env
LABEL maintainer="corentinl@google.com"
# Install system build dependencies
ENV PATH=/usr/local/bin:$PATH
RUN pacman -Syu --noconfirm git base-devel bazel
CMD [ "/bin/bash" ]
FROM env AS devel
WORKDIR /home/lib
COPY . .
FROM devel as build
RUN bazel build --curses=no --copt='-Wno-sign-compare' //...:all
FROM build as test
RUN bazel test -c opt --curses=no --copt='-Wno-sign-compare' //...:all

View File

@@ -0,0 +1,30 @@
# Create a virtual environment with all tools installed
# ref: https://hub.docker.com/_/centos
FROM centos:latest AS env
LABEL maintainer="corentinl@google.com"
# Install system build dependencies
ENV PATH=/usr/local/bin:$PATH
RUN yum -y update \
&& yum -y install git wget zlib-devel \
&& yum -y groupinstall "Development Tools" \
&& yum clean all \
&& rm -rf /var/cache/yum
# Install bazel
# see: https://docs.bazel.build/versions/master/install-redhat.html#installing-on-centos-7
RUN cd /etc/yum.repos.d \
&& wget https://copr.fedorainfracloud.org/coprs/vbatts/bazel/repo/epel-8/vbatts-bazel-epel-8.repo \
&& yum -y update \
&& yum -y install bazel \
&& yum clean all \
&& rm -rf /var/cache/yum
CMD [ "/usr/bin/bash" ]
FROM env AS devel
WORKDIR /home/lib
COPY . .
FROM devel as build
RUN bazel build --curses=no --copt='-Wno-sign-compare' //...:all
FROM build as test
RUN bazel test -c opt --curses=no --copt='-Wno-sign-compare' //...:all

View File

@@ -0,0 +1,30 @@
# Create a virtual environment with all tools installed
# ref: https://hub.docker.com/_/debian
FROM debian:latest AS env
LABEL maintainer="corentinl@google.com"
# Install system build dependencies
ENV PATH=/usr/local/bin:$PATH
RUN apt-get update -qq \
&& apt-get install -yq git wget curl libssl-dev build-essential \
&& apt-get install -yq python3-dev python3-pip \
&& apt-get install -yq default-jdk \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Install Bazel
RUN curl https://bazel.build/bazel-release.pub.gpg | apt-key add -
RUN echo "deb [arch=amd64] https://storage.googleapis.com/bazel-apt stable jdk1.8" | tee /etc/apt/sources.list.d/bazel.list
RUN apt-get update -qq \
&& apt-get install -yq bazel \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
CMD [ "/bin/bash" ]
FROM env AS devel
WORKDIR /home/lib
COPY . .
FROM devel as build
RUN bazel build --curses=no --copt='-Wno-sign-compare' //...:all
FROM build as test
RUN bazel test -c opt --curses=no --copt='-Wno-sign-compare' //...:all

View File

@@ -0,0 +1,25 @@
# Create a virtual environment with all tools installed
# ref: https://hub.docker.com/_/fedora
FROM fedora:latest AS env
LABEL maintainer="corentinl@google.com"
# Install system build dependencies
ENV PATH=/usr/local/bin:$PATH
RUN dnf -y update \
&& dnf -y install git \
&& dnf -y groupinstall "Development Tools" \
&& dnf -y install gcc-c++ zlib-devel \
&& dnf -y install dnf-plugins-core \
&& dnf -y copr enable vbatts/bazel \
&& dnf -y install bazel \
&& dnf clean all
CMD [ "/usr/bin/bash" ]
FROM env AS devel
WORKDIR /home/lib
COPY . .
FROM devel as build
RUN bazel build --curses=no --copt='-Wno-sign-compare' //...:all
FROM build as test
RUN bazel test -c opt --curses=no --copt='-Wno-sign-compare' //...:all

View File

@@ -0,0 +1,21 @@
# Create a virtual environment with all tools installed
# ref: https://hub.docker.com/r/opensuse/tumbleweed
FROM opensuse/tumbleweed AS env
LABEL maintainer="corentinl@google.com"
# Install system build dependencies
ENV PATH=/usr/local/bin:$PATH
RUN zypper update -y \
&& zypper install -y git gcc gcc-c++ zlib-devel bazel \
&& zypper clean -a
ENV CC=gcc CXX=g++
CMD [ "/usr/bin/bash" ]
FROM env AS devel
WORKDIR /home/lib
COPY . .
FROM devel as build
RUN bazel build --curses=no --copt='-Wno-sign-compare' //...:all
FROM build as test
RUN bazel test -c opt --curses=no --copt='-Wno-sign-compare' //...:all

View File

@@ -1,7 +1,7 @@
# Create a virtual environment with all tools installed
# ref: https://hub.docker.com/_/ubuntu
FROM ubuntu:rolling AS env
LABEL maintainer="mizux.dev@gmail.com"
LABEL maintainer="corentinl@google.com"
# Install system build dependencies
RUN apt-get update -qq \
&& apt-get install -yq git wget curl libssl-dev build-essential \
@@ -18,12 +18,11 @@ RUN apt-get update -qq \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
CMD [ "/bin/bash" ]
# Create lib directory
FROM env AS devel
WORKDIR /home/lib
# Bundle lib source
COPY . .
FROM env as build
FROM devel as build
RUN bazel build --curses=no --copt='-Wno-sign-compare' //...:all
FROM build as test