diff --git a/.github/workflows/smoke.yml b/.github/workflows/smoke.yml index d91603b709e..5fca549bcfa 100644 --- a/.github/workflows/smoke.yml +++ b/.github/workflows/smoke.yml @@ -20,6 +20,9 @@ env: jobs: contrib-build: runs-on: ubuntu-latest + strategy: + matrix: + arch: [amd64, arm64, ppc64le, riscv64] steps: - name: Checkout uses: actions/checkout@v3 @@ -31,9 +34,10 @@ jobs: - name: Build Contrib run: | curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sudo sh -s -- -b /usr/bin v1.51.2 - make -e DOCKER=false nydusify-release - make -e DOCKER=false contrib-test + make -e DOCKER=false GOARCH=${{ matrix.arch }} nydusify-release + make -e DOCKER=false GOARCH=${{ matrix.arch }} contrib-test - name: Upload Nydusify + if: matrix.arch == 'amd64' uses: actions/upload-artifact@master with: name: nydusify-artifact @@ -41,6 +45,9 @@ jobs: nydus-build: runs-on: ubuntu-latest + strategy: + matrix: + arch: [amd64, arm64, ppc64le, riscv64] steps: - name: Checkout uses: actions/checkout@v3 @@ -52,15 +59,21 @@ jobs: save-if: ${{ github.ref == 'refs/heads/master' }} - name: Build Nydus run: | + declare -A rust_target_map=( ["amd64"]="x86_64-unknown-linux-musl" ["arm64"]="aarch64-unknown-linux-musl" ["ppc64le"]="powerpc64le-unknown-linux-gnu" ["riscv64"]="riscv64gc-unknown-linux-gnu") + RUST_TARGET=${rust_target_map[${{ matrix.arch }}]} + cargo install --version 0.2.4 cross rustup component add rustfmt clippy - make + make -e RUST_TARGET_STATIC=$RUST_TARGET -e CARGO=cross static-release + sudo mv target/$RUST_TARGET/release/nydusd . + sudo mv target/$RUST_TARGET/release/nydus-image . - name: Upload Nydus Binaries + if: matrix.arch == 'amd64' uses: actions/upload-artifact@master with: name: nydus-artifact path: | - target/release/nydus-image - target/release/nydusd + nydus-image + nydusd nydusd-build-macos: runs-on: macos-11 diff --git a/contrib/nydusify/Makefile b/contrib/nydusify/Makefile index 7d03a851221..e60f1b731f3 100644 --- a/contrib/nydusify/Makefile +++ b/contrib/nydusify/Makefile @@ -29,7 +29,7 @@ plugin: test: build build-smoke @go vet $(PACKAGES) golangci-lint run - @go test -covermode=atomic -coverprofile=coverage.out -count=1 -v -timeout 20m -race ./pkg/... ./cmd/... + @CGO_ENABLED=1 go test -covermode=atomic -coverprofile=coverage.out -count=1 -v -timeout 20m -race ./pkg/... ./cmd/... coverage: test @go tool cover -func=coverage.out