forked from TrueCloudLab/frostfs-api-go
Merge pull request #8 from nspcc-dev/add-ci-github-actions
Add ci GitHub actions
This commit is contained in:
commit
5d4759a6c6
5 changed files with 45 additions and 12 deletions
41
.github/workflows/go.yml
vendored
Normal file
41
.github/workflows/go.yml
vendored
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
name: Go
|
||||||
|
on: [push]
|
||||||
|
jobs:
|
||||||
|
|
||||||
|
test:
|
||||||
|
name: test
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
go: [ '1.11.x', '1.12.x', '1.13.x']
|
||||||
|
steps:
|
||||||
|
|
||||||
|
- name: Setup go
|
||||||
|
uses: actions/setup-go@v1
|
||||||
|
with:
|
||||||
|
go-version: ${{ matrix.go }}
|
||||||
|
|
||||||
|
- name: Check out code into the Go module directory
|
||||||
|
uses: actions/checkout@v1
|
||||||
|
|
||||||
|
- name: Set GOPATH
|
||||||
|
# temporary fix
|
||||||
|
# see https://github.com/actions/setup-go/issues/14
|
||||||
|
run: |
|
||||||
|
echo "##[set-env name=GOPATH;]$(dirname $GITHUB_WORKSPACE)"
|
||||||
|
echo "##[add-path]$(dirname $GITHUB_WORKSPACE)/bin"
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- name: Get dependencies
|
||||||
|
run: |
|
||||||
|
go get -u -v golang.org/x/lint/golint
|
||||||
|
go mod tidy -v
|
||||||
|
|
||||||
|
- name: Linter
|
||||||
|
run: golint -set_exit_status ./...
|
||||||
|
|
||||||
|
- name: Tests
|
||||||
|
run: go test -coverprofile=coverage.txt -covermode=atomic ./...
|
||||||
|
|
||||||
|
- name: Codecov
|
||||||
|
run: bash <(curl -s https://codecov.io/bash)
|
|
@ -15,7 +15,7 @@ type (
|
||||||
UUID = refs.UUID
|
UUID = refs.UUID
|
||||||
// OwnerID type alias.
|
// OwnerID type alias.
|
||||||
OwnerID = refs.OwnerID
|
OwnerID = refs.OwnerID
|
||||||
// OwnerID type alias.
|
// MessageID type alias.
|
||||||
MessageID = refs.MessageID
|
MessageID = refs.MessageID
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -68,8 +68,8 @@ func (m *Container) Empty() bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
// -- Test container definition -- //
|
// -- Test container definition -- //
|
||||||
|
|
||||||
// NewTestContainer returns test container.
|
// NewTestContainer returns test container.
|
||||||
//
|
|
||||||
// WARNING: DON'T USE THIS OUTSIDE TESTS.
|
// WARNING: DON'T USE THIS OUTSIDE TESTS.
|
||||||
func NewTestContainer() (*Container, error) {
|
func NewTestContainer() (*Container, error) {
|
||||||
key := test.DecodeKey(0)
|
key := test.DecodeKey(0)
|
||||||
|
|
7
proto.go
7
proto.go
|
@ -1,7 +0,0 @@
|
||||||
package neofs_proto // import "github.com/nspcc-dev/neofs-proto"
|
|
||||||
|
|
||||||
import (
|
|
||||||
_ "github.com/gogo/protobuf/gogoproto"
|
|
||||||
_ "github.com/gogo/protobuf/proto"
|
|
||||||
_ "github.com/golang/protobuf/proto"
|
|
||||||
)
|
|
|
@ -124,7 +124,7 @@ func (m *Token) Verify(keys ...*ecdsa.PublicKey) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sign adds token signatures.
|
// AddSignatures adds token signatures.
|
||||||
func (t *PToken) AddSignatures(signH, signT []byte) {
|
func (t *PToken) AddSignatures(signH, signT []byte) {
|
||||||
t.mtx.Lock()
|
t.mtx.Lock()
|
||||||
|
|
||||||
|
@ -139,8 +139,7 @@ func (t *PToken) SignData(data []byte) ([]byte, error) {
|
||||||
return crypto.Sign(t.PrivateKey, data)
|
return crypto.Sign(t.PrivateKey, data)
|
||||||
}
|
}
|
||||||
|
|
||||||
// VerifyData checks if signature of data by token t
|
// VerifyData checks if signature of data by token is equal to sign.
|
||||||
// is equal to sign.
|
|
||||||
func (m *VerificationHeader) VerifyData(data, sign []byte) error {
|
func (m *VerificationHeader) VerifyData(data, sign []byte) error {
|
||||||
if crypto.Verify(crypto.UnmarshalPublicKey(m.PublicKey), data, sign) != nil {
|
if crypto.Verify(crypto.UnmarshalPublicKey(m.PublicKey), data, sign) != nil {
|
||||||
return ErrInvalidSignature
|
return ErrInvalidSignature
|
||||||
|
|
Loading…
Reference in a new issue