3
3
push :
4
4
branches :
5
5
- master
6
- - dev
6
+ - sprint*
7
7
- staging
8
8
tags :
9
9
- ' v*.*.*'
10
+ pull_request :
10
11
workflow_dispatch :
11
12
12
13
jobs :
13
14
build-linux :
14
15
name : Build-linux
15
- runs-on : [self-hosted, build]
16
+ runs-on : [self-hosted, ubuntu- build]
16
17
steps :
17
18
- name : Install deps
18
19
run : |
@@ -22,39 +23,21 @@ jobs:
22
23
- name : Checkout
23
24
uses : actions/checkout@v2
24
25
26
+ - name : Setup gopath and gocache
27
+ run : |
28
+ echo "GOPATH=$HOME/go" >> $GITHUB_ENV
29
+ echo "GOCACHE=$GITHUB_WORKSPACE/.gocache" >> $GITHUB_ENV
30
+
25
31
- name : Setup go 1.20
26
- uses : actions/setup-go@v2
32
+ uses : actions/setup-go@v3
27
33
with :
28
- go-version : ' 1.20' # The Go version to download (if necessary) and use.
29
-
30
- - name : Set GITHUB_ENV
31
- run : |
32
- echo "BRANCH=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV
33
-
34
- if [[ "${{github.base_ref}}" == "master" || "${{github.ref}}" == "refs/heads/master" ]]; then
35
- echo "TAG=v0.0.0-master" >> $GITHUB_ENV
36
- elif [[ "${{github.base_ref}}" == "dev" || "${{github.ref}}" == "refs/heads/dev" ]]; then
37
- echo "TAG=v0.0.0-dev" >> $GITHUB_ENV
38
- elif [[ "${{github.base_ref}}" == "staging" || "${{github.ref}}" == "refs/heads/staging" ]]; then
39
- echo "TAG=v0.0.0-staging" >> $GITHUB_ENV
40
- else
41
- echo "TAG=$(echo ${GITHUB_REF#refs/tags/})" >> $GITHUB_ENV
42
- fi
34
+ go-version : ' 1.20'
43
35
44
36
- name : Install
45
- run : make install
46
-
47
- - name : Zip release
48
- run : tar -czvf zbox-linux.tar.gz ./zbox
49
-
50
- - name : Upload binaries to release
51
- uses : svenstaro/upload-release-action@v2
52
- with :
53
- repo_token : ${{ secrets.GITHUB_TOKEN }}
54
- file : zbox-linux.tar.gz
55
- tag : ${{ env.TAG }}
56
- overwrite : true
57
- file_glob : true
37
+ run : |
38
+ lsb_release -a
39
+
40
+ make install
58
41
59
42
- name : ' Upload Artifact'
60
43
uses : actions/upload-artifact@v2
@@ -66,51 +49,61 @@ jobs:
66
49
build-windows :
67
50
name : Build-windows
68
51
runs-on : windows-runner
52
+ defaults :
53
+ run :
54
+ shell : msys2 {0}
55
+ strategy :
56
+ matrix :
57
+ sys : [ MINGW64 ]
69
58
steps :
70
- - name : Setup go 1.20
71
- uses : actions/setup-go@v2
59
+ - uses : msys2/setup-msys2@v2
72
60
with :
73
- go-version : ' 1.20 ' # The Go version to download (if necessary) and use.
61
+ msystem : ${{matrix.sys}}
74
62
75
- - name : Checkout
76
- uses : actions/checkout@v2
63
+ - name : Install libraries
64
+ run : |
65
+ echo 'Y'| pacman -S base-devel git gcc make
77
66
78
- - name : Set GITHUB_ENV
67
+ - name : Install Clang and Go for MINGW64
79
68
run : |
80
- IF ( "${{github.base_ref}}" -eq "master" -OR "${{github.ref}}" -eq "refs/heads/master" ){
81
- echo "TAG=v0.0.0-master" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
82
- } ElseIf ( "${{github.base_ref}}" -eq "dev" -OR "${{github.ref}}" -eq "refs/heads/dev" ){
83
- echo "TAG=v0.0.0-dev" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
84
- } ElseIf ( "${{github.base_ref}}" -eq "staging" -OR "${{github.ref}}" -eq "refs/heads/staging" ){
85
- echo "TAG=v0.0.0-staging" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
86
- } ELSE {
87
- echo "TAG=${{github.ref}}" | %{$_ -replace('refs/tags/', '')} | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
88
- }
69
+ echo 'y'| pacman -S mingw-w64-x86_64-clang mingw-w64-x86_64-go zip unzip
70
+
71
+ - name : Set environment variables
72
+ run : |
73
+ export GOROOT=/mingw64/lib/go
74
+ export GOPATH=/mingw64
75
+ export PATH=$PATH:$GOROOT/bin
76
+ export PATH=$PATH:/usr/bin/7z
77
+
78
+ # use clang as a default compiler for CGO
79
+ go env -w "CC=/mingw64/bin/clang.exe"
80
+
81
+ - name : Checkout
82
+ uses : actions/checkout@v2
89
83
90
84
- name : Install
91
85
run : make install
92
86
93
87
- name : Zip release
94
88
run : |
95
- copy zbox zbox.exe
96
- 7z a zbox-windows.zip zbox.exe
97
-
98
- - name : Upload binaries to release
99
- uses : svenstaro/upload-release-action@v2
100
- with :
101
- repo_token : ${{ secrets.GITHUB_TOKEN }}
102
- file : zbox-windows.zip
103
- tag : ${{ env.TAG }}
104
- overwrite : true
105
- file_glob : true
89
+ # download dll files
90
+ wget https://github.com/0chain/zboxcli/files/11840033/windows.dll.s.zip
91
+ unzip -o windows.dll.s.zip
92
+ cp zbox zbox.exe
93
+ zip zbox-windows.zip zbox.exe libgcc_s_seh-1.dll libstdc++-6.dll libwinpthread-1.dll
106
94
107
95
- name : ' Upload Artifact'
108
96
uses : actions/upload-artifact@v2
109
97
with :
110
- name : zbox-windows
111
- path : zbox
98
+ name : zbox-windows.zip
99
+ path : zbox-windows.zip
112
100
retention-days : 5
113
101
102
+ - name : cleanup workspace
103
+ run : |
104
+ rm -Recurse ${{github.workspace}}\*
105
+ shell : powershell
106
+
114
107
build-macos :
115
108
name : Build-macos
116
109
runs-on : macos-runner
@@ -124,37 +117,16 @@ jobs:
124
117
- name : Checkout
125
118
uses : actions/checkout@v2
126
119
127
- - name : Set GITHUB_ENV
128
- run : |
129
- echo "BRANCH=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV
130
-
131
- if [[ "${{github.base_ref}}" == "master" || "${{github.ref}}" == "refs/heads/master" ]]; then
132
- echo "TAG=v0.0.0-master" >> $GITHUB_ENV
133
- elif [[ "${{github.base_ref}}" == "dev" || "${{github.ref}}" == "refs/heads/dev" ]]; then
134
- echo "TAG=v0.0.0-dev" >> $GITHUB_ENV
135
- elif [[ "${{github.base_ref}}" == "staging" || "${{github.ref}}" == "refs/heads/staging" ]]; then
136
- echo "TAG=v0.0.0-dev" >> $GITHUB_ENV
137
- else
138
- echo "TAG=$(echo ${GITHUB_REF#refs/tags/})" >> $GITHUB_ENV
139
- fi
140
-
141
120
- name : Install
142
121
run : make install
143
- - name : Zip release
144
- run : tar -czvf zbox-macos.tar.gz ./zbox
145
-
146
- - name : Upload binaries to release
147
- uses : svenstaro/upload-release-action@v2
148
- with :
149
- repo_token : ${{ secrets.GITHUB_TOKEN }}
150
- file : zbox-macos.tar.gz
151
- tag : ${{ env.TAG }}
152
- overwrite : true
153
- file_glob : true
154
122
155
123
- name : ' Upload Artifact'
156
124
uses : actions/upload-artifact@v2
157
125
with :
158
126
name : zbox-macos
159
127
path : zbox
160
128
retention-days : 5
129
+
130
+ - name : cleanup workspace
131
+ run : |
132
+ rm -rf ./*
0 commit comments