File tree Expand file tree Collapse file tree 3 files changed +41
-1
lines changed Expand file tree Collapse file tree 3 files changed +41
-1
lines changed Original file line number Diff line number Diff line change 12
12
strategy :
13
13
matrix :
14
14
os : [ubuntu-latest, macos-13, windows-latest]
15
+ include :
16
+ - os : self-hosted # Add a native RISC-V leg that uses your self-hosted riscv64 runner
17
+ runs_on : ' ["self-hosted","Linux","riscv64"]'
15
18
runs-on : ${{ matrix.os }}
16
19
environment : CI
17
20
steps :
23
26
uses : actions/setup-go@v5
24
27
with :
25
28
go-version : " 1.23"
29
+
30
+ - name : Install dependencies (for self-hosted only)
31
+ if : matrix.os == 'self-hosted'
32
+ shell : bash
33
+ run : |
34
+ sudo apt update
35
+ sudo apt install -y make build-essential
26
36
27
37
- name : Unit Test
38
+ if : matrix.os != 'self-hosted'
28
39
run : make test
29
40
- name : Upload coverage infomartion
30
41
uses : codecov/codecov-action@v4
Original file line number Diff line number Diff line change @@ -107,6 +107,29 @@ jobs:
107
107
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
108
108
tar zcvf out/aliyun-cli-linux-${VERSION}-arm64.tgz -C out aliyun
109
109
bash tools/upload_asset.sh ${VERSION} out/aliyun-cli-linux-${VERSION}-arm64.tgz
110
+ build_for_linux_riscv64 :
111
+ needs : [create_release]
112
+ name : Native RISC-V Build
113
+ runs-on : self-hosted
114
+ env :
115
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
116
+ steps :
117
+ - uses : actions/checkout@v4
118
+ with :
119
+ submodules : true
120
+ ref : ${{ github.ref }}
121
+ - name : Set up Go
122
+ uses : actions/setup-go@v5
123
+ with :
124
+ go-version : ' 1.23'
125
+ - name : Build
126
+ run : |
127
+ TAG=${{ github.ref_name }}
128
+ VERSION=${TAG#v}
129
+ # build for Linux riscv64 (native)
130
+ 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
131
+ tar zcvf out/aliyun-cli-linux-${VERSION}-riscv64.tgz -C out aliyun
132
+ bash tools/upload_asset.sh ${VERSION} out/aliyun-cli-linux-${VERSION}-riscv64.tgz
110
133
build_for_windows :
111
134
needs : [create_release]
112
135
name : Build for Windows
Original file line number Diff line number Diff line change 1
1
export VERSION =3.0.0-beta
2
2
export RELEASE_PATH ="releases/aliyun-cli-${VERSION}"
3
+ ARCH ?= $(shell uname -m)
3
4
4
5
all : build
5
6
publish : build build_mac build_linux build_windows build_linux_arm64 gen_version
@@ -14,7 +15,12 @@ build: deps
14
15
go build -ldflags " -X 'github.com/aliyun/aliyun-cli/cli.Version=${VERSION} '" -o out/aliyun main/main.go
15
16
16
17
install : build
17
- cp out/aliyun /usr/local/bin
18
+ @if [ " $( ARCH) " = " riscv64" ]; then \
19
+ install -d " $( HOME) /.local/bin" ; \
20
+ install -m755 out/aliyun " $( HOME) /.local/bin/aliyun" ; \
21
+ else \
22
+ install -Dm755 out/aliyun /usr/local/bin/aliyun; \
23
+ fi
18
24
19
25
build_mac :
20
26
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
You can’t perform that action at this time.
0 commit comments