Skip to content

Commit

Permalink
Use github workflow (#447)
Browse files Browse the repository at this point in the history
Signed-off-by: adshao <tjusgj@gmail.com>

Signed-off-by: adshao <tjusgj@gmail.com>
  • Loading branch information
adshao committed Dec 22, 2022
1 parent 796a999 commit 90e73d3
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 28 deletions.
4 changes: 0 additions & 4 deletions .codecov.yml

This file was deleted.

25 changes: 25 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Check

on:
pull_request:
branches:
- master
workflow_dispatch:

jobs:
UnitTest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version-file: './v2/go.mod'
cache: true
cache-dependency-path: './v2/go.sum'
- name: Format
run: ./check.sh format
- name: Vet
run: ./check.sh vet
- name: UnitTest
run: ./check.sh unittest
21 changes: 0 additions & 21 deletions .travis.yml

This file was deleted.

48 changes: 48 additions & 0 deletions check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/bash

set -e

ACTION=$1

function format() {
echo "Running gofmt ..."
if [[ $1 == "-w" ]]; then
gofmt -w $(find . -type f -name '*.go' -not -path "./vendor/*")
elif [[ $1 == "-l" ]]; then
gofmt -l $(find . -type f -name '*.go' -not -path "./vendor/*")
else
test -z "$(gofmt -l $(find . -type f -name '*.go' -not -path "./vendor/*"))"
fi
}

function lint() {
echo "Running golint ..."
go install golang.org/x/lint/golint
golint -set_exit_status ./...
}

function vet() {
echo "Running go vet ..."
(
cd v2
go vet ./...
)
}

function unittest() {
echo "Running go test ..."
(
cd v2
go test -v -race -coverprofile=coverage.txt -covermode=atomic ./...
)
}

if [[ -z $ACTION ]]; then
format
# lint
vet
unittest
else
shift
$ACTION "$@"
fi
15 changes: 12 additions & 3 deletions v2/go.mod
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
module github.com/adshao/go-binance/v2

go 1.13
go 1.18

require (
github.com/bitly/go-simplejson v0.5.0
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 // indirect
github.com/gorilla/websocket v1.5.0
github.com/json-iterator/go v1.1.12
github.com/kr/pretty v0.2.0 // indirect
github.com/stretchr/testify v1.4.0
)

require (
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/kr/pretty v0.2.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/stretchr/objx v0.1.0 // indirect
gopkg.in/yaml.v2 v2.2.2 // indirect
)

0 comments on commit 90e73d3

Please sign in to comment.