Skip to content

Commit

Permalink
Update CI scripts
Browse files Browse the repository at this point in the history
Signed-off-by: Dusan Borovcanin <[email protected]>
  • Loading branch information
dborovcanin committed Nov 26, 2024
1 parent 83ecbaa commit 22ec243
Show file tree
Hide file tree
Showing 7 changed files with 107 additions and 12 deletions.
20 changes: 13 additions & 7 deletions .github/workflows/go.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) Abstract Machines
# SPDX-License-Identifier: Apache-2.0

name: Go
on: [push]
jobs:
Expand All @@ -6,22 +9,25 @@ jobs:
runs-on: ubuntu-latest
steps:

- name: Set up Go 1.22.5
- name: Set up Go 1.23.x
uses: actions/setup-go@v1
with:
go-version: 1.22.5
go-version: 1.23.x
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v1

- name: Lint
run: |
export GOBIN=$HOME/go/bin
export PATH=$PATH:$(go env GOBIN)
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOBIN) v1.59.1
golangci-lint run --no-config --disable-all --enable gosimple --enable govet --enable unused --timeout 3m
uses: golangci/golangci-lint-action@v6
with:
version: v1.60.3
args: --config .golangci.yml

- name: Test
run: |
go test -v -race -tags test -coverprofile=profile.out -covermode=atomic ./...
- name: Upload coverage
uses: codecov/[email protected]
with:
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,16 @@ updates:
directory: "./.github/workflows"
schedule:
interval: "weekly"
day: "monday"
timezone: "Europe/Paris"
groups:
gh-dependency:
patterns:
- "*"

- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "weekly"
day: "monday"
timezone: "Europe/Paris"
75 changes: 75 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Copyright (c) Abstract Machines
# SPDX-License-Identifier: Apache-2.0

run:
timeout: 3m

issues:
max-issues-per-linter: 100
max-same-issues: 100

gocritic:
enabled-checks:
- importShadow
- httpNoBody
- paramTypeCombine
- emptyStringTest
- builtinShadow
- exposedSyncMutex
disabled-checks:
- appendAssign
enabled-tags:
- diagnostic
disabled-tags:
- performance
- style
- experimental
- opinionated
misspell:
ignore-words:
- "mosquitto"
stylecheck:
checks: ["-ST1000", "-ST1003", "-ST1020", "-ST1021", "-ST1022"]
goheader:
template: |-
Copyright (c) Abstract Machines
SPDX-License-Identifier: Apache-2.0
linters:
disable-all: true
enable:
- gocritic
- gosimple
- errcheck
- govet
- unused
- goconst
- godot
- godox
- ineffassign
- misspell
- stylecheck
- whitespace
- gci
- gofmt
- goimports
- loggercheck
- goheader
- asasalint
- asciicheck
- bidichk
- contextcheck
- decorder
- dogsled
- errchkjson
- errname
- copyloopvar
- ginkgolinter
- gocheckcompilerdirectives
- gofumpt
- goprintffuncname
- importas
- makezero
- mirror
- nakedret
- dupword
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.22.5

require (
github.com/fxamacker/cbor/v2 v2.7.0
github.com/stretchr/testify v1.8.4
github.com/stretchr/testify v1.10.0
)

require (
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ github.com/fxamacker/cbor/v2 v2.7.0 h1:iM5WgngdRBanHcxugY4JySA0nk1wZorNOpTgCMedv
github.com/fxamacker/cbor/v2 v2.7.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM=
github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
Expand Down
5 changes: 4 additions & 1 deletion senml.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Abstract Machines
// SPDX-License-Identifier: Apache-2.0

package senml

import (
Expand Down Expand Up @@ -47,7 +50,7 @@ var (
// Record represents one senML record.
type Record struct {
XMLName *bool `json:"-" xml:"senml" cbor:"-"`
Link string `json:"l,omitempty" xml:"l,attr,omitempty" cbor:"-"`
Link string `json:"l,omitempty" xml:"l,attr,omitempty" cbor:"-"`
BaseName string `json:"bn,omitempty" xml:"bn,attr,omitempty" cbor:"-2,keyasint,omitempty"`
BaseTime float64 `json:"bt,omitempty" xml:"bt,attr,omitempty" cbor:"-3,keyasint,omitempty"`
BaseUnit string `json:"bu,omitempty" xml:"bu,attr,omitempty" cbor:"-4,keyasint,omitempty"`
Expand Down
5 changes: 4 additions & 1 deletion senml_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Abstract Machines
// SPDX-License-Identifier: Apache-2.0

package senml_test

import (
Expand Down Expand Up @@ -269,7 +272,7 @@ func TestNormalize(t *testing.T) {
r0.BaseName = ""
r0.Time = r0.BaseTime + r0.Time
r0.BaseTime = 0
*r0.Value = *r0.Value + r0.BaseValue
*r0.Value += r0.BaseValue
r0.BaseValue = 0
r0.Unit = r0.BaseUnit
r0.BaseUnit = ""
Expand Down

0 comments on commit 22ec243

Please sign in to comment.