Skip to content

Commit

Permalink
Move over more utils from core
Browse files Browse the repository at this point in the history
  • Loading branch information
edaniels committed Jun 23, 2021
1 parent e0f95c5 commit fafed7a
Show file tree
Hide file tree
Showing 256 changed files with 106,134 additions and 44 deletions.
24 changes: 24 additions & 0 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
codecov:
require_ci_to_pass: yes

coverage:
precision: 2
round: down
range: "70...100"

parsers:
gcov:
branch_detection:
conditional: yes
loop: yes
method: no
macro: no

comment:
layout: "reach,diff,flags,files,footer"
behavior: default
require_changes: no

ignore:
- "rpc/examples/"
- "proto" # code generated
57 changes: 57 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# See https://github.com/mvdan/github-actions-golang for golang nuances
name: Go

on:
workflow_dispatch:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build_and_test:
name: Build and Test
runs-on: [self-hosted, x64]
container:
image: echolabs/robotcoretest:latest

steps:

- name: Check out code into the Go module directory
uses: actions/checkout@v2
with:
fetch-depth: 2

- name: Verify no uncommitted changes from build
run: |
go install google.golang.org/protobuf/cmd/protoc-gen-go \
google.golang.org/grpc/cmd/protoc-gen-go-grpc \
github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway \
github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc
git init
git add .
make build goformat
GEN_DIFF=$(git diff)
if [ -n "$GEN_DIFF" ]; then
echo '"make build goformat" resulted in changes not in git' 1>&2
git status
exit 1
fi
- name: Lint
run: |
make lint
- name: Test
env:
ARTIFACT_GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.ARTIFACT_GOOGLE_APPLICATION_CREDENTIALS }}
TEST_MONGODB_URI: ${{ secrets.TEST_MONGODB_URI }}
run: |
echo "$ARTIFACT_GOOGLE_APPLICATION_CREDENTIALS" | base64 -d > artifact_google_creds.json
export ARTIFACT_GOOGLE_APPLICATION_CREDENTIALS=`pwd`/artifact_google_creds.json
make cover
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
42 changes: 40 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,53 @@
*.dll
*.so
*.dylib
*.dSYM
*.o
*.d
*.mtb
*.a
*.dpp

# Test binary, built with `go test -c`
*.test
coverage.txt

# Perf output
*.pprog

# output for pprof
*.prof
*.pprof

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Dependency directories (remove the comment below to include it)
# vendor/
vendor/

# gRPC
dist/js/google/*
!dist/js/google/api
dist/js/gapic/
dist/js/grafeas/
dist/js/storage/

# Test data
coverage.txt

*~
*#
*.#*
*.DS_Store
*.swp

# act
.secrets

/data/
out/
.idea/*
bin/

# artifact
.artifact/cache
.artifact/data
28 changes: 22 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,39 @@
goformat:
go install golang.org/x/tools/cmd/goimports
gofmt -s -w .
goimports -w -local=go.viam.com/core `go list -f '{{.Dir}}' ./... | grep -Ev "proto"`
goimports -w -local=go.viam.com/utils `go list -f '{{.Dir}}' ./... | grep -Ev "proto"`

format: goformat

build: build-go
build: buf build-web build-go

build-go:
go build ./...

build-web:
cd rpc/examples/echo/frontend && npm install && npx webpack

buf:
buf lint
buf generate
buf generate --template ./etc/buf.web.gen.yaml buf.build/beta/googleapis

lint: goformat
go install google.golang.org/protobuf/cmd/protoc-gen-go \
google.golang.org/grpc/cmd/protoc-gen-go-grpc \
github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway \
github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc
buf lint
go install github.com/edaniels/golinters/cmd/combined
go list -f '{{.Dir}}' ./... | grep -v gen | xargs go vet -vettool=`go env GOPATH`/bin/combined
go list -f '{{.Dir}}' ./... | grep -v gen | xargs go run github.com/golangci/golangci-lint/cmd/golangci-lint run -v
go install github.com/golangci/golangci-lint/cmd/golangci-lint
go install github.com/polyfloyd/go-errorlint
go list -f '{{.Dir}}' ./... | grep -v gen | grep -v proto | xargs go vet -vettool=`go env GOPATH`/bin/combined
go list -f '{{.Dir}}' ./... | grep -v gen | grep -v proto | xargs `go env GOPATH`/bin/go-errorlint -errorf
go list -f '{{.Dir}}' ./... | grep -v gen | grep -v proto | xargs go run github.com/golangci/golangci-lint/cmd/golangci-lint run -v --config=./etc/.golangci.yaml

cover:
go test -coverprofile=coverage.txt ./...
go test -tags=no_skip -race -coverprofile=coverage.txt ./...

test:
go test ./...
go test -tags=no_skip -race ./...

Loading

0 comments on commit fafed7a

Please sign in to comment.