Skip to content

Commit 90e73d3

Browse files
authored
Use github workflow (#447)
Signed-off-by: adshao <[email protected]> Signed-off-by: adshao <[email protected]>
1 parent 796a999 commit 90e73d3

File tree

5 files changed

+85
-28
lines changed

5 files changed

+85
-28
lines changed

.codecov.yml

-4
This file was deleted.

.github/workflows/check.yml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Check
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
workflow_dispatch:
8+
9+
jobs:
10+
UnitTest:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
- name: Setup Go
15+
uses: actions/setup-go@v3
16+
with:
17+
go-version-file: './v2/go.mod'
18+
cache: true
19+
cache-dependency-path: './v2/go.sum'
20+
- name: Format
21+
run: ./check.sh format
22+
- name: Vet
23+
run: ./check.sh vet
24+
- name: UnitTest
25+
run: ./check.sh unittest

.travis.yml

-21
This file was deleted.

check.sh

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
ACTION=$1
6+
7+
function format() {
8+
echo "Running gofmt ..."
9+
if [[ $1 == "-w" ]]; then
10+
gofmt -w $(find . -type f -name '*.go' -not -path "./vendor/*")
11+
elif [[ $1 == "-l" ]]; then
12+
gofmt -l $(find . -type f -name '*.go' -not -path "./vendor/*")
13+
else
14+
test -z "$(gofmt -l $(find . -type f -name '*.go' -not -path "./vendor/*"))"
15+
fi
16+
}
17+
18+
function lint() {
19+
echo "Running golint ..."
20+
go install golang.org/x/lint/golint
21+
golint -set_exit_status ./...
22+
}
23+
24+
function vet() {
25+
echo "Running go vet ..."
26+
(
27+
cd v2
28+
go vet ./...
29+
)
30+
}
31+
32+
function unittest() {
33+
echo "Running go test ..."
34+
(
35+
cd v2
36+
go test -v -race -coverprofile=coverage.txt -covermode=atomic ./...
37+
)
38+
}
39+
40+
if [[ -z $ACTION ]]; then
41+
format
42+
# lint
43+
vet
44+
unittest
45+
else
46+
shift
47+
$ACTION "$@"
48+
fi

v2/go.mod

+12-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
11
module github.com/adshao/go-binance/v2
22

3-
go 1.13
3+
go 1.18
44

55
require (
66
github.com/bitly/go-simplejson v0.5.0
7-
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 // indirect
87
github.com/gorilla/websocket v1.5.0
98
github.com/json-iterator/go v1.1.12
10-
github.com/kr/pretty v0.2.0 // indirect
119
github.com/stretchr/testify v1.4.0
1210
)
11+
12+
require (
13+
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 // indirect
14+
github.com/davecgh/go-spew v1.1.1 // indirect
15+
github.com/kr/pretty v0.2.0 // indirect
16+
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 // indirect
17+
github.com/modern-go/reflect2 v1.0.2 // indirect
18+
github.com/pmezard/go-difflib v1.0.0 // indirect
19+
github.com/stretchr/objx v0.1.0 // indirect
20+
gopkg.in/yaml.v2 v2.2.2 // indirect
21+
)

0 commit comments

Comments
 (0)