Skip to content

Commit fb3d0ab

Browse files
committed
Replace TravisCI with GH Actions
1 parent 9b3ac7d commit fb3d0ab

File tree

15 files changed

+140
-45
lines changed

15 files changed

+140
-45
lines changed

.github/workflows/ci.yaml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
11+
ci:
12+
name: Run CI
13+
runs-on: ${{ matrix.os }}
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
os: [ ubuntu-latest ]
18+
go: [ '1.14', '1.15' ]
19+
20+
steps:
21+
22+
- name: Set up Go ${{ matrix.go }}
23+
uses: actions/setup-go@v2
24+
with:
25+
go-version: ${{ matrix.go }}
26+
27+
- name: Check out code
28+
uses: actions/checkout@v2
29+
30+
# copy-pasta from https://github.com/caddyserver/caddy/blob/master/.github/workflows/ci.yml
31+
- name: Print Go version and environment
32+
id: vars
33+
run: |
34+
printf "Using go at: $(which go)\n"
35+
printf "Go version: $(go version)\n"
36+
printf "\n\nGo environment:\n\n"
37+
go env
38+
printf "\n\nSystem environment:\n\n"
39+
env
40+
echo "::set-output name=go_cache::$(go env GOCACHE)"
41+
42+
- name: Cache the build cache
43+
uses: actions/cache@v2
44+
with:
45+
path: ${{ steps.vars.outputs.go_cache }}
46+
key: ${{ runner.os }}-${{ matrix.go }}-go-ci-${{ hashFiles('**/go.sum') }}
47+
restore-keys: |
48+
${{ runner.os }}-${{ matrix.go }}-go-ci
49+
50+
- name: Get dependencies
51+
run: |
52+
go get -v -t -d ./...
53+
54+
- name: Build
55+
run: go build -v ./...
56+
57+
- name: Test
58+
run: go test -v ./...
59+
60+
lint:
61+
name: Run golangci linter
62+
timeout-minutes: 5
63+
runs-on: ${{ matrix.os }}
64+
strategy:
65+
fail-fast: false
66+
matrix:
67+
os: [ ubuntu-latest, macos-latest ]
68+
go: [ '1.14', '1.15' ]
69+
70+
steps:
71+
72+
- name: Check out source code
73+
uses: actions/checkout@v2
74+
75+
- name: Run linter
76+
uses: golangci/golangci-lint-action@v2
77+
with:
78+
version: v1.33

.golangci.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
linters:
2+
enable:
3+
- structcheck
4+
- varcheck
5+
- staticcheck
6+
- unconvert
7+
- gofmt
8+
- ineffassign
9+
- vet
10+
- unused
11+
- misspell
12+
- bodyclose
13+
- errcheck
14+
- goimports
15+
- prealloc
16+
17+
run:
18+
deadline: 2m
19+
skip-dirs:
20+
- vendor

.travis.yml

Lines changed: 0 additions & 10 deletions
This file was deleted.

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# go-estimate
22

