-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RSDK-9305 Add CI #10
Merged
Merged
RSDK-9305 Add CI #10
Changes from 12 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
ad0ec60
fix panic
oliviamiller 1509dcc
Revert "fix panic"
oliviamiller cd6279f
Merge branch 'main' of https://github.com/oliviamiller/lorawan-gateway
oliviamiller 002960e
Merge branch 'main' of https://github.com/oliviamiller/lorawan-gateway
oliviamiller 9cdaf42
cibuild
oliviamiller 55cccc6
add dependency
oliviamiller 8f9abba
build before test
oliviamiller 7bfd231
build c module
oliviamiller 3b31c83
rm second test
oliviamiller 93a297c
fix
oliviamiller 6ec12c5
try again
oliviamiller bab925c
does this work too
oliviamiller bcbcb9f
pr comments
oliviamiller File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
on: | ||
push: | ||
tags: | ||
- '[0-9]+.[0-9]+.[0-9]+' | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: viamrobotics/build-action@v1 | ||
with: | ||
version: ${{ github.ref_name }} | ||
ref: ${{ github.sha }} | ||
key-id: ${{ secrets.viam_key_id }} | ||
key-value: ${{ secrets.viam_key_value }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: run linter and unit tests on each commit | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- '**/**.go' | ||
pull_request: | ||
paths: | ||
- '**/**.go' | ||
- 'Makefile' | ||
- '.github/workflows/lint-test.yml' | ||
|
||
jobs: | ||
quality-checks: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.21 | ||
|
||
- name: Install dependencies | ||
run: | | ||
sudo apt-get update | ||
|
||
- name: Run unit tests | ||
run: make test | ||
|
||
- name: Run linter | ||
run: make lint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
mymod | ||
bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,39 @@ | ||
|
||
BUILD_DIR = ./sx1302 | ||
CGO_BUILD_LDFLAGS := -L$(shell pwd)/$(BUILD_DIR)/libloragw -L$(shell pwd)/$(BUILD_DIR)libloragw/lib -L$(shell pwd)/$(BUILD_DIR)/libtools | ||
BIN_OUTPUT_PATH = bin | ||
TOOL_BIN = bin/gotools/$(shell uname -s)-$(shell uname -m) | ||
UNAME_S ?= $(shell uname -s) | ||
|
||
.PHONY: all | ||
all: | ||
CGO_LDFLAGS="$$CGO_LDFLAGS $(CGO_BUILD_LDFLAGS)" go build $(GO_BUILD_LDFLAGS) -o mymod main.go | ||
.PHONY: build | ||
build: | ||
rm -f $(BIN_OUTPUT_PATH)/lorawan | ||
CGO_LDFLAGS="$$CGO_LDFLAGS $(CGO_BUILD_LDFLAGS)" go build $(GO_BUILD_LDFLAGS) -o $(BIN_OUTPUT_PATH)/lorawan main.go | ||
|
||
module.tar.gz: build | ||
rm -f $(BIN_OUTPUT_PATH)/module.tar.gz | ||
tar czf $(BIN_OUTPUT_PATH)/module.tar.gz $(BIN_OUTPUT_PATH)/lorawan | ||
|
||
test: sx1302 build | ||
sudo apt install libnlopt-dev | ||
CGO_LDFLAGS="$$CGO_LDFLAGS $(CGO_BUILD_LDFLAGS)" go test -race -v ./... | ||
|
||
|
||
sx1302: submodule | ||
cd sx1302/libtools && make | ||
cd sx1302/libloragw && make | ||
|
||
submodule: | ||
git submodule init | ||
git submodule update | ||
|
||
tool-install: | ||
GOBIN=`pwd`/$(TOOL_BIN) go install github.com/golangci/golangci-lint/cmd/golangci-lint | ||
|
||
gofmt: | ||
gofmt -w -s . | ||
|
||
lint: gofmt tool-install | ||
go mod tidy | ||
$(TOOL_BIN)/golangci-lint run -v --fix --config=./etc/.golangci.yaml | ||
|
||
test: | ||
CGO_LDFLAGS="$$CGO_LDFLAGS $(CGO_BUILD_LDFLAGS)" go test -v gateway/gateway |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
service: | ||
golangci-lint-version: 1.51.x | ||
run: | ||
deadline: 900s | ||
modules-download-mode: readonly | ||
linters: | ||
enable-all: true | ||
disable: | ||
- asasalint | ||
- mnd | ||
- containedctx | ||
- contextcheck | ||
- cyclop | ||
- deadcode | ||
- depguard | ||
- exhaustivestruct | ||
- exhaustruct | ||
- forcetypeassert | ||
- funlen | ||
- gocognit | ||
- godox | ||
- goerr113 | ||
- gochecknoglobals | ||
- gochecknoinits | ||
- gocyclo | ||
- gofmt | ||
- goimports | ||
- golint | ||
- gomnd | ||
- importas | ||
- interfacebloat | ||
- ireturn | ||
- maintidx | ||
- makezero | ||
- musttag | ||
- nakedret | ||
- nestif | ||
- nlreturn | ||
- nonamedreturns | ||
- nosprintfhostport | ||
- paralleltest | ||
- prealloc | ||
- tagliatelle | ||
- testpackage | ||
- thelper # false positives | ||
- varnamelen | ||
- wrapcheck | ||
- wsl | ||
linters-settings: | ||
errcheck: | ||
check-blank: true | ||
gci: | ||
sections: | ||
- standard | ||
- default | ||
gofumpt: | ||
lang-version: "1.21" | ||
extra-rules: true | ||
govet: | ||
enable-all: true | ||
disable: | ||
- fieldalignment | ||
- shadow | ||
- composites | ||
revive: | ||
# Unfortunately configuring a single rules disables all other rules, even | ||
# if we set `enable-all: true` | ||
# | ||
# To get around this, we include default rules: | ||
# https://github.com/mgechev/revive/blob/master/defaults.toml | ||
rules: | ||
- name: blank-imports | ||
- name: context-keys-type | ||
- name: dot-imports | ||
- name: empty-block | ||
- name: error-naming | ||
- name: error-return | ||
- name: error-strings | ||
- name: errorf | ||
- name: exported | ||
- name: increment-decrement | ||
- name: indent-error-flow | ||
- name: package-comments | ||
- name: range | ||
- name: receiver-naming | ||
- name: redefines-builtin-id | ||
- name: superfluous-else | ||
- name: time-naming | ||
- name: unexported-return | ||
- name: unreachable-code | ||
- name: var-declaration | ||
- name: var-naming | ||
lll: | ||
line-length: 140 | ||
issues: | ||
exclude-rules: | ||
- path: _test\.go$ | ||
linters: | ||
- dupword | ||
- errcheck | ||
- exhaustive | ||
- goconst | ||
- gosec | ||
exclude-use-default: false | ||
max-per-linter: 0 | ||
max-same-issues: 0 |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be go 1.23.