2022-09-26 00:49:25 +08:00
|
|
|
|
# Since switch to cimg, the GOPATH has been changed from /go to $HOME/go.
|
|
|
|
|
# The latter will expand to the full path of /home/circleci/go.
|
|
|
|
|
# On first run, this change may affect caching and some other commands if
|
|
|
|
|
# you don’t correct the page in your config.
|
|
|
|
|
#
|
|
|
|
|
# Specify service dependencies here if necessary
|
|
|
|
|
# CircleCI maintains a library of pre-built images
|
|
|
|
|
# documented at https://circleci.com/docs/circleci-images
|
|
|
|
|
# - image: cimg/postgres:14.5.0
|
|
|
|
|
#
|
|
|
|
|
# For more information, please read https://github.com/CircleCI-Public/cimg-go/blob/main/README.md
|
|
|
|
|
|
|
|
|
|
version: 2
|
2020-11-28 02:26:50 +08:00
|
|
|
|
jobs:
|
2022-09-26 00:49:25 +08:00
|
|
|
|
"test_core_and_drivers_with_coverage":
|
2020-11-28 02:26:50 +08:00
|
|
|
|
docker:
|
2024-11-01 19:54:20 +08:00
|
|
|
|
- image: cimg/go:1.22
|
2020-11-28 02:26:50 +08:00
|
|
|
|
steps:
|
|
|
|
|
- checkout
|
2022-09-25 16:37:44 +08:00
|
|
|
|
- run:
|
|
|
|
|
name: Debug version
|
|
|
|
|
command: go version
|
2020-12-01 06:10:09 +08:00
|
|
|
|
- run:
|
|
|
|
|
name: Core and drivers tests
|
2023-05-23 01:35:36 +08:00
|
|
|
|
command: |
|
2023-11-12 03:18:44 +08:00
|
|
|
|
go test -race -v -coverprofile=coverage.txt -covermode=atomic . ./drivers/...
|
2020-12-01 06:10:09 +08:00
|
|
|
|
- run:
|
|
|
|
|
name: Code coverage
|
2022-11-14 02:25:17 +08:00
|
|
|
|
command: |
|
2020-12-01 06:10:09 +08:00
|
|
|
|
bash <(curl -s https://codecov.io/bash)
|
2022-09-26 00:49:25 +08:00
|
|
|
|
|
|
|
|
|
"test_platforms":
|
|
|
|
|
docker:
|
2024-11-01 19:54:20 +08:00
|
|
|
|
- image: cimg/go:1.22
|
2022-09-26 00:49:25 +08:00
|
|
|
|
steps:
|
|
|
|
|
- checkout
|
|
|
|
|
- run:
|
|
|
|
|
name: Debug version
|
|
|
|
|
command: go version
|
|
|
|
|
- run:
|
2023-09-23 18:32:31 +08:00
|
|
|
|
# digispark needs libusb, opencv needs opencv
|
|
|
|
|
name: Platform tests (except digispark and opencv)
|
2023-05-23 01:35:36 +08:00
|
|
|
|
command: |
|
2023-11-12 03:18:44 +08:00
|
|
|
|
go test -race -v $(go list ./platforms/... | grep -v platforms/digispark | grep -v platforms/opencv)
|
2022-11-14 02:25:17 +08:00
|
|
|
|
|
|
|
|
|
"check_examples":
|
|
|
|
|
docker:
|
2024-11-01 19:54:20 +08:00
|
|
|
|
- image: cimg/go:1.22
|
2022-11-14 02:25:17 +08:00
|
|
|
|
steps:
|
|
|
|
|
- checkout
|
|
|
|
|
- run:
|
|
|
|
|
name: Debug version
|
|
|
|
|
command: go version
|
|
|
|
|
- run:
|
2023-09-23 18:32:31 +08:00
|
|
|
|
# digispark needs libusb, opencv needs opencv
|
|
|
|
|
name: Check examples (except digispark, opencv)
|
2022-11-14 02:25:17 +08:00
|
|
|
|
command: |
|
|
|
|
|
ALL=$(grep -l -r --include "*.go" 'build example' ./)
|
2023-09-23 18:32:31 +08:00
|
|
|
|
SOME=$(grep -L 'digispark' $(grep -L 'gocv' ${ALL}))
|
2022-11-14 02:25:17 +08:00
|
|
|
|
for e in ${SOME} ; do go vet "${e}" ; done
|
2022-09-26 00:49:25 +08:00
|
|
|
|
|
2024-02-11 22:34:50 +08:00
|
|
|
|
"fmt_check_examples":
|
|
|
|
|
docker:
|
2024-11-01 19:54:20 +08:00
|
|
|
|
- image: golangci/golangci-lint:v1.61.0
|
2024-02-11 22:34:50 +08:00
|
|
|
|
steps:
|
|
|
|
|
- checkout
|
|
|
|
|
- run:
|
|
|
|
|
name: Debug linter version
|
|
|
|
|
command: golangci-lint --version
|
|
|
|
|
- run:
|
|
|
|
|
# digispark needs libusb, opencv needs opencv
|
|
|
|
|
name: Check examples for linter issues (except digispark, opencv)
|
|
|
|
|
command: |
|
|
|
|
|
ALL=$(grep -l -r --include "*.go" 'build example' ./)
|
|
|
|
|
SOME=$(grep -L 'digispark' $(grep -L 'gocv' ${ALL}))
|
|
|
|
|
for e in ${SOME} ; do golangci-lint run "${e}" --build-tags example --disable forcetypeassert --disable noctx ; done
|
|
|
|
|
|
2022-09-26 00:49:25 +08:00
|
|
|
|
workflows:
|
|
|
|
|
version: 2
|
|
|
|
|
build:
|
|
|
|
|
jobs:
|
|
|
|
|
- "test_core_and_drivers_with_coverage"
|
|
|
|
|
- "test_platforms"
|
2022-11-14 02:25:17 +08:00
|
|
|
|
- "check_examples"
|
2024-02-11 22:34:50 +08:00
|
|
|
|
- "fmt_check_examples"
|