Skip to content

Commit 57420f0

Browse files
authored
Merge branch 'sprint-1.11' into feature/swap
2 parents 102befd + 7734300 commit 57420f0

File tree

2 files changed

+99
-107
lines changed

2 files changed

+99
-107
lines changed

.github/workflows/build-zwallet.yaml

Lines changed: 43 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ on:
44
branches:
55
- master
66
- staging
7+
- sprint*
78
tags:
89
- 'v*.*.*'
10+
pull_request:
911

1012
jobs:
1113
build-linux:
@@ -16,44 +18,18 @@ jobs:
1618
run: |
1719
sudo apt update
1820
sudo apt -y install build-essential nghttp2 libnghttp2-dev libssl-dev
19-
21+
2022
- name: Setup go 1.18
2123
uses: actions/setup-go@v2
2224
with:
2325
go-version: ^1.20.0 # The Go version to download (if necessary) and use.
2426

2527
- name: Checkout
2628
uses: actions/checkout@v2
27-
28-
- name: Set GITHUB_ENV
29-
run: |
30-
echo "BRANCH=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV
31-
32-
if [[ "${{github.base_ref}}" == "master" || "${{github.ref}}" == "refs/heads/master" ]]; then
33-
echo "TAG=v0.0.0-master" >> $GITHUB_ENV
34-
elif [[ "${{github.base_ref}}" == "dev" || "${{github.ref}}" == "refs/heads/dev" ]]; then
35-
echo "TAG=v0.0.0-dev" >> $GITHUB_ENV
36-
elif [[ "${{github.base_ref}}" == "staging" || "${{github.ref}}" == "refs/heads/staging" ]]; then
37-
echo "TAG=v0.0.0-staging" >> $GITHUB_ENV
38-
else
39-
echo "TAG=$(echo ${GITHUB_REF#refs/tags/})" >> $GITHUB_ENV
40-
fi
4129

4230
- name: Install
4331
run: make install
4432

45-
- name: Zip release
46-
run: tar -czvf zwallet-linux.tar.gz ./zwallet
47-
48-
- name: Upload binaries to release
49-
uses: svenstaro/upload-release-action@v2
50-
with:
51-
repo_token: ${{ secrets.GITHUB_TOKEN }}
52-
file: zwallet-linux.tar.gz
53-
tag: ${{ env.TAG }}
54-
overwrite: true
55-
file_glob: true
56-
5733
- name: 'Upload Artifact'
5834
uses: actions/upload-artifact@v2
5935
with:
@@ -64,51 +40,61 @@ jobs:
6440
build-windows:
6541
name: Build-windows
6642
runs-on: windows-runner
43+
defaults:
44+
run:
45+
shell: msys2 {0}
46+
strategy:
47+
matrix:
48+
sys: [ MINGW64 ]
6749
steps:
68-
- name: Setup go
69-
uses: actions/setup-go@v3
50+
- uses: msys2/setup-msys2@v2
7051
with:
71-
go-version: ^1.20.0 # The Go version to download (if necessary) and use.
52+
msystem: ${{matrix.sys}}
53+
54+
- name: Install libraries
55+
run: |
56+
echo 'Y'| pacman -S base-devel git gcc make
57+
58+
- name: Install Clang and Go for MINGW64
59+
run: |
60+
echo 'y'| pacman -S mingw-w64-x86_64-clang mingw-w64-x86_64-go zip unzip
61+
62+
- name: Set environment variables
63+
run: |
64+
export GOROOT=/mingw64/lib/go
65+
export GOPATH=/mingw64
66+
export PATH=$PATH:$GOROOT/bin
67+
export PATH=$PATH:/usr/bin/7z
68+
69+
# use clang as a default compiler for CGO
70+
go env -w "CC=/mingw64/bin/clang.exe"
7271
7372
- name: Checkout
7473
uses: actions/checkout@v2
7574

