test: Revert caching changes, drop linting on windows/macos (#14465)
This commit is contained in:
parent
2e067df7a2
commit
d417b69136
|
|
@ -35,154 +35,15 @@ commands:
|
||||||
gotestsum:
|
gotestsum:
|
||||||
type: string
|
type: string
|
||||||
default: "gotestsum"
|
default: "gotestsum"
|
||||||
cache_version:
|
|
||||||
type: string
|
|
||||||
default: "v1"
|
|
||||||
goversion:
|
|
||||||
type: string
|
|
||||||
default: 1.21.5
|
|
||||||
steps:
|
steps:
|
||||||
- check-changed-files-or-halt
|
|
||||||
- when:
|
|
||||||
condition:
|
|
||||||
equal: [ windows, << parameters.os >> ]
|
|
||||||
steps:
|
|
||||||
- run:
|
|
||||||
name: Remove Go and MinGW to avoid clashes after upgrade during cache restore
|
|
||||||
command: |
|
|
||||||
rm -rf '/c/Program Files/Go'
|
|
||||||
rm -rf '/c/ProgramData/chocolatey/lib/mingw'
|
|
||||||
- when:
|
|
||||||
condition:
|
|
||||||
equal: [ darwin, << parameters.os >> ]
|
|
||||||
steps:
|
|
||||||
- run:
|
|
||||||
name: Ensure go directory is empty and have proper permissions before cache restore
|
|
||||||
command: |
|
|
||||||
sudo rm -rf '/usr/local/Cellar/go'
|
|
||||||
sudo mkdir -p '/usr/local/Cellar/go'
|
|
||||||
sudo chown -R $(id -u):$(id -g) '/usr/local/Cellar/go'
|
|
||||||
- restore_cache:
|
|
||||||
name: "Restore binaries from cache"
|
|
||||||
key: go-bins-<< parameters.cache_version >>-<< parameters.os >>-<< parameters.arch >>-go<< parameters.goversion >>-{{ checksum "go.sum" }}
|
|
||||||
- when:
|
|
||||||
condition:
|
|
||||||
equal: [ linux, << parameters.os >> ]
|
|
||||||
steps:
|
|
||||||
- attach_workspace:
|
|
||||||
at: '/go'
|
|
||||||
- when:
|
|
||||||
condition:
|
|
||||||
equal: [ darwin, << parameters.os >> ]
|
|
||||||
steps:
|
|
||||||
- run: 'sh ./scripts/installgo_mac.sh'
|
|
||||||
- when:
|
|
||||||
condition:
|
|
||||||
equal: [ windows, << parameters.os >> ]
|
|
||||||
steps:
|
|
||||||
- run: choco feature enable -n allowGlobalConfirmation
|
|
||||||
- run: git config --system core.longpaths true
|
|
||||||
- run: 'sh ./scripts/installgo_windows.sh'
|
|
||||||
- run: 'sh ./scripts/installmingw_windows.sh'
|
|
||||||
- run: choco install make
|
|
||||||
- run: go env
|
|
||||||
- run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.55.0
|
|
||||||
- when:
|
|
||||||
condition:
|
|
||||||
equal: [ linux, << parameters.os >> ]
|
|
||||||
steps:
|
|
||||||
- run:
|
|
||||||
name: golangci-lint cache status
|
|
||||||
command: GOGC=20 /go/bin/golangci-lint cache status
|
|
||||||
- run:
|
|
||||||
name: golangci-lint run
|
|
||||||
command: GOGC=20 /go/bin/golangci-lint run --verbose
|
|
||||||
- when:
|
|
||||||
condition:
|
|
||||||
equal: [ darwin, << parameters.os >> ]
|
|
||||||
steps:
|
|
||||||
- run:
|
|
||||||
name: golangci-lint cache status
|
|
||||||
command: $HOME/go/bin/golangci-lint cache status
|
|
||||||
- run:
|
|
||||||
name: golangci-lint run
|
|
||||||
command: $HOME/go/bin/golangci-lint run --verbose
|
|
||||||
- when:
|
|
||||||
condition:
|
|
||||||
equal: [ windows, << parameters.os >> ]
|
|
||||||
steps:
|
|
||||||
- run:
|
|
||||||
name: golangci-lint cache status
|
|
||||||
command: $HOME/go/bin/golangci-lint.exe cache status
|
|
||||||
- run:
|
|
||||||
name: golangci-lint run
|
|
||||||
command: $HOME/go/bin/golangci-lint.exe run --verbose
|
|
||||||
- run: ./scripts/install_gotestsum.sh << parameters.os >> << parameters.gotestsum >>
|
- run: ./scripts/install_gotestsum.sh << parameters.os >> << parameters.gotestsum >>
|
||||||
- unless:
|
- unless:
|
||||||
condition:
|
condition:
|
||||||
equal: [ "386", << parameters.arch >> ]
|
equal: [ "386", << parameters.arch >> ]
|
||||||
steps:
|
steps:
|
||||||
- run: echo 'export RACE="-race"' >> $BASH_ENV
|
- run: echo 'export RACE="-race"' >> $BASH_ENV
|
||||||
- when:
|
- run: |
|
||||||
condition:
|
GOARCH=<< parameters.arch >> ./<< parameters.gotestsum >> -- ${RACE} -short ./...
|
||||||
equal: [ windows, << parameters.os >> ]
|
|
||||||
steps:
|
|
||||||
- run: |
|
|
||||||
export PATH="/c/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/bin:$PATH"
|
|
||||||
GOARCH=<< parameters.arch >> ./<< parameters.gotestsum >> -- ${RACE} -short -cover -coverprofile=coverage.out ./...
|
|
||||||
- unless:
|
|
||||||
condition:
|
|
||||||
equal: [ windows, << parameters.os >> ]
|
|
||||||
steps:
|
|
||||||
- run: GOARCH=<< parameters.arch >> ./<< parameters.gotestsum >> -- ${RACE} -short -cover -coverprofile=coverage.out ./...
|
|
||||||
- when:
|
|
||||||
condition:
|
|
||||||
and:
|
|
||||||
- equal: [ "master", << pipeline.git.branch >> ]
|
|
||||||
- equal: [ "linux", << parameters.os >> ]
|
|
||||||
- equal: [ "amd64", << parameters.arch >> ]
|
|
||||||
steps:
|
|
||||||
- run:
|
|
||||||
name: "Installing goveralls"
|
|
||||||
command: go install github.com/mattn/goveralls@latest
|
|
||||||
- run:
|
|
||||||
name: "Remove plugins/parsers/influx/machine.go from coverage"
|
|
||||||
command: sed -i '/github.com\/influxdata\/telegraf\/plugins\/parsers\/influx\/machine.go/d' coverage.out
|
|
||||||
- run:
|
|
||||||
name: "Create report"
|
|
||||||
command: /go/bin/goveralls -coverprofile=coverage.out -service=circle-ci -repotoken=${COVERALLS_TOKEN}
|
|
||||||
- when:
|
|
||||||
condition:
|
|
||||||
equal: [ linux, << parameters.os >> ]
|
|
||||||
steps:
|
|
||||||
- save_cache:
|
|
||||||
name: 'Saving binaries to cache'
|
|
||||||
key: go-bins-<< parameters.cache_version >>-<< parameters.os >>-<< parameters.arch >>-go<< parameters.goversion >>-{{ checksum "go.sum" }}
|
|
||||||
paths:
|
|
||||||
- '/go/src/github.com/influxdata/telegraf/gotestsum'
|
|
||||||
- when:
|
|
||||||
condition:
|
|
||||||
equal: [ darwin, << parameters.os >> ]
|
|
||||||
steps:
|
|
||||||
- save_cache:
|
|
||||||
name: 'Saving binaries to cache'
|
|
||||||
key: go-bins-<< parameters.cache_version >>-<< parameters.os >>-<< parameters.arch >>-go<< parameters.goversion >>-{{ checksum "go.sum" }}
|
|
||||||
paths:
|
|
||||||
- '~/go/src/github.com/influxdata/telegraf/gotestsum'
|
|
||||||
- '/usr/local/Cellar/go'
|
|
||||||
- '/usr/local/bin/go'
|
|
||||||
- '/usr/local/bin/gofmt'
|
|
||||||
- when:
|
|
||||||
condition:
|
|
||||||
equal: [ windows, << parameters.os >> ]
|
|
||||||
steps:
|
|
||||||
- save_cache:
|
|
||||||
name: 'Saving binaries to cache'
|
|
||||||
key: go-bins-<< parameters.cache_version >>-<< parameters.os >>-<< parameters.arch >>-go<< parameters.goversion >>-{{ checksum "go.sum" }}
|
|
||||||
paths:
|
|
||||||
- '~\project\gotestsum.exe'
|
|
||||||
- 'C:\Program Files\Go'
|
|
||||||
- 'C:\ProgramData\chocolatey\lib\mingw'
|
|
||||||
package-build:
|
package-build:
|
||||||
parameters:
|
parameters:
|
||||||
type:
|
type:
|
||||||
|
|
@ -222,67 +83,63 @@ commands:
|
||||||
root: './build'
|
root: './build'
|
||||||
paths:
|
paths:
|
||||||
- 'dist'
|
- 'dist'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test-go-linux:
|
lint-linux:
|
||||||
executor: telegraf-ci
|
executor: telegraf-ci
|
||||||
parameters:
|
|
||||||
goversion:
|
|
||||||
type: string
|
|
||||||
default: 1.21.5
|
|
||||||
cache_version:
|
|
||||||
type: string
|
|
||||||
default: "v1"
|
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
- restore_cache:
|
|
||||||
name: "Restore Go caches"
|
|
||||||
key: go-caches-<< parameters.cache_version >>-linux-amd64-go<< parameters.goversion >>-{{ checksum "go.sum" }}
|
|
||||||
- check-changed-files-or-halt
|
- check-changed-files-or-halt
|
||||||
- run: ./scripts/make_docs.sh
|
- run: ./scripts/make_docs.sh
|
||||||
- run: 'make deps'
|
- run: 'make deps'
|
||||||
- run: 'make tidy'
|
- run: 'make tidy'
|
||||||
- run: 'make check'
|
- run: 'make check'
|
||||||
- run: 'make check-deps'
|
- run: 'make check-deps'
|
||||||
- test-go
|
- run:
|
||||||
- save_cache:
|
name: "Install golangci-lint"
|
||||||
name: "Save Go caches"
|
command: go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.55.0
|
||||||
key: go-caches-<< parameters.cache_version >>-linux-amd64-go<< parameters.goversion >>-{{ checksum "go.sum" }}
|
- run:
|
||||||
paths:
|
name: "Linux"
|
||||||
- '/go/pkg/mod'
|
command: GOGC=20 /go/bin/golangci-lint run --verbose
|
||||||
- '~/.cache/golangci-lint'
|
lint-macos:
|
||||||
- '~/.cache/go-build'
|
executor: telegraf-ci
|
||||||
- persist_to_workspace:
|
steps:
|
||||||
root: '/go'
|
- checkout
|
||||||
paths:
|
- check-changed-files-or-halt
|
||||||
- '*'
|
- run:
|
||||||
test-go-linux-386:
|
name: "Install golangci-lint"
|
||||||
|
command: go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.55.0
|
||||||
|
- run:
|
||||||
|
name: "macOS"
|
||||||
|
command: GOGC=20 GOOS=darwin /go/bin/golangci-lint run --verbose --timeout=30m
|
||||||
|
no_output_timeout: 30m
|
||||||
|
lint-windows:
|
||||||
|
executor: telegraf-ci
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- check-changed-files-or-halt
|
||||||
|
- run:
|
||||||
|
name: "Install golangci-lint"
|
||||||
|
command: go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.55.0
|
||||||
|
- run:
|
||||||
|
name: "Windows"
|
||||||
|
command: GOGC=20 GOOS=windows /go/bin/golangci-lint run --verbose --timeout=30m
|
||||||
|
no_output_timeout: 30m
|
||||||
|
test-go-linux:
|
||||||
|
executor: telegraf-ci
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- check-changed-files-or-halt
|
||||||
|
- test-go
|
||||||
|
test-go-linux-386:
|
||||||
executor: telegraf-ci
|
executor: telegraf-ci
|
||||||
parameters:
|
|
||||||
goversion:
|
|
||||||
type: string
|
|
||||||
default: 1.21.5
|
|
||||||
cache_version:
|
|
||||||
type: string
|
|
||||||
default: "v1"
|
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
- restore_cache:
|
|
||||||
name: "Restore Go caches"
|
|
||||||
key: go-caches-<< parameters.cache_version >>-linux-386-go<< parameters.goversion >>-{{ checksum "go.sum" }}
|
|
||||||
- check-changed-files-or-halt
|
- check-changed-files-or-halt
|
||||||
- run: 'GOARCH=386 make deps'
|
- run: 'GOARCH=386 make deps'
|
||||||
- run: 'GOARCH=386 make tidy'
|
- run: 'GOARCH=386 make tidy'
|
||||||
- run: 'GOARCH=386 make check'
|
- run: 'GOARCH=386 make check'
|
||||||
- test-go:
|
- test-go:
|
||||||
arch: "386"
|
arch: "386"
|
||||||
- save_cache:
|
|
||||||
name: "Save Go caches"
|
|
||||||
key: go-caches-<< parameters.cache_version >>-linux-386-go<< parameters.goversion >>-{{ checksum "go.sum" }}
|
|
||||||
paths:
|
|
||||||
- '/go/pkg/mod'
|
|
||||||
- '~/.cache/golangci-lint'
|
|
||||||
- '~/.cache/go-build'
|
|
||||||
test-integration:
|
test-integration:
|
||||||
machine:
|
machine:
|
||||||
image: ubuntu-2204:current
|
image: ubuntu-2204:current
|
||||||
|
|
@ -295,81 +152,51 @@ jobs:
|
||||||
- run: 'make test-integration'
|
- run: 'make test-integration'
|
||||||
test-go-mac:
|
test-go-mac:
|
||||||
executor: mac
|
executor: mac
|
||||||
parameters:
|
|
||||||
goversion:
|
|
||||||
type: string
|
|
||||||
default: 1.21.5
|
|
||||||
cache_version:
|
|
||||||
type: string
|
|
||||||
default: "v1"
|
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
|
- check-changed-files-or-halt
|
||||||
|
- run: 'sh ./scripts/installgo_mac.sh'
|
||||||
- restore_cache:
|
- restore_cache:
|
||||||
name: "Restore Go caches"
|
keys:
|
||||||
key: go-caches-<< parameters.cache_version >>-darwin-arm64-go<< parameters.goversion >>-{{ checksum "go.sum" }}
|
- go-v4-macos-{{ checksum "go.sum" }}
|
||||||
- test-go:
|
- test-go:
|
||||||
os: darwin
|
os: darwin
|
||||||
arch: arm64
|
arch: arm64
|
||||||
- save_cache:
|
- save_cache:
|
||||||
name: "Save Go caches"
|
key: go-v4-macos-{{ checksum "go.sum" }}
|
||||||
key: go-caches-<< parameters.cache_version >>-darwin-arm64-go<< parameters.goversion >>-{{ checksum "go.sum" }}
|
|
||||||
paths:
|
paths:
|
||||||
- '~/go/pkg/mod'
|
- "~/go/pkg/mod"
|
||||||
- '~/Library/Caches/golangci-lint'
|
- "~/Library/Caches/go-build"
|
||||||
- '~/Library/Caches/go-build'
|
|
||||||
test-go-windows:
|
test-go-windows:
|
||||||
parameters:
|
|
||||||
goversion:
|
|
||||||
type: string
|
|
||||||
default: 1.21.5
|
|
||||||
cache_version:
|
|
||||||
type: string
|
|
||||||
default: "v1"
|
|
||||||
executor:
|
executor:
|
||||||
name: win/default
|
name: win/default
|
||||||
shell: bash.exe
|
shell: bash.exe
|
||||||
size: xlarge
|
size: large
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
|
- check-changed-files-or-halt
|
||||||
|
- run: git config --system core.longpaths true
|
||||||
|
- run: choco feature enable -n allowGlobalConfirmation
|
||||||
|
- run: 'sh ./scripts/installgo_windows.sh'
|
||||||
|
- run: choco install mingw --version=12.2.0.03042023
|
||||||
- restore_cache:
|
- restore_cache:
|
||||||
name: "Restore Go caches"
|
keys:
|
||||||
key: go-caches-<< parameters.cache_version >>-windows-amd64-go<< parameters.goversion >>-{{ checksum "go.sum" }}
|
- go-v4-windows-{{ checksum "go.sum" }}
|
||||||
- test-go:
|
- test-go:
|
||||||
os: windows
|
os: windows
|
||||||
gotestsum: "gotestsum.exe"
|
gotestsum: "gotestsum.exe"
|
||||||
- save_cache:
|
- save_cache:
|
||||||
name: "Save Go caches"
|
key: go-v4-windows-{{ checksum "go.sum" }}
|
||||||
key: go-caches-<< parameters.cache_version >>-windows-amd64-go<< parameters.goversion >>-{{ checksum "go.sum" }}
|
|
||||||
paths:
|
paths:
|
||||||
- '~\go\pkg\mod'
|
- '~\go\pkg\mod'
|
||||||
- '~\AppData\Local\golangci-lint'
|
|
||||||
- '~\AppData\Local\go-build'
|
- '~\AppData\Local\go-build'
|
||||||
|
|
||||||
test-licenses:
|
test-licenses:
|
||||||
executor: telegraf-ci
|
executor: telegraf-ci
|
||||||
parameters:
|
|
||||||
goversion:
|
|
||||||
type: string
|
|
||||||
default: 1.21.5
|
|
||||||
cache_version:
|
|
||||||
type: string
|
|
||||||
default: "v1"
|
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
- restore_cache:
|
|
||||||
name: "Restore Go caches"
|
|
||||||
key: go-caches-<< parameters.cache_version >>-linux-amd64-go<< parameters.goversion >>-{{ checksum "go.sum" }}
|
|
||||||
- check-changed-files-or-halt
|
- check-changed-files-or-halt
|
||||||
- run: 'make build_tools'
|
- run: 'make build_tools'
|
||||||
- run: './tools/license_checker/license_checker -whitelist ./tools/license_checker/data/whitelist'
|
- run: './tools/license_checker/license_checker -whitelist ./tools/license_checker/data/whitelist'
|
||||||
- save_cache:
|
|
||||||
name: "Save Go caches"
|
|
||||||
key: go-caches-<< parameters.cache_version >>-linux-amd64-go<< parameters.goversion >>-{{ checksum "go.sum" }}
|
|
||||||
paths:
|
|
||||||
- '/go/pkg/mod'
|
|
||||||
- '~/.cache/golangci-lint'
|
|
||||||
- '~/.cache/go-build'
|
|
||||||
|
|
||||||
windows-package:
|
windows-package:
|
||||||
parameters:
|
parameters:
|
||||||
nightly:
|
nightly:
|
||||||
|
|
@ -695,6 +522,18 @@ workflows:
|
||||||
not:
|
not:
|
||||||
equal: [ scheduled_pipeline, << pipeline.trigger_source >> ]
|
equal: [ scheduled_pipeline, << pipeline.trigger_source >> ]
|
||||||
jobs:
|
jobs:
|
||||||
|
- 'lint-linux':
|
||||||
|
filters:
|
||||||
|
tags:
|
||||||
|
only: /.*/
|
||||||
|
- 'lint-macos':
|
||||||
|
filters:
|
||||||
|
tags:
|
||||||
|
only: /.*/
|
||||||
|
- 'lint-windows':
|
||||||
|
filters:
|
||||||
|
tags:
|
||||||
|
only: /.*/
|
||||||
- 'test-go-linux':
|
- 'test-go-linux':
|
||||||
filters:
|
filters:
|
||||||
tags:
|
tags:
|
||||||
|
|
@ -913,6 +752,9 @@ workflows:
|
||||||
when:
|
when:
|
||||||
equal: [ scheduled_pipeline, << pipeline.trigger_source >> ]
|
equal: [ scheduled_pipeline, << pipeline.trigger_source >> ]
|
||||||
jobs:
|
jobs:
|
||||||
|
- 'lint-linux'
|
||||||
|
- 'lint-macos'
|
||||||
|
- 'lint-windows'
|
||||||
- 'test-go-linux'
|
- 'test-go-linux'
|
||||||
- 'test-go-linux-386'
|
- 'test-go-linux-386'
|
||||||
- 'test-go-mac'
|
- 'test-go-mac'
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,7 @@ set -eux
|
||||||
GO_VERSION="1.21.5"
|
GO_VERSION="1.21.5"
|
||||||
|
|
||||||
setup_go () {
|
setup_go () {
|
||||||
choco upgrade golang --allow-downgrade --force --version=${GO_VERSION}
|
choco upgrade golang --allow-downgrade --version=${GO_VERSION}
|
||||||
git config --system core.longpaths true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if command -v go >/dev/null 2>&1; then
|
if command -v go >/dev/null 2>&1; then
|
||||||
|
|
|
||||||
|
|
@ -1,28 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
set -eux
|
|
||||||
|
|
||||||
MINGW_VERSION="12.2.0.03042023"
|
|
||||||
GCC_VERSION="12.2.0"
|
|
||||||
|
|
||||||
setup_mingw () {
|
|
||||||
choco upgrade mingw --allow-downgrade --force --version=${MINGW_VERSION}
|
|
||||||
}
|
|
||||||
|
|
||||||
export PATH="/c/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/bin:$PATH"
|
|
||||||
echo "$PATH"
|
|
||||||
|
|
||||||
if command -v gcc >/dev/null 2>&1; then
|
|
||||||
echo "MinGW is already installed"
|
|
||||||
v=$(gcc -dumpversion)
|
|
||||||
echo "$v is installed, required version is ${GCC_VERSION}"
|
|
||||||
if [ "$v" != ${GCC_VERSION} ]; then
|
|
||||||
setup_mingw
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
setup_mingw
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "$PATH"
|
|
||||||
command -v gcc
|
|
||||||
gcc -dumpversion
|
|
||||||
Loading…
Reference in New Issue