Skip to content

Commit

Permalink
action: test build with more architectures
Browse files Browse the repository at this point in the history
Test build with more architectures, but only use `amd64` in next jobs.

Signed-off-by: Yadong Ding <[email protected]>
  • Loading branch information
Desiki-high committed Dec 9, 2023
1 parent a3e60c0 commit d3c9353
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
23 changes: 18 additions & 5 deletions .github/workflows/smoke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -31,16 +34,20 @@ 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
path: contrib/nydusify/cmd

nydus-build:
runs-on: ubuntu-latest
strategy:
matrix:
arch: [amd64, arm64, ppc64le, riscv64]
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion contrib/nydusify/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d3c9353

Please sign in to comment.