3+
[![Build Status](https://github.com/milosgajdos/go-estimate/workflows/CI/badge.svg)](https://github.com/milosgajdos/go-estimate/actions?query=workflow%3ACI)
4+
[![go.dev reference](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white&style=flat-square)](https://pkg.go.dev/github.com/milosgajdos/go-estimate)
35
[![GoDoc](https://godoc.org/github.com/milosgajdos/go-estimate?status.svg)](https://godoc.org/github.com/milosgajdos/go-estimate)
46
[![License](https://img.shields.io/:license-apache-blue.svg)](https://opensource.org/licenses/Apache-2.0)
5-
[![Travis CI](https://travis-ci.org/milosgajdos/go-estimate.svg?branch=master)](https://travis-ci.org/milosgajdos/go-estimate)
67
[![Go Report Card](https://goreportcard.com/badge/milosgajdos/go-estimate)](https://goreportcard.com/report/github.com/milosgajdos/go-estimate)
78

89
This package offers a small suite of basic filtering algorithms written in Go. It currently provides the implementations of the following filters and estimators:

estimate/base.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ type Base struct {
1818
func NewBase(val mat.Vector) (*Base, error) {
1919
v := &mat.VecDense{}
2020
if val != nil {
21-
v.CloneVec(val)
21+
v.CloneFromVec(val)
2222
}
2323

2424
c := mat.NewSymDense(v.Len(), nil)
@@ -39,7 +39,7 @@ func NewBaseWithCov(val mat.Vector, cov mat.Symmetric) (*Base, error) {
3939
}
4040

4141
v := &mat.VecDense{}
42-
v.CloneVec(val)
42+
v.CloneFromVec(val)
4343

4444
c := mat.NewSymDense(cov.Symmetric(), nil)
4545
c.CopySym(cov)
@@ -53,7 +53,7 @@ func NewBaseWithCov(val mat.Vector, cov mat.Symmetric) (*Base, error) {
5353
// Val returns estimated value
5454
func (b *Base) Val() mat.Vector {
5555
v := &mat.VecDense{}
56-
v.CloneVec(b.val)
56+
v.CloneFromVec(b.val)
5757

5858
return v
5959
}

go.mod

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
module github.com/milosgajdos/go-estimate
22

3-
go 1.13
3+
go 1.14
44

55
require (
6-
github.com/milosgajdos/matrix v0.0.0-20200225195132-b569a2d38acc
7-
github.com/stretchr/testify v1.3.0
6+
github.com/milosgajdos/matrix v0.0.1
7+
github.com/stretchr/testify v1.6.1
88
golang.org/x/exp v0.0.0-20190125153040-c74c464bbbf2
9-
gonum.org/v1/gonum v0.0.0-20190502212712-4a2eb0188cbc
10-
gonum.org/v1/plot v0.0.0-20190410204940-3a5f52653745
9+
gonum.org/v1/gonum v0.8.2
10+
gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b
1111
)

go.sum

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF0
88
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k=
99
github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5 h1:PJr+ZMXIecYc1Ey2zucXdR73SMBtgjPgwa31099IMv0=
1010
github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes=
11-
github.com/milosgajdos/matrix v0.0.0-20200225195132-b569a2d38acc h1:339kt8qecG/sq7iQMNm0e050JjkLioVybayrBMyUGvQ=
12-
github.com/milosgajdos/matrix v0.0.0-20200225195132-b569a2d38acc/go.mod h1:syV6SoL9H0uoFn4wFjU7PFz2PKf3O8C/kbAxoOl1DSk=
11+
github.com/milosgajdos/matrix v0.0.1 h1:zDV91rki6Y6W1yMiSoCpPIKYLoUf0DyEvCA+SloKo1Q=
12+
github.com/milosgajdos/matrix v0.0.1/go.mod h1:nwsbBAQ4Z39KwGp0YbTK6gnuM9bFyVmwGJKizDeI7BY=
1313
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
1414
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
1515
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
16-
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
17-
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
16+
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
17+
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
1818
golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
1919
golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
2020
golang.org/x/exp v0.0.0-20190125153040-c74c464bbbf2 h1:y102fOLFqhV41b+4GPiJoa0k/x+pJcEi2/HB1Y5T6fU=
@@ -25,9 +25,15 @@ golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGm
2525
golang.org/x/tools v0.0.0-20190206041539-40960b6deb8e h1:Io7mpb+aUAGF0MKxbyQ7HQl1VgB+cL6ZJZUFaFNqVV4=
2626
golang.org/x/tools v0.0.0-20190206041539-40960b6deb8e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
2727
gonum.org/v1/gonum v0.0.0-20180816165407-929014505bf4/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo=
28-
gonum.org/v1/gonum v0.0.0-20190502212712-4a2eb0188cbc h1:+c7TChc7Bi9WFPyWzDxu8mnEhA29YW/0NBDy4V24exU=
29-
gonum.org/v1/gonum v0.0.0-20190502212712-4a2eb0188cbc/go.mod h1:2ltnJ7xHfj0zHS40VVPYEAAMTa3ZGguvHGBSJeRWqE0=
28+
gonum.org/v1/gonum v0.8.2 h1:CCXrcPKiGGotvnN6jfUsKk4rRqm7q09/YbKb5xCEvtM=
29+
gonum.org/v1/gonum v0.8.2/go.mod h1:oe/vMfY3deqTw+1EZJhuvEW2iwGF1bW9wwu7XCu0+v0=
30+
gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0 h1:OE9mWmgKkjJyEmDAAtGMPjXu+YNeGvK9VTSHY6+Qihc=
3031
gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw=
31-
gonum.org/v1/plot v0.0.0-20190410204940-3a5f52653745 h1:Xaq5xR1I2KM/MWp1vwZxOosUPa1U8wtNN8zRbVko0ZY=
32-
gonum.org/v1/plot v0.0.0-20190410204940-3a5f52653745/go.mod h1:Wt8AAjI+ypCyYX3nZBvf6cAIx93T+c/OS2HFAYskSZc=
32+
gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b h1:Qh4dB5D/WpoUUp3lSod7qgoyEHbDGPUWjIbnqdqqe1k=
33+
gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b/go.mod h1:Wt8AAjI+ypCyYX3nZBvf6cAIx93T+c/OS2HFAYskSZc=
34+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
35+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
36+
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
37+
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
38+
rsc.io/pdf v0.1.1 h1:k1MczvYDUvJBe93bYd7wrZLLUEcLZAuF824/I4e5Xr4=
3339
rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=

kalman/ekf/ekf.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ func (k *EKF) Update(x, u, z mat.Vector) (filter.Estimate, error) {
249249
apa.Mul(ap, a.T())
250250

251251
pCorr := &mat.Dense{}
252-
if !pkrk.IsZero() {
252+
if !pkrk.IsEmpty() {
253253
pCorr.Add(apa, pkrk)
254254
}
255255

@@ -325,7 +325,7 @@ func (k *EKF) SetCov(cov mat.Symmetric) error {
325325
// Gain returns Kalman gain
326326
func (k *EKF) Gain() mat.Matrix {
327327
gain := &mat.Dense{}
328-
gain.Clone(k.k)
328+
gain.CloneFrom(k.k)
329329

330330
return gain
331331
}

kalman/ekf/iekf.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ func (k *IEKF) Update(x, u, z mat.Vector) (filter.Estimate, error) {
131131
apa.Mul(ap, a.T())
132132

133133
pCorr := &mat.Dense{}
134-
if !pkrk.IsZero() {
134+
if !pkrk.IsEmpty() {
135135
pCorr.Add(apa, pkrk)
136136
}
137137

kalman/kf/kf.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ func New(m filter.DiscreteModel, init filter.InitCond, q, r filter.Noise) (*KF,
6565
return nil, fmt.Errorf("Invalid propagation matrix dimensions: [%d x %d]", rows, cols)
6666
}
6767

68-
if m.StateCtlMatrix() != nil && !m.StateCtlMatrix().(*mat.Dense).IsZero() {
68+
if m.StateCtlMatrix() != nil && !m.StateCtlMatrix().(*mat.Dense).IsEmpty() {
6969
rows, cols := m.StateCtlMatrix().Dims()
7070
if rows != in {
7171
return nil, fmt.Errorf("Invalid ctl propagation matrix dimensions: [%d x %d]", rows, cols)
@@ -77,7 +77,7 @@ func New(m filter.DiscreteModel, init filter.InitCond, q, r filter.Noise) (*KF,
7777
return nil, fmt.Errorf("Invalid observation matrix dimensions: [%d x %d]", rows, cols)
7878
}
7979

80-
if m.OutputCtlMatrix() != nil && !m.OutputCtlMatrix().(*mat.Dense).IsZero() {
80+
if m.OutputCtlMatrix() != nil && !m.OutputCtlMatrix().(*mat.Dense).IsEmpty() {
8181
rows, cols = m.OutputCtlMatrix().Dims()
8282
if rows != out {
8383
return nil, fmt.Errorf("Invalid ctl observation matrix dimensions: [%d x %d]", rows, cols)
@@ -209,7 +209,7 @@ func (k *KF) Update(x, u, z mat.Vector) (filter.Estimate, error) {
209209
apa.Mul(ap, a.T())
210210

211211
pCorr := &mat.Dense{}
212-
if !pkrk.IsZero() {
212+
if !pkrk.IsEmpty() {
213213
pCorr.Add(apa, pkrk)
214214
}
215215

@@ -284,7 +284,7 @@ func (k *KF) SetCov(cov mat.Symmetric) error {
284284
// Gain returns Kalman gain
285285
func (k *KF) Gain() mat.Matrix {
286286
gain := &mat.Dense{}
287-
gain.Clone(k.k)
287+
gain.CloneFrom(k.k)
288288

289289
return gain
290290
}

0 commit comments

Comments
 (0)