76-
- name: Set GITHUB_ENV
77-
run: |
78-
IF ( "${{github.base_ref}}" -eq "master" -OR "${{github.ref}}" -eq "refs/heads/master" ){
79-
echo "TAG=v0.0.0-master" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
80-
} ElseIf ( "${{github.base_ref}}" -eq "dev" -OR "${{github.ref}}" -eq "refs/heads/dev" ){
81-
echo "TAG=v0.0.0-dev" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
82-
} ElseIf ( "${{github.base_ref}}" -eq "staging" -OR "${{github.ref}}" -eq "refs/heads/staging" ){
83-
echo "TAG=v0.0.0-staging" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
84-
} ELSE {
85-
echo "TAG=${{github.ref}}" | %{$_ -replace('refs/tags/', '')} | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
86-
}
87-
88-
8975
- name: Install
9076
run: make install
91-
77+
9278
- name: Zip release
9379
run: |
94-
copy zwallet zwallet.exe
95-
7z a zwallet-windows.zip zwallet.exe
96-
97-
- name: Upload binaries to release
98-
uses: svenstaro/upload-release-action@v2
99-
with:
100-
repo_token: ${{ secrets.GITHUB_TOKEN }}
101-
file: zwallet-windows.zip
102-
tag: ${{ env.TAG }}
103-
overwrite: true
104-
file_glob: true
80+
# download dll files
81+
wget https://github.com/0chain/zboxcli/files/11840033/windows.dll.s.zip
82+
unzip -o windows.dll.s.zip
83+
cp zwallet zwallet.exe
84+
zip zwallet-windows.zip zwallet.exe libgcc_s_seh-1.dll libstdc++-6.dll libwinpthread-1.dll
10585
10686
- name: 'Upload Artifact'
10787
uses: actions/upload-artifact@v2
10888
with:
109-
name: zwallet-windows
110-
path: zwallet
89+
name: zwallet-windows.zip
90+
path: zwallet-windows.zip
11191
retention-days: 5
92+
93+
- name: cleanup workspace
94+
run: |
95+
rm -Recurse ${{github.workspace}}\*
96+
shell: powershell
97+
11298
build-macos:
11399
name: Build-macos
114100
runs-on: macos-runner
@@ -119,34 +105,9 @@ jobs:
119105
go-version: ^1.20.0 # The Go version to download (if necessary) and use.
120106
- name: Checkout
121107
uses: actions/checkout@v2
122-
123-
- name: Set GITHUB_ENV
124-
run: |
125-
echo "BRANCH=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV
126-
127-
if [[ "${{github.base_ref}}" == "master" || "${{github.ref}}" == "refs/heads/master" ]]; then
128-
echo "TAG=v0.0.0-master" >> $GITHUB_ENV
129-
elif [[ "${{github.base_ref}}" == "dev" || "${{github.ref}}" == "refs/heads/dev" ]]; then
130-
echo "TAG=v0.0.0-dev" >> $GITHUB_ENV
131-
elif [[ "${{github.base_ref}}" == "staging" || "${{github.ref}}" == "refs/heads/staging" ]]; then
132-
echo "TAG=v0.0.0-staging" >> $GITHUB_ENV
133-
else
134-
echo "TAG=$(echo ${GITHUB_REF#refs/tags/})" >> $GITHUB_ENV
135-
fi
136108

137109
- name: Install
138110
run: make install
139-
- name: Zip release
140-
run: tar -czvf zwallet-macos.tar.gz ./zwallet
141-
142-
- name: Upload binaries to release
143-
uses: svenstaro/upload-release-action@v2
144-
with:
145-
repo_token: ${{ secrets.GITHUB_TOKEN }}
146-
file: zwallet-macos.tar.gz
147-
tag: ${{ env.TAG }}
148-
overwrite: true
149-
file_glob: true
150111

151112
- name: 'Upload Artifact'
152113
uses: actions/upload-artifact@v2

.github/workflows/build-zwalletcli.yml renamed to .github/workflows/release-zwalletcli.yml

Lines changed: 56 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ on:
1414

1515
env:
1616
GITHUB_TOKEN: ${{ secrets.GOSDK }}
17-
17+
1818
jobs:
1919
build-linux:
2020
name: Build-Linux
@@ -23,19 +23,19 @@ jobs:
2323
steps:
2424
- name: Checkout code
2525
uses: actions/checkout@v2
26-
26+
2727
- name: Set up Go
2828
uses: actions/setup-go@v3
2929
with:
3030
go-version: ^1.20.0
3131

