Skip to content

Commit

Permalink
Adds ICU test environments by version
Browse files Browse the repository at this point in the history
This will allow us to run CI builds for each combination of ICU versions
and features.  Issue google#38 will be resolved once all environments of
interest are being tested.  This commit adds only one new test target,
as an example.
  • Loading branch information
filmil committed Jan 9, 2020
1 parent 341499b commit 2674fa3
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 14 deletions.
14 changes: 12 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,26 @@ test:
# so that as much as possible of the host configuration is retained.
TMP ?= /tmp
CARGO_TARGET_DIR := ${TMP}/rust_icu-${USER}-target
docker-test:


define run-docker-test
mkdir -p ${CARGO_TARGET_DIR}
docker run ${TTY} \
--user=${UID}:${GID} \
--volume=${TOP_DIR}:/src/rust_icu \
--volume=${CARGO_TARGET_DIR}:/build/cargo \
--volume=${HOME}/.cargo:/usr/local/cargo \
${DOCKER_REPO}/rust_icu_testenv:${USED_BUILDENV_VERSION}
--env="CARGO_TEST_ARGS=$(2)" \
${DOCKER_REPO}/$(1):${USED_BUILDENV_VERSION}
endef
docker-test:
$(call run-docker-test,rust_icu_testenv,)
.PHONY: docker-test

docker-test-65-renaming:
$(call run-docker-test,rust_icu_testenv-65,--no-default-features --features=renaming)
.PHONY: docker-test-65-renaming

# Builds and pushes the build environment containers. You would not normally
# need to do this.
buildenv:
Expand Down
5 changes: 3 additions & 2 deletions build/Dockerfile.maint-64 → build/Dockerfile.maint
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
ARG DOCKER_REPO=filipfilmar
ARG VERSION=0.0.0
ARG ICU_VERSION_TAG=maint/maint-64
FROM $DOCKER_REPO/rust_icu_buildenv:$VERSION AS buildenv

# Install ICU from source.
ENV ICU_SOURCE_DIR="/src/icu"
RUN git clone https://github.com/unicode-org/icu.git && \
cd $ICU_SOURCE_DIR && \
git fetch origin maint/maint-64 && \
git checkout maint/maint-64
git fetch origin $ICU_VERSION_TAG && \
git checkout $ICU_VERSION_TAG

ENV ICU4C_BUILD_DIR=/build/icu4c-build
RUN mkdir -p $ICU4C_BUILD_DIR && \
Expand Down
13 changes: 6 additions & 7 deletions build/Dockerfile.testenv
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
# on source that has been mounted in.
ARG DOCKER_REPO=filipfilmar
ARG VERSION=0.0.0
FROM $DOCKER_REPO/rust_icu_maint-64:$VERSION AS buildenv
ARG ICU_VERSION_TAG=maint-64
FROM $DOCKER_REPO/rust_icu_$ICU_VERSION_TAG:$VERSION AS buildenv

# Mount the rust_icu source top level directory here.
ENV RUST_ICU_SOURCE_DIR=/src/rust_icu
Expand All @@ -14,11 +15,9 @@ RUN mkdir -p $RUST_ICU_SOURCE_DIR && \
/build \
/usr/local/cargo

RUN ls -lR /src /build $HOME && ls -ld /
COPY entrypoint.sh /entrypoint.sh
RUN chmod a+rwx /entrypoint.sh

ENTRYPOINT ( \
cd $RUST_ICU_SOURCE_DIR; \
cargo install bindgen rustfmt; \
env LD_LIBRARY_PATH=/usr/local/lib cargo test; \
)
ENV CARGO_TEST_ARGS=""
ENTRYPOINT /entrypoint.sh

31 changes: 28 additions & 3 deletions build/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,42 @@ VERSION ?= $(RAW_VERSION:buildenv-%=%)
# The docker repo should be a more official one.
DOCKER_REPO ?= filipfilmar

.DEFAULT_GOAL: all

build-%: Dockerfile.%
docker build \
--build-arg DOCKER_REPO=${DOCKER_REPO} \
--build-arg VERSION=${VERSION} \
-f $< -t $*:latest .
-f $< -t rust_icu_$*:latest .

build-maint-%: Dockerfile.maint
docker build \
--build-arg DOCKER_REPO=${DOCKER_REPO} \
--build-arg VERSION=${VERSION} \
--build-arg ICU_VERSION_TAG=maint/maint-$* \
-f $< -t rust_icu_maint-$*:latest .

build-testenv-%: Dockerfile.testenv
docker build \
--build-arg DOCKER_REPO=${DOCKER_REPO} \
--build-arg VERSION=${VERSION} \
--build-arg ICU_VERSION_TAG=maint-$* \
-f $< -t rust_icu_testenv-$*:latest .

tag-%: build-%
docker tag $*:latest ${DOCKER_REPO}/rust_icu_$*:${VERSION}
docker tag rust_icu_$*:latest ${DOCKER_REPO}/rust_icu_$*:${VERSION}

push-%: tag-%
docker push ${DOCKER_REPO}/rust_icu_$*:${VERSION}

all: push-buildenv push-maint-64 push-hermetic push-testenv
all: \
push-buildenv \
push-maint-64 \
push-testenv-64 \
push-maint-65 \
push-testenv-65 \
push-maint-66 \
push-testenv-66 \
push-testenv \
push-hermetic
echo "buildenv-version: ${VERSION}"
15 changes: 15 additions & 0 deletions build/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#! /bin/bash
set -x
env
cd $RUST_ICU_SOURCE_DIR
cargo install bindgen rustfmt
(
cd rust_icu_sys
env LD_LIBRARY_PATH="/usr/local/lib" cargo test ${CARGO_TEST_ARGS}
)
(
cd rust_icu_common
env LD_LIBRARY_PATH="/usr/local/lib" cargo test ${CARGO_TEST_ARGS}
)
env LD_LIBRARY_PATH="/usr/local/lib" cargo test

0 comments on commit 2674fa3

Please sign in to comment.