-
Notifications
You must be signed in to change notification settings - Fork 824
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CI] Add RISCV in test and build (#3706)
* [CI] Add RISCV in test and build * update Cargo lock to fix cargo deny step * Some updates to avoid riscv incompatibilities
- Loading branch information
Showing
7 changed files
with
273 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
FROM debian:sid AS openssl_riscv64 | ||
#FROM ghcr.io/cross-rs/aarch64-unknown-linux-gnu:edge | ||
|
||
# set CROSS_DOCKER_IN_DOCKER to inform `cross` that it is executed from within a container | ||
ENV CROSS_DOCKER_IN_DOCKER=true | ||
|
||
RUN apt-get update && \ | ||
apt-get install --assume-yes --no-install-recommends \ | ||
ca-certificates \ | ||
curl \ | ||
cpio \ | ||
sharutils \ | ||
gnupg \ | ||
build-essential \ | ||
libc6-dev | ||
|
||
COPY install_deb.sh / | ||
|
||
#install libssl-dev for riscv64! | ||
RUN /install_deb.sh riscv64 libssl-dev | ||
ENV RISCV64GC_UNKNOWN_LINUX_GNU_OPENSSL_INCLUDE_DIR=/usr/include | ||
ENV RISCV64GC_UNKNOWN_LINUX_GNU_OPENSSL_LIB_DIR=/usr/lib/riscv64-linux-gnu | ||
|
||
|
||
# install rust tools | ||
RUN curl --proto "=https" --tlsv1.2 --retry 3 -sSfL https://sh.rustup.rs | sh -s -- -y | ||
ENV PATH="/root/.cargo/bin:${PATH}" | ||
RUN rustup -v toolchain install 1.65 | ||
# add docker the manual way | ||
COPY install_docker.sh / | ||
RUN /install_docker.sh | ||
|
||
RUN apt-get update && \ | ||
apt-get install --assume-yes --no-install-recommends \ | ||
docker-ce \ | ||
docker-ce-cli \ | ||
containerd.io \ | ||
docker-buildx-plugin \ | ||
docker-compose-plugin | ||
|
||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
gcc-riscv64-linux-gnu \ | ||
g++-riscv64-linux-gnu \ | ||
qemu-user-static \ | ||
libssl-dev \ | ||
pkg-config \ | ||
libc6-dev-riscv64-cross | ||
|
||
ENV CROSS_TOOLCHAIN_PREFIX=riscv64-linux-gnu- | ||
ENV CROSS_SYSROOT=/usr/riscv64-linux-gnu | ||
ENV CARGO_TARGET_RISCV64GC_UNKNOWN_LINUX_GNU_LINKER="$CROSS_TOOLCHAIN_PREFIX"gcc \ | ||
AR_riscv64gc_unknown_linux_gnu="$CROSS_TOOLCHAIN_PREFIX"ar \ | ||
CC_riscv64gc_unknown_linux_gnu="$CROSS_TOOLCHAIN_PREFIX"gcc \ | ||
CXX_riscv64gc_unknown_linux_gnu="$CROSS_TOOLCHAIN_PREFIX"g++ \ | ||
CFLAGS_riscv64gc_unknown_linux_gnu="-march=rv64gc -mabi=lp64d" \ | ||
BINDGEN_EXTRA_CLANG_ARGS_riscv64gc_unknown_linux_gnu="--sysroot=$CROSS_SYSROOT" \ | ||
QEMU_LD_PREFIX="$CROSS_SYSROOT" \ | ||
RUST_TEST_THREADS=1 \ | ||
PKG_CONFIG_PATH="/usr/lib/riscv64-linux-gnu/pkgconfig/:${PKG_CONFIG_PATH}" | ||
|
||
RUN rustup target add riscv64gc-unknown-linux-gnu --toolchain 1.65-x86_64-unknown-linux-gnu |
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,56 @@ | ||
#!/bin/bash | ||
set -x | ||
set -euo pipefail | ||
|
||
arch="${1}" | ||
shift | ||
|
||
# need to install certain local dependencies | ||
export DEBIAN_FRONTEND=noninteractive | ||
apt-get update | ||
apt-get install --assume-yes --no-install-recommends \ | ||
ca-certificates \ | ||
curl \ | ||
cpio \ | ||
sharutils \ | ||
gnupg | ||
|
||
# Add port from sid to get some riscv packages | ||
debsource="deb http://deb.debian.org/debian-ports sid main" | ||
|
||
# temporarily use debian sources rather than ubuntu. | ||
touch /etc/apt/sources.list | ||
mv /etc/apt/sources.list /etc/apt/sources.list.bak | ||
echo -e "${debsource}" > /etc/apt/sources.list | ||
|
||
dpkg --add-architecture "${arch}" || echo "foreign-architecture ${arch}" \ | ||
> /etc/dpkg/dpkg.cfg.d/multiarch | ||
|
||
# Add Debian keys. | ||
curl --retry 3 -sSfL 'https://ftp-master.debian.org/keys/archive-key-{7.0,8,9,10}.asc' -O | ||
curl --retry 3 -sSfL 'https://ftp-master.debian.org/keys/archive-key-{8,9,10}-security.asc' -O | ||
curl --retry 3 -sSfL 'https://ftp-master.debian.org/keys/release-{7,8,9,10}.asc' -O | ||
curl --retry 3 -sSfL 'https://www.ports.debian.org/archive_{2020,2021,2022,2023}.key' -O | ||
|
||
for key in *.asc *.key; do | ||
apt-key add "${key}" | ||
rm "${key}" | ||
done | ||
|
||
# allow apt-get to retry downloads | ||
echo 'APT::Acquire::Retries "3";' > /etc/apt/apt.conf.d/80-retries | ||
|
||
apt-get update | ||
for dep in $@; do | ||
apt-get install "${dep}:${arch}" --assume-yes | ||
done | ||
|
||
# restore our old sources list | ||
mv -f /etc/apt/sources.list.bak /etc/apt/sources.list | ||
if [ -f /etc/dpkg/dpkg.cfg.d/multiarch.bak ]; then | ||
mv /etc/dpkg/dpkg.cfg.d/multiarch.bak /etc/dpkg/dpkg.cfg.d/multiarch | ||
fi | ||
|
||
# can fail if arch is used (amd64 and/or i386) | ||
dpkg --remove-architecture "${arch}" || true | ||
apt-get update |
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,11 @@ | ||
#!/bin/bash | ||
set -x | ||
set -euo pipefail | ||
|
||
mkdir -m 0755 -p /etc/apt/keyrings | ||
curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg | ||
|
||
echo \ | ||
"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \ | ||
"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \ | ||
tee /etc/apt/sources.list.d/docker.list > /dev/null |
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