3232
- name: Install
3333
run: make install
34-
34+
3535
- name: Get Branch
3636
id: get_version
3737
run: |
38-
VERSION=$(echo ${GITHUB_REF#refs/heads/})
38+
VERSION=$(echo ${GITHUB_REF#refs/heads/})
3939
echo ::set-output name=TAG::${VERSION}
4040
4141
- name: Zip release
@@ -69,7 +69,7 @@ jobs:
6969
delete_release: true # default: false
7070
tag_name: v0.0.0 # tag name to delete
7171
repo: 0chain/zwalletcli # target repo (optional). defaults to repo running this action
72-
72+
7373
- name: Create Release for Fixed v0.0.0
7474
if: github.event.inputs.fixed_tag == 'yes' && steps.get_version.outputs.TAG == 'master'
7575
uses: zendesk/action-create-release@v1
@@ -78,52 +78,83 @@ jobs:
7878
release_name: v0.0.0
7979
draft: false
8080
prerelease: false
81-
81+
8282
############################### v*.*.* #############################
8383

8484
- name: Create Release for Next Version
8585
id: create_release_next_version
86-
uses: zendesk/action-create-release@v1
86+
uses: zendesk/action-create-release@v1
8787
with:
8888
draft: false
8989
prerelease: false
9090
auto_increment_type: ${{ github.event.inputs.version_tag }}
9191
tag_schema: semantic
92-
92+
9393
- name: 'Upload Artifact'
9494
uses: actions/upload-artifact@v2
9595
with:
9696
name: zwallet-linux
9797
path: zwallet
9898
retention-days: 5
99-
99+
100100
build-windows:
101-
name: Build-Windows
101+
name: Build-windows
102102
runs-on: windows-runner
103-
103+
defaults:
104+
run:
105+
shell: msys2 {0}
106+
strategy:
107+
matrix:
108+
sys: [ MINGW64 ]
104109
steps:
105-
- name: Setup go
106-
uses: actions/setup-go@v3
110+
- uses: msys2/setup-msys2@v2
107111
with:
108-
go-version: ^1.20.0 # The Go version to download (if necessary) and use.
112+
msystem: ${{matrix.sys}}
113+
114+
- name: Install libraries
115+
run: |
116+
echo 'Y'| pacman -S base-devel git gcc make
117+
118+
- name: Install Clang and Go for MINGW64
119+
run: |
120+
echo 'y'| pacman -S mingw-w64-x86_64-clang mingw-w64-x86_64-go zip unzip
121+
122+
- name: Set environment variables
123+
run: |
124+
export GOROOT=/mingw64/lib/go
125+
export GOPATH=/mingw64
126+
export PATH=$PATH:$GOROOT/bin
127+
export PATH=$PATH:/usr/bin/7z
128+
129+
# use clang as a default compiler for CGO
130+
go env -w "CC=/mingw64/bin/clang.exe"
131+
109132
- name: Checkout
110133
uses: actions/checkout@v2
111-
134+
112135
- name: Install
113136
run: make install
114-
137+
115138
- name: Zip release
116139
run: |
117-
copy zwallet zwallet.exe
118-
7z a zwallet-windows.zip zwallet.exe
140+
# download dll files
141+
wget https://github.com/0chain/zboxcli/files/11840033/windows.dll.s.zip
142+
unzip -o windows.dll.s.zip
143+
cp zwallet zwallet.exe
144+
zip zwallet-windows.zip zwallet.exe libgcc_s_seh-1.dll libstdc++-6.dll libwinpthread-1.dll
119145
120146
- name: 'Upload Artifact'
121147
uses: actions/upload-artifact@v2
122148
with:
123-
name: zwallet-windows
124-
path: zwallet
149+
name: zwallet-windows.zip
150+
path: zwallet-windows.zip
125151
retention-days: 5
126-
152+
153+
- name: cleanup workspace
154+
run: |
155+
rm -Recurse ${{github.workspace}}\*
156+
shell: powershell
157+
127158
build-macos:
128159
name: Build-MacOS
129160
runs-on: macos-runner
@@ -134,16 +165,16 @@ jobs:
134165
go-version: ^1.20.0 # The Go version to download (if necessary) and use.
135166
- name: Checkout
136167
uses: actions/checkout@v2
137-
168+
138169
- name: Install
139170
run: make install
140171

141172
- name: Get Branch
142173
id: get_version
143174
run: |
144-
VERSION=$(echo ${GITHUB_REF#refs/heads/})
175+
VERSION=$(echo ${GITHUB_REF#refs/heads/})
145176
echo ::set-output name=TAG::${VERSION}
146-
177+
147178
- name: Zip release
148179
run: tar -czvf zwallet-macos.tar.gz ./zwallet
149180

@@ -153,4 +184,4 @@ jobs:
153184
name: zwallet-macos
154185
path: zwallet
155186
retention-days: 5
156-
187+

0 commit comments

Comments
 (0)