diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 593885715..4b1f50b5a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -163,6 +163,7 @@ jobs: - name: Run Cross Compilation Targets run: > sudo make -C scripts/ci ${{ matrix.target }} + BUILD_OPTIONS="--build-arg CI_CROSS_COMPILE=1" docker-test: needs: [alpine-test] diff --git a/contrib/dependencies/apt-cross-packages.sh b/contrib/dependencies/apt-cross-packages.sh index e7a31f219..11528a2c1 100755 --- a/contrib/dependencies/apt-cross-packages.sh +++ b/contrib/dependencies/apt-cross-packages.sh @@ -6,7 +6,7 @@ if [ ! -x "$APT_INSTALL" ]; then exit 1 fi -"$APT_INSTALL" \ +if ! "$APT_INSTALL" \ crossbuild-essential-"${DEBIAN_ARCH}" \ iproute2:"${DEBIAN_ARCH}" \ libaio-dev:"${DEBIAN_ARCH}" \ @@ -34,4 +34,13 @@ fi git \ protobuf-c-compiler \ protobuf-compiler \ - python3-protobuf + python3-protobuf; then + if [ -n "$CI_CROSS_COMPILE" ]; then + # Use \r to move cursor to the start of the line so that + # ::error:: is recognized by GitHub Actions even when + # running inside a Docker build where BuildKit prefixes + # each line with step and timing information. + printf '\r::error::Cross-compile dependency installation failed for %s\n' "${DEBIAN_ARCH}" + fi + exit 1 +fi diff --git a/scripts/build/Dockerfile.stable-cross.tmpl b/scripts/build/Dockerfile.stable-cross.tmpl index 429b077b8..8224ceb24 100644 --- a/scripts/build/Dockerfile.stable-cross.tmpl +++ b/scripts/build/Dockerfile.stable-cross.tmpl @@ -15,6 +15,9 @@ ENV CROSS_COMPILE=${CROSS_TRIPLET}- \ ENV PATH="${PATH}:${CROSS_ROOT}/bin" \ PKG_CONFIG_PATH=/usr/lib/${CROSS_TRIPLET}/pkgconfig +ARG CI_CROSS_COMPILE +ENV CI_CROSS_COMPILE=${CI_CROSS_COMPILE} + COPY contrib/dependencies/apt-cross-packages.sh /criu/contrib/dependencies/apt-cross-packages.sh COPY contrib/apt-install /criu/contrib/apt-install WORKDIR /criu diff --git a/scripts/build/Dockerfile.unstable-cross.tmpl b/scripts/build/Dockerfile.unstable-cross.tmpl index 4aa009f22..db61e15a7 100644 --- a/scripts/build/Dockerfile.unstable-cross.tmpl +++ b/scripts/build/Dockerfile.unstable-cross.tmpl @@ -15,6 +15,9 @@ ENV CROSS_COMPILE=${CROSS_TRIPLET}- \ ENV PATH="${PATH}:${CROSS_ROOT}/bin" \ PKG_CONFIG_PATH=/usr/lib/${CROSS_TRIPLET}/pkgconfig +ARG CI_CROSS_COMPILE +ENV CI_CROSS_COMPILE=${CI_CROSS_COMPILE} + COPY contrib/dependencies/apt-cross-packages.sh /criu/contrib/dependencies/apt-cross-packages.sh COPY contrib/apt-install /criu/contrib/apt-install WORKDIR /criu