Skip to content

Commit

Permalink
misc: add more release archs
Browse files Browse the repository at this point in the history
Release binaries for linux/ppc64le and linux/riscv64 arch.

Signed-off-by: Yan Song <imeoer@linux.alibaba.com>
  • Loading branch information
imeoer committed Aug 19, 2022
1 parent eb214a5 commit 458314e
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 39 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/it.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,20 +48,20 @@ jobs:

- name: Build nydus-rs
run: |
declare -A rust_arch_map=( ["amd64"]="x86_64" ["arm64"]="aarch64")
arch=${rust_arch_map[${{ matrix.arch }}]}
declare -A rust_arch_map=( ["amd64"]="x86_64-unknown-linux-musl" ["arm64"]="aarch64-unknown-linux-musl")
rust_arch=${rust_arch_map[${{ matrix.arch }}]}
cargo install --version 0.2.1 cross
rustup component add rustfmt clippy
make -e ARCH=$arch -e CARGO=cross static-release
make -e RUST_ARCH=$rust_arch -e CARGO=cross static-release
make release -C contrib/nydus-backend-proxy/
#sudo mv target-fusedev/$arch-unknown-linux-musl/release/nydusd nydusd-fusedev
#sudo mv target-fusedev/$arch-unknown-linux-musl/release/nydus-image .
#sudo mv target-fusedev/$arch-unknown-linux-musl/release/nydusctl .
#sudo mv target-virtiofs/$arch-unknown-linux-musl/release/nydusd nydusd-virtiofs
#sudo mv target-fusedev/$rust_arch/release/nydusd nydusd-fusedev
#sudo mv target-fusedev/$rust_arch/release/nydus-image .
#sudo mv target-fusedev/$rust_arch/release/nydusctl .
#sudo mv target-virtiofs/$rust_arch/release/nydusd nydusd-virtiofs
sudo cp -r misc/configs .
sudo chown -R $(id -un):$(id -gn) . ~/.cargo/
pwd
ls -lh target-virtiofs/$arch-unknown-linux-musl/release
ls -lh target-virtiofs/$rust_arch/release
- name: Set up anchor file
env:
OSS_AK_ID: ${{ secrets.OSS_TEST_AK_ID }}
Expand Down
34 changes: 17 additions & 17 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
arch: [amd64, arm64]
arch: [amd64, arm64, ppc64le, riscv64]
steps:
- uses: actions/checkout@v2
- name: Cache cargo
Expand All @@ -30,15 +30,15 @@ jobs:
key: ${{ runner.os }}-cargo-${{ matrix.arch }}
- name: Build nydus-rs
run: |
declare -A rust_arch_map=( ["amd64"]="x86_64" ["arm64"]="aarch64")
arch=${rust_arch_map[${{ matrix.arch }}]}
cargo install --version 0.2.1 cross
declare -A rust_arch_map=( ["amd64"]="x86_64-unknown-linux-musl" ["arm64"]="aarch64-unknown-linux-musl" ["ppc64le"]="powerpc64le-unknown-linux-gnu" ["riscv64"]="riscv64gc-unknown-linux-gnu")
rust_arch=${rust_arch_map[${{ matrix.arch }}]}
cargo install --version 0.2.4 cross
rustup component add rustfmt clippy
make -e ARCH=$arch -e CARGO=cross static-release
sudo mv target-fusedev/$arch-unknown-linux-musl/release/nydusd nydusd-fusedev
sudo mv target-fusedev/$arch-unknown-linux-musl/release/nydus-image .
sudo mv target-fusedev/$arch-unknown-linux-musl/release/nydusctl .
sudo mv target-virtiofs/$arch-unknown-linux-musl/release/nydusd nydusd-virtiofs
make -e RUST_ARCH=$rust_arch -e CARGO=cross static-release
sudo mv target-fusedev/$rust_arch/release/nydusd nydusd-fusedev
sudo mv target-fusedev/$rust_arch/release/nydus-image .
sudo mv target-fusedev/$rust_arch/release/nydusctl .
sudo mv target-virtiofs/$rust_arch/release/nydusd nydusd-virtiofs
sudo cp -r misc/configs .
sudo chown -R $(id -un):$(id -gn) . ~/.cargo/
- name: store-artifacts
Expand Down Expand Up @@ -69,13 +69,13 @@ jobs:
- name: build
run: |
# MacOS bash is too old to support declare -A
arch=$(test ${{ matrix.arch }} == "amd64" && echo "x86_64" || echo "aarch64")
rust_arch=$(test ${{ matrix.arch }} == "amd64" && echo "x86_64-apple-darwin" || echo "aarch64-apple-darwin")
rustup component add rustfmt clippy
rustup target install $arch-apple-darwin
make -e ARCH=$arch macos-fusedev
sudo mv target-fusedev/$arch-apple-darwin/release/nydusd nydusd-fusedev
sudo mv target-fusedev/$arch-apple-darwin/release/nydus-image .
sudo mv target-fusedev/$arch-apple-darwin/release/nydusctl .
rustup target install $rust_arch
make -e RUST_ARCH=$rust_arch macos-fusedev
sudo mv target-fusedev/$rust_arch/release/nydusd nydusd-fusedev
sudo mv target-fusedev/$rust_arch/release/nydus-image .
sudo mv target-fusedev/$rust_arch/release/nydusctl .
sudo cp -r misc/configs .
sudo chown -R $(id -un):$(id -gn) . ~/.cargo/
- name: store-artifacts
Expand All @@ -91,7 +91,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
arch: [amd64, arm64]
arch: [amd64, arm64, ppc64le, riscv64]
env:
DOCKER: false
steps:
Expand Down Expand Up @@ -128,7 +128,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
arch: [amd64, arm64]
arch: [amd64, arm64, ppc64le, riscv64]
os: [linux]
needs: [nydus-linux, contrib-linux]
steps:
Expand Down
17 changes: 8 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ all: build
TEST_WORKDIR_PREFIX ?= "/tmp"
DOCKER ?= "true"

