Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-13, windows-latest]
include:
- os: self-hosted # Add a native RISC-V leg that uses your self-hosted riscv64 runner
runs_on: '["self-hosted","Linux","riscv64"]'
runs-on: ${{ matrix.os }}
environment: CI
steps:
Expand All @@ -23,8 +26,16 @@ jobs:
uses: actions/setup-go@v5
with:
go-version: "1.23"

- name: Install dependencies (for self-hosted only)
if: matrix.os == 'self-hosted'
shell: bash
run: |
sudo apt update
sudo apt install -y make build-essential

- name: Unit Test
if: matrix.os != 'self-hosted'
run: make test
- name: Upload coverage infomartion
uses: codecov/codecov-action@v4
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,29 @@ jobs:
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags "-X 'github.com/aliyun/aliyun-cli/v3/cli.Version=${VERSION}'" -o out/aliyun main/main.go
tar zcvf out/aliyun-cli-linux-${VERSION}-arm64.tgz -C out aliyun
bash tools/upload_asset.sh ${VERSION} out/aliyun-cli-linux-${VERSION}-arm64.tgz
build_for_linux_riscv64:
needs: [create_release]
name: Native RISC-V Build
runs-on: self-hosted
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
steps:
- uses: actions/checkout@v4
with:
submodules: true
ref: ${{ github.ref }}
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.23'
- name: Build
run: |
TAG=${{ github.ref_name }}
VERSION=${TAG#v}
# build for Linux riscv64 (native)
CGO_ENABLED=0 GOOS=linux GOARCH=riscv64 go build -ldflags "-X 'github.com/aliyun/aliyun-cli/v3/cli.Version=${VERSION}'" -o out/aliyun main/main.go
tar zcvf out/aliyun-cli-linux-${VERSION}-riscv64.tgz -C out aliyun
bash tools/upload_asset.sh ${VERSION} out/aliyun-cli-linux-${VERSION}-riscv64.tgz
build_for_windows:
needs: [create_release]
name: Build for Windows
Expand Down
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export VERSION=3.0.0-beta
export RELEASE_PATH="releases/aliyun-cli-${VERSION}"
ARCH ?= $(shell uname -m)

all: build
publish: build build_mac build_linux build_windows build_linux_arm64 gen_version
Expand All @@ -14,7 +15,12 @@ build: deps
go build -ldflags "-X 'github.com/aliyun/aliyun-cli/cli.Version=${VERSION}'" -o out/aliyun main/main.go

install: build
cp out/aliyun /usr/local/bin
@if [ "$(ARCH)" = "riscv64" ]; then \
install -d "$(HOME)/.local/bin"; \
install -m755 out/aliyun "$(HOME)/.local/bin/aliyun"; \
else \
install -Dm755 out/aliyun /usr/local/bin/aliyun; \
fi

build_mac:
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags "-X 'github.com/aliyun/aliyun-cli/cli.Version=${VERSION}'" -o out/aliyun main/main.go
Expand Down
Loading