ci(cmake): Add ARM cross compile jobs

* update .dockerignore
This commit is contained in:
Mizux Seiha
2021-01-08 17:47:09 +01:00
parent 62bfb3a37f
commit 42ac4e4429
4 changed files with 111 additions and 1 deletions

View File

@@ -53,6 +53,8 @@ lib
bin
packages
build/
build_cmake/
build_cross/
examples/data/vector_packing
examples/data/rcpsp
examples/data/binpacking

View File

@@ -75,7 +75,19 @@ help:
@echo -e "\tWith ${BOLD}<vm>${RESET}:"
@echo -e "\t\t${BOLD}freebsd${RESET} (FreeBSD)"
@echo
@echo -e "\tWith ${BOLD}<glop>${RESET}:"
@echo
@echo -e "\t${BOLD}glop_<stage>${RESET}: build <stage> for glop using an ubuntu docker."
@echo -e "\t${BOLD}arm_<target>_<step>${RESET}: cross build <stage> docker image for <target> for aarch64."
@echo
@echo -e "\tWith ${BOLD}<target>${RESET}:"
@echo -e "\t\t${BOLD}glop${RESET} Build libglop"
@echo -e "\t\t${BOLD}or-tools${RESET} Build libortools"
@echo
@echo -e "\tWith ${BOLD}<step>${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}clean${RESET}: Remove cache and docker image."
@echo -e "\t${BOLD}clean_<distro>${RESET}: Remove cache and docker image for the specified distro."
@@ -355,6 +367,42 @@ $(clean_glop_targets): clean_glop_%
docker image rm -f ${IMAGE}:glop_$* 2>/dev/null
rm -f cache/glop/docker_$*.tar
############
## ARM 64 ##
############
TARGETS = glop or-tools
STEPS = env devel build test
define make-arm-target =
#$$(info TARGET: $1)
#$$(info Create targets: $(addprefix arm_$1_, $(STEPS)))
arm_targets = $(addprefix arm_$1_, $(STEPS))
.PHONY: $$(arm_targets)
$$(arm_targets): arm_$1_%: docker/arm/$1.Dockerfile
#@docker image rm -f ${IMAGE}:$$@ 2>/dev/null
${DOCKER_BUILD_CMD} --target=$$* --tag ${IMAGE}:$$@ -f $$< ..
save_arm_targets = $(addprefix save_arm_$1_, $(STEPS))
.PHONY: $(save_arm_targets)
$(save_arm_targets): save_arm_$1_%: cache/arm/docker_$1_%.tar
cache/arm/docker_$1_%.tar: arm_$1_%
@rm -f $$@
mkdir -p cache/arm
docker save ${IMAGE}:$$< -o $$@
sh_arm_targets = $(addprefix sh_arm_$1_, $(STEPS))
.PHONY: $$(sh_arm_targets)
$$(sh_arm_targets): sh_arm_$1_%: arm_$1_%
${DOCKER_RUN_CMD} -it --name ${PROJECT}_${BUILD_SYSTEM}_$$< ${IMAGE}:$$<
clean_arm_targets = $(addprefix clean_arm_$1_, $(STEPS))
.PHONY: $$(clean_arm_targets)
$$(clean_arm_targets): clean_arm_$1_%
docker image rm -f ${IMAGE}:arm_$1_$$* 2>/dev/null
rm -f cache/arm/docker_$1_$$*.tar
endef
$(foreach target,$(TARGETS),$(eval $(call make-arm-target,$(target))))
# CLEAN
targets = $(addprefix clean_, $(DISTROS))
vms = $(addprefix clean_, $(VMS))

View File

@@ -0,0 +1,30 @@
# Create a virtual environment with all tools installed
# ref: https://hub.docker.com/_/ubuntu
FROM ubuntu:rolling 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 libssl-dev build-essential \
ninja-build python3 pkgconf libglib2.0-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Install CMake 3.19.2
RUN wget "https://cmake.org/files/v3.19/cmake-3.19.2-Linux-x86_64.sh" \
&& chmod a+x cmake-3.19.2-Linux-x86_64.sh \
&& ./cmake-3.19.2-Linux-x86_64.sh --prefix=/usr/local/ --skip-license \
&& rm cmake-3.19.2-Linux-x86_64.sh
FROM env AS devel
WORKDIR /home/project
COPY . .
FROM devel AS build
ENV PROJECT=glop
ENV TARGET=aarch64-linux-gnu
RUN ./tools/cross_compile.sh build
FROM build AS test
RUN ./tools/cross_compile.sh qemu
RUN ./tools/cross_compile.sh test

View File

@@ -0,0 +1,30 @@
# Create a virtual environment with all tools installed
# ref: https://hub.docker.com/_/ubuntu
FROM ubuntu:rolling 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 libssl-dev build-essential \
ninja-build python3 pkgconf libglib2.0-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Install CMake 3.19.2
RUN wget "https://cmake.org/files/v3.19/cmake-3.19.2-Linux-x86_64.sh" \
&& chmod a+x cmake-3.19.2-Linux-x86_64.sh \
&& ./cmake-3.19.2-Linux-x86_64.sh --prefix=/usr/local/ --skip-license \
&& rm cmake-3.19.2-Linux-x86_64.sh
FROM env AS devel
WORKDIR /home/project
COPY . .
FROM devel AS build
ENV PROJECT=or-tools
ENV TARGET=aarch64-linux-gnu
RUN ./tools/cross_compile.sh build
FROM build AS test
RUN ./tools/cross_compile.sh qemu
RUN ./tools/cross_compile.sh test