fix(ci): materialize rebar test src_dirs in shared test image. Refs EventHub/EventHubBack#36
This commit is contained in:
@@ -10,9 +10,17 @@ COPY src/ src/
|
|||||||
COPY test/unit/ test/unit/
|
COPY test/unit/ test/unit/
|
||||||
COPY test/api_*_SUITE.erl test/
|
COPY test/api_*_SUITE.erl test/
|
||||||
COPY test/api/ test/api/
|
COPY test/api/ test/api/
|
||||||
|
COPY docker/ci-test-prepare.sh /usr/local/bin/ci-test-prepare.sh
|
||||||
|
RUN chmod +x /usr/local/bin/ci-test-prepare.sh
|
||||||
|
|
||||||
# default profile: CT (test/api); test profile: EUnit (test/unit)
|
# default profile: CT (test/api); test profile: EUnit (test/unit).
|
||||||
RUN rebar3 compile && rebar3 as test compile
|
# rebar3 кладёт битые/symlink extra src_dirs; готовим реальные копии (как scripts/fix-rebar-unit-symlink.sh).
|
||||||
|
RUN rebar3 compile \
|
||||||
|
&& mkdir -p _build/test/lib/eventhub/test \
|
||||||
|
&& (rebar3 as test compile || true) \
|
||||||
|
&& ci-test-prepare.sh \
|
||||||
|
&& rebar3 as test compile
|
||||||
|
|
||||||
# По умолчанию CT; для eunit: docker run … rebar3 eunit --sname ci_eunit --verbose
|
# По умолчанию CT; для eunit: docker run … rebar3 eunit --sname ci_eunit --verbose
|
||||||
|
ENTRYPOINT ["ci-test-prepare.sh"]
|
||||||
CMD ["rebar3", "ct", "--sname", "ci_api_test", "-v"]
|
CMD ["rebar3", "ct", "--sname", "ci_api_test", "-v"]
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# Replace rebar3 symlinks under _build/.../test with real copies (BusyBox cp -L fails on them).
|
||||||
|
set -eu
|
||||||
|
APP_ROOT="${APP_ROOT:-/app}"
|
||||||
|
DEST="${APP_ROOT}/_build/test/lib/eventhub/test"
|
||||||
|
mkdir -p "${DEST}"
|
||||||
|
rm -rf "${DEST}/unit" "${DEST}/api"
|
||||||
|
cp -a "${APP_ROOT}/test/unit" "${DEST}/unit"
|
||||||
|
cp -a "${APP_ROOT}/test/api" "${DEST}/api"
|
||||||
|
# shellcheck disable=SC2086
|
||||||
|
cp -a ${APP_ROOT}/test/api_*_SUITE.erl "${DEST}/" 2>/dev/null || true
|
||||||
|
|
||||||
|
if [ "$#" -gt 0 ]; then
|
||||||
|
exec "$@"
|
||||||
|
fi
|
||||||
Reference in New Issue
Block a user