1
0
mirror of https://github.com/hybridgroup/gobot.git synced 2025-04-24 13:48:49 +08:00

Build(v2): revert move to v2 subfolder (#932)

* revert move to v2 subfolder
* fix CI and adjust CHANGELOG
This commit is contained in:
Thomas Kohler 2023-05-29 19:23:28 +02:00 committed by GitHub
parent 2db4a701eb
commit 865e724af0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
859 changed files with 82 additions and 97 deletions

View File

@ -23,7 +23,6 @@ jobs:
- run:
name: Core and drivers tests
command: |
cd ./v2
go test -v -coverprofile=coverage.txt -covermode=atomic . ./drivers/...
- run:
name: Code coverage
@ -42,7 +41,6 @@ jobs:
# digispark needs libusb, joystick needs sdl2, opencv needs opencv
name: Platform tests (except digispark, joystick, opencv)
command: |
cd ./v2
go test -v $(go list ./platforms/... | grep -v platforms/digispark | grep -v platforms/joystick | grep -v platforms/opencv)
"check_examples":
@ -57,7 +55,6 @@ jobs:
# digispark needs libusb, joystick needs sdl2, opencv needs opencv
name: Check examples (except digispark, joystick, opencv)
command: |
cd ./v2
ALL=$(grep -l -r --include "*.go" 'build example' ./)
SOME=$(grep -L 'digispark' $(grep -L 'joystick' $(grep -L 'gocv' ${ALL})))
for e in ${SOME} ; do go vet "${e}" ; done

View File

@ -27,7 +27,7 @@ jobs:
version: v1.52.2
# Optional: working directory, useful for monorepos
working-directory: v2
# working-directory: v2
# Optional: golangci-lint command line arguments.
# mostly there is no problem locally, but on server: "could not import C (cgo preprocessing failed) (typecheck)"

View File

@ -1,12 +1,22 @@
# CHANGELOG
## [Unreleased](https://github.com/hybridgroup/gobot/compare/v2.0.2...HEAD)
## [Unreleased](https://github.com/hybridgroup/gobot/compare/v2.1.0...HEAD)
## [v2.1.0](https://github.com/hybridgroup/gobot/compare/v2.0.3...v2.1.0) (2023-05-29)
### Build
* **v2:** revert of [#927](https://github.com/hybridgroup/gobot/pull/927), no usage of a v2 subfolder anymore (issue [#920](https://github.com/hybridgroup/gobot/issues/920))
## [v2.0.3](https://github.com/hybridgroup/gobot/compare/v2.0.2...v2.0.3) (2023-05-24)
* accidentally created release without any changes
## [v2.0.2](https://github.com/hybridgroup/gobot/compare/v2.0.1...v2.0.2) (2023-05-22)
### Build
* **v2:** fix usage by moving code to a v2 subfolder ([#927](https://github.com/hybridgroup/gobot/issues/927))
* **v2:** fix usage by moving code to a v2 subfolder ([#927](https://github.com/hybridgroup/gobot/pull/927))
## [v2.0.1](https://github.com/hybridgroup/gobot/compare/v2.0.0...v2.0.1) (2023-05-21)

View File

@ -1,16 +1,76 @@
# this file is just a forwarder to the folder with go.mod for common use cases
# it is working since Go 1.18 is installed locally
# include also examples in other than ./examples folder
ALL_EXAMPLES := $(shell grep -l -r --include "*.go" 'build example' ./)
# prevent examples with gocv (opencv) dependencies
EXAMPLES_NO_GOCV := $(shell grep -L 'gocv' $(ALL_EXAMPLES))
# prevent examples with joystick (sdl2) dependencies
EXAMPLES_NO_JOYSTICK := $(shell grep -L 'joystick' $(ALL_EXAMPLES))
# prevent examples with joystick (sdl2) and gocv (opencv) dependencies
EXAMPLES_NO_GOCV_JOYSTICK := $(shell grep -L 'joystick' $$(grep -L 'gocv' $(EXAMPLES_NO_GOCV)))
# used examples
EXAMPLES := $(EXAMPLES_NO_GOCV_JOYSTICK)
gomoddir := $(shell go list -f '{{.Dir}}' -m)
.PHONY: test test_race test_cover robeaux version_check fmt_check fmt_fix examples examples_check $(EXAMPLES)
# opencv platform currently skipped to prevent install of preconditions
including_except := $(shell go list ./... | grep -v platforms/opencv)
.PHONY: test fmt_check examples_check
# Run tests on nearly all directories without test cache
test:
cd $(gomoddir) && make test && cd ..
go test -count=1 -v $(including_except)
# Run tests with race detection
test_race:
go test -race $(including_except)
# Test, generate and show coverage in browser
test_cover:
go test -v $(including_except) -coverprofile=coverage.txt ; \
go tool cover -html=coverage.txt ; \
robeaux:
ifeq (,$(shell which go-bindata))
$(error robeaux not built! https://github.com/jteeuwen/go-bindata is required to build robeaux assets )
endif
cd api ; \
npm install robeaux ; \
cp -r node_modules/robeaux robeaux-tmp ; \
cd robeaux-tmp ; \
rm Makefile package.json README.markdown ; \
touch css/fonts.css ; \
echo "Updating robeaux..." ; \
go-bindata -pkg="robeaux" -o robeaux.go -ignore=\\.git ./... ; \
mv robeaux.go ../robeaux ; \
cd .. ; \
rm -rf robeaux-tmp/ ; \
rm -rf node_modules/ ; \
go fmt ./robeaux/robeaux.go ; \
# Check for installed and module version match. Will exit with code 50 if not match.
# There is nothing bad in general, if you program with a higher version.
# At least the recipe "fmt_fix" will not work in that case.
version_check:
@gv=$$(echo $$(go version) | sed "s/^.* go\([0-9].[0-9]*\).*/\1/") ; \
mv=$$(grep -m 1 'go 1.' ./go.mod | sed "s/^go \([0-9].[0-9]*\).*/\1/") ; \
echo "go: $${gv}.*, go.mod: $${mv}" ; \
if [ "$${gv}" != "$${mv}" ]; then exit 50; fi ; \
# Check for bad code style and other issues
fmt_check:
cd $(gomoddir) && make fmt_check && cd ..
gofmt -l ./
golangci-lint run -v
# Fix bad code style (will only be executed, on version match)
fmt_fix: version_check
go fmt ./...
examples: $(EXAMPLES)
examples_check:
cd $(gomoddir) && make examples_check && cd ..
$(MAKE) CHECK=ON examples
$(EXAMPLES):
ifeq ($(CHECK),ON)
go vet ./$@
else
go build -o /tmp/gobot_examples/$@ ./$@
endif

View File

@ -13,7 +13,6 @@ before_test:
- go env
build_script:
- cd ./v2
- go test -v -cpu=2 .
- go test -v -cpu=2 ./drivers/aio/...
- go test -v -cpu=2 ./drivers/i2c/...

View File

Some files were not shown because too many files have changed in this diff Show More