ARCH ?= $(shell uname -m)
OS ?= linux
RUST_ARCH ?= $(shell uname -m)
CARGO ?= $(shell which cargo)
CARGO_BUILD_GEARS = -v ~/.ssh/id_rsa:/root/.ssh/id_rsa -v ~/.cargo/git:/root/.cargo/git -v ~/.cargo/registry:/root/.cargo/registry
SUDO = $(shell which sudo)
Expand Down Expand Up @@ -57,7 +56,7 @@ endef
${CARGO} fmt -- --check

.musl_target:
$(eval CARGO_BUILD_FLAGS += --target ${ARCH}-unknown-${OS}-musl)
$(eval CARGO_BUILD_FLAGS += --target ${RUST_ARCH})

# Targets that are exposed to developers and users.
build: .format fusedev virtiofs
Expand Down Expand Up @@ -97,7 +96,7 @@ ut:
RUST_BACKTRACE=1 ${CARGO} test $(VIRIOFS_COMMON) --bin nydusd -- --nocapture --test-threads=8

macos-fusedev:
${CARGO} build --target ${ARCH}-apple-darwin --target-dir ${current_dir}/target-fusedev --features=fusedev --release --bin nydusctl --bin nydusd --bin nydus-image
${CARGO} build --target ${RUST_ARCH} --target-dir ${current_dir}/target-fusedev --features=fusedev --release --bin nydusctl --bin nydusd --bin nydus-image

macos-ut:
${CARGO} clippy --target-dir ${current_dir}/target-fusedev --features=fusedev --bin nydusd --release --workspace -- -Dwarnings
Expand All @@ -106,8 +105,8 @@ macos-ut:
TEST_WORKDIR_PREFIX=$(TEST_WORKDIR_PREFIX) RUST_BACKTRACE=1 ${CARGO} test $(FUSEDEV_COMMON) --bin nydusd -- --nocapture --test-threads=8

docker-static:
docker build -t nydus-rs-static --build-arg ARCH=${ARCH} misc/musl-static
docker run --rm ${CARGO_BUILD_GEARS} -e ARCH=${ARCH} --workdir /nydus-rs -v ${current_dir}:/nydus-rs nydus-rs-static
docker build -t nydus-rs-static --build-arg RUST_ARCH=${RUST_ARCH} misc/musl-static
docker run --rm ${CARGO_BUILD_GEARS} -e RUST_ARCH=${RUST_ARCH} --workdir /nydus-rs -v ${current_dir}:/nydus-rs nydus-rs-static

# Run smoke test including general integration tests and unit tests in container.
# Nydus binaries should already be prepared.
Expand All @@ -117,7 +116,7 @@ smoke: ut
$(SUDO) TEST_WORKDIR_PREFIX=$(TEST_WORKDIR_PREFIX) $(CARGO) test --test '*' $(FUSEDEV_COMMON) -- --nocapture --test-threads=8

docker-nydus-smoke:
docker build -t nydus-smoke --build-arg ARCH=${ARCH} misc/nydus-smoke
docker build -t nydus-smoke --build-arg RUST_ARCH=${RUST_ARCH} misc/nydus-smoke
docker run --rm --privileged ${CARGO_BUILD_GEARS} \
-e TEST_WORKDIR_PREFIX=$(TEST_WORKDIR_PREFIX) \
-v ~/.cargo:/root/.cargo \
Expand Down Expand Up @@ -197,8 +196,8 @@ all-contrib-test: nydusify-test ctr-remote-test \
nydus-overlayfs-test docker-nydus-graphdriver-test

docker-example: all-static-release
cp ${current_dir}/target-fusedev/${ARCH}-unknown-linux-musl/release/nydusd misc/example
cp ${current_dir}/target-fusedev/${ARCH}-unknown-linux-musl/release/nydus-image misc/example
cp ${current_dir}/target-fusedev/${RUST_ARCH}/release/nydusd misc/example
cp ${current_dir}/target-fusedev/${RUST_ARCH}/release/nydus-image misc/example
cp contrib/nydusify/cmd/nydusify misc/example
docker build -t nydus-rs-example misc/example
@cid=$(shell docker run --rm -t -d --privileged $(dind_cache_mount) nydus-rs-example)
Expand Down
4 changes: 2 additions & 2 deletions contrib/nydus-backend-proxy/Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
all:.format build

current_dir := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
ARCH := $(shell uname -p)
RUST_ARCH := $(shell uname -p)

.musl_target:
$(eval CARGO_BUILD_FLAGS += --target ${ARCH}-unknown-linux-musl)
$(eval CARGO_BUILD_FLAGS += --target ${RUST_ARCH}-unknown-linux-musl)

.release_version:
$(eval CARGO_BUILD_FLAGS += --release)
Expand Down
4 changes: 2 additions & 2 deletions misc/musl-static/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
FROM clux/muslrust:1.61.0

ARG ARCH=x86_64
ARG RUST_ARCH=x86_64

WORKDIR /nydus-rs

CMD rustup component add clippy && \
rustup component add rustfmt && \
rustup target add $ARCH-unknown-linux-musl && \
rustup target add $RUST_ARCH && \
make static-release
2 changes: 1 addition & 1 deletion misc/nydus-smoke/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM rust:1.61.0
ARG ARCH=x86_64
ARG RUST_ARCH=x86_64

RUN mkdir /root/.cargo/
RUN rustup component add rustfmt && rustup component add clippy
Expand Down

0 comments on commit 458314e

Please sign in to comment.