-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: create a container for building ICU against
main
For the longest time, we had no way to run tests of rust_icu against top-of-tree ICU. This meant that if a build break was in the works upstream, we would not know until the release. This change fixes the issue. We now maintain a "current" environment which will download and build ICU from `main` before running tests.
- Loading branch information
Showing
8 changed files
with
179 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Dockerfile for running rust_icu tests based | ||
# on source that has been mounted in. | ||
ARG DOCKER_REPO=filipfilmar | ||
ARG VERSION=0.0.0 | ||
ARG ICU_VERSION_TAG=maint-72 | ||
FROM $DOCKER_REPO/rust_icu_buildenv:$VERSION AS buildenv | ||
ARG DOCKER_REPO | ||
ARG VERSION | ||
ARG ICU_VERSION_TAG | ||
ARG BINDGEN_CLI_VERSION=0.69.5 | ||
|
||
ENV CARGO_BUILD_DIR=/build/cargo | ||
RUN mkdir -p $CARGO_BUILD_DIR | ||
|
||
# Mount the rust_icu source top level directory here. | ||
ENV RUST_ICU_SOURCE_DIR=/src/rust_icu | ||
VOLUME $RUST_ICU_SOURCE_DIR $CARGO_BUILD_DIR | ||
|
||
RUN umask | ||
RUN mkdir -p $RUST_ICU_SOURCE_DIR && \ | ||
chmod --recursive a+rwx \ | ||
/build \ | ||
/usr/local/cargo | ||
|
||
COPY entrypoint-test-current.sh /entrypoint-test-current.sh | ||
RUN chmod a+rwx /entrypoint-test-current.sh | ||
|
||
RUN cargo install --force --version $BINDGEN_CLI_VERSION bindgen-cli | ||
|
||
ENV CARGO_TEST_ARGS="" | ||
ENV RUST_ICU_MAJOR_VERSION_NUMBER="" | ||
ENTRYPOINT /entrypoint-test-current.sh | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#! /bin/bash | ||
set -eo pipefail | ||
set -x | ||
|
||
echo "${0}" | ||
|
||
ICU_LIBRARY_PATH="${ICU_LIBRARY_PATH:-/build/icu-install}" | ||
|
||
# Needed to take icu-config from ICU_LIBRARY_PATH, not the default | ||
# /usr/local/bin. | ||
PATH="${ICU_LIBRARY_PATH}/bin:${PATH}" | ||
export PATH | ||
|
||
readonly _local_cargo_options="\ | ||
--target-dir=/build/cargo \ | ||
" | ||
|
||
cd $RUST_ICU_SOURCE_DIR | ||
ls -d . | ||
readonly __all_dirs="$(ls -d rust_icu_*)" | ||
|
||
env | ||
|
||
function run_cargo_test() { | ||
env LD_LIBRARY_PATH="${ICU_LIBRARY_PATH}/lib" \ | ||
PKG_CONFIG_LIBDIR="${ICU_LIBRARY_PATH}/lib/pkgconfig" \ | ||
cargo test \ | ||
${_local_cargo_options} \ | ||
${CARGO_TEST_ARGS} | ||
} | ||
|
||
function run_cargo_doc() { | ||
env LD_LIBRARY_PATH="${ICU_LIBRARY_PATH}/lib" \ | ||
PKG_CONFIG_LIBDIR="${ICU_LIBRARY_PATH}/lib/pkgconfig" \ | ||
cargo doc ${_local_cargo_options} ${CARGO_TEST_ARGS} | ||
} | ||
|
||
( | ||
echo "Checking out, building and installing the latest ICU" | ||
mkdir -p /build | ||
cd /build | ||
git clone --depth=1 https://github.com/unicode-org/icu.git | ||
mkdir -p /build/icu4c-build | ||
mkdir -p ${ICU_LIBRARY_PATH} | ||
cd /build/icu4c-build | ||
env CXXFLAGS="-ggdb -DU_DEBUG=1" \ | ||
/build/icu/icu4c/source/runConfigureICU Linux \ | ||
--enable-static \ | ||
--prefix="${ICU_LIBRARY_PATH}" \ | ||
--enable-debug && \ | ||
make -j && \ | ||
make install && \ | ||
icu-config --version | ||
) | ||
|
||
ls -lR $ICU_LIBRARY_PATH/lib | ||
|
||
echo "Testing rust_icu crates" | ||
for directory in ${__all_dirs}; do | ||
( | ||
cd "${directory}" | ||
run_cargo_test | ||
run_cargo_doc | ||
) | ||
done |