Skip to content
Snippets Groups Projects
Commit 6597cdae authored by Cédric Moreau's avatar Cédric Moreau
Browse files

buildplatform

parent 506f77d6
No related branches found
No related tags found
No related merge requests found
Pipeline #33355 failed
......@@ -7,8 +7,7 @@ FROM debian:bullseye-slim as target
# When building for a foreign arch, use cross-compilation
# https://www.docker.com/blog/faster-multi-platform-builds-dockerfile-cross-compilation-guide/
FROM --platform=$BUILDPLATFORM rust:1-bullseye as build
ARG BUILDPLATFORM
FROM rust:1-bullseye as build
ARG TARGETPLATFORM
# We need the target arch triplet in both Debian and rust flavor
......@@ -33,15 +32,15 @@ RUN if [ "$debug" = 0 ]; then \
echo "TARGET_FOLDER=debug" >>/root/dynenv; \
fi
# Configure cross-build environment if need be
RUN set -x && \
if [ "$TARGETPLATFORM" != "$BUILDPLATFORM" ]; then \
. /root/dynenv && \
apt install -y gcc-$DEBIAN_ARCH_TRIPLET binutils-$DEBIAN_ARCH_TRIPLET && \
rustup target add "$RUST_ARCH_TRIPLET" && \
: https://github.com/rust-lang/cargo/issues/4133 && \
echo "RUSTFLAGS='-C linker=$DEBIAN_ARCH_TRIPLET-gcc'; export RUSTFLAGS" >>/root/dynenv; \
fi
## Configure cross-build environment if need be
#RUN set -x && \
# if [ "$TARGETPLATFORM" != "$BUILDPLATFORM" ]; then \
# . /root/dynenv && \
# apt install -y gcc-$DEBIAN_ARCH_TRIPLET binutils-$DEBIAN_ARCH_TRIPLET && \
# rustup target add "$RUST_ARCH_TRIPLET" && \
# : https://github.com/rust-lang/cargo/issues/4133 && \
# echo "RUSTFLAGS='-C linker=$DEBIAN_ARCH_TRIPLET-gcc'; export RUSTFLAGS" >>/root/dynenv; \
# fi
# Build
RUN set -x && \
......@@ -49,20 +48,20 @@ RUN set -x && \
. /root/dynenv && \
cargo xtask release-runtime 600
# Run tests if requested, expted when cross-building
ARG cucumber=0
RUN if [ "$cucumber" != 0 ] && [ "$TARGETPLATFORM" = "$BUILDPLATFORM" ]; then \
cargo test --workspace --exclude duniter-end2end-tests --exclude duniter-live-tests && \
cargo cucumber -i account_creation* && \
cargo cucumber -i certification* && \
cargo cucumber -i identity_creation* && \
cargo cucumber -i monetary_mass* && \
cargo cucumber -i oneshot_account* && \
cargo cucumber -i transfer_all* && \
cd target/debug/deps/ && \
rm cucumber_tests-*.d && \
mv cucumber_tests* ../../../build/duniter-cucumber; \
fi
## Run tests if requested, expted when cross-building
#ARG cucumber=0
#RUN if [ "$cucumber" != 0 ] && [ "$TARGETPLATFORM" = "$BUILDPLATFORM" ]; then \
# cargo test --workspace --exclude duniter-end2end-tests --exclude duniter-live-tests && \
# cargo cucumber -i account_creation* && \
# cargo cucumber -i certification* && \
# cargo cucumber -i identity_creation* && \
# cargo cucumber -i monetary_mass* && \
# cargo cucumber -i oneshot_account* && \
# cargo cucumber -i transfer_all* && \
# cd target/debug/deps/ && \
# rm cucumber_tests-*.d && \
# mv cucumber_tests* ../../../build/duniter-cucumber; \
# fi
# ------------------------------------------------------------------------------
# Final Stage
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment