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:
|
||||
type: string
|
||||
default: "gotestsum"
|
||||
cache_version:
|
||||
type: string
|
||||
default: "v1"
|
||||
goversion:
|
||||
type: string
|
||||
default: 1.21.5
|
||||
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 >>
|
||||
- unless:
|
||||
condition:
|
||||
equal: [ "386", << parameters.arch >> ]
|
||||
steps:
|
||||
- run: echo 'export RACE="-race"' >> $BASH_ENV
|
||||
- when:
|
||||
condition:
|
||||
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'
|
||||
- run: |
|
||||
GOARCH=<< parameters.arch >> ./<< parameters.gotestsum >> -- ${RACE} -short ./...
|
||||
package-build:
|
||||
parameters:
|
||||
type:
|
||||
|
|
@ -222,67 +83,63 @@ commands:
|
|||
root: './build'
|
||||
paths:
|
||||
- 'dist'
|
||||
|
||||
jobs:
|
||||
test-go-linux:
|
||||
lint-linux:
|
||||
executor: telegraf-ci
|
||||
parameters:
|
||||
goversion:
|
||||
type: string
|
||||
default: 1.21.5
|
||||
cache_version:
|
||||
type: string
|
||||
default: "v1"
|
||||
steps:
|
||||
- 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
|
||||
- run: ./scripts/make_docs.sh
|
||||
- run: 'make deps'
|
||||
- run: 'make tidy'
|
||||
- run: 'make check'
|
||||
- run: 'make check-deps'
|
||||
- test-go
|
||||
- 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'
|
||||
- persist_to_workspace:
|
||||
root: '/go'
|
||||
paths:
|
||||
- '*'
|
||||
test-go-linux-386:
|
||||
- run:
|
||||
name: "Install golangci-lint"
|
||||
command: go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.55.0
|
||||
- run:
|
||||
name: "Linux"
|
||||
command: GOGC=20 /go/bin/golangci-lint run --verbose
|
||||
lint-macos:
|
||||
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: "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
|
||||
parameters:
|
||||
goversion:
|
||||
type: string
|
||||
default: 1.21.5
|
||||
cache_version:
|
||||
type: string
|
||||
default: "v1"
|
||||
steps:
|
||||
- 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
|
||||
- run: 'GOARCH=386 make deps'
|
||||
- run: 'GOARCH=386 make tidy'
|
||||
- run: 'GOARCH=386 make check'
|
||||
- test-go:
|
||||
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:
|
||||
machine:
|
||||
image: ubuntu-2204:current
|
||||
|
|
@ -295,81 +152,51 @@ jobs:
|
|||
- run: 'make test-integration'
|
||||
test-go-mac:
|
||||
executor: mac
|
||||
parameters:
|
||||
goversion:
|
||||
type: string
|
||||
default: 1.21.5
|
||||
cache_version:
|
||||
type: string
|
||||
default: "v1"
|
||||
steps:
|
||||
- checkout
|
||||
- check-changed-files-or-halt
|
||||
- run: 'sh ./scripts/installgo_mac.sh'
|
||||
- restore_cache:
|
||||
name: "Restore Go caches"
|
||||
key: go-caches-<< parameters.cache_version >>-darwin-arm64-go<< parameters.goversion >>-{{ checksum "go.sum" }}
|
||||
keys:
|
||||
- go-v4-macos-{{ checksum "go.sum" }}
|
||||
- test-go:
|
||||
os: darwin
|
||||
arch: arm64
|
||||
- save_cache:
|
||||
name: "Save Go caches"
|
||||
key: go-caches-<< parameters.cache_version >>-darwin-arm64-go<< parameters.goversion >>-{{ checksum "go.sum" }}
|
||||
key: go-v4-macos-{{ checksum "go.sum" }}
|
||||
paths:
|
||||
- '~/go/pkg/mod'
|
||||
- '~/Library/Caches/golangci-lint'
|
||||
- '~/Library/Caches/go-build'
|
||||
- "~/go/pkg/mod"
|
||||
- "~/Library/Caches/go-build"
|
||||
test-go-windows:
|
||||
parameters:
|
||||
goversion:
|
||||
type: string
|
||||
default: 1.21.5
|
||||
cache_version:
|
||||
type: string
|
||||
default: "v1"
|
||||
executor:
|
||||
name: win/default
|
||||
shell: bash.exe
|
||||
size: xlarge
|
||||
size: large
|
||||
steps:
|
||||
- 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:
|
||||
name: "Restore Go caches"
|
||||
key: go-caches-<< parameters.cache_version >>-windows-amd64-go<< parameters.goversion >>-{{ checksum "go.sum" }}
|
||||
keys:
|
||||
- go-v4-windows-{{ checksum "go.sum" }}
|
||||
- test-go:
|
||||
os: windows
|
||||
gotestsum: "gotestsum.exe"
|
||||
- save_cache:
|
||||
name: "Save Go caches"
|
||||
key: go-caches-<< parameters.cache_version >>-windows-amd64-go<< parameters.goversion >>-{{ checksum "go.sum" }}
|
||||
key: go-v4-windows-{{ checksum "go.sum" }}
|
||||
paths:
|
||||
- '~\go\pkg\mod'
|
||||
- '~\AppData\Local\golangci-lint'
|
||||
- '~\AppData\Local\go-build'
|
||||
|
||||
test-licenses:
|
||||
executor: telegraf-ci
|
||||
parameters:
|
||||
goversion:
|
||||
type: string
|
||||
default: 1.21.5
|
||||
cache_version:
|
||||
type: string
|
||||
default: "v1"
|
||||
steps:
|
||||
- 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
|
||||
- run: 'make build_tools'
|
||||
- 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:
|
||||
parameters:
|
||||
nightly:
|
||||
|
|
@ -695,6 +522,18 @@ workflows:
|
|||
not:
|
||||
equal: [ scheduled_pipeline, << pipeline.trigger_source >> ]
|
||||
jobs:
|
||||
- 'lint-linux':
|
||||
filters:
|
||||
tags:
|
||||
only: /.*/
|
||||
- 'lint-macos':
|
||||
filters:
|
||||
tags:
|
||||
only: /.*/
|
||||
- 'lint-windows':
|
||||
filters:
|
||||
tags:
|
||||
only: /.*/
|
||||
- 'test-go-linux':
|
||||
filters:
|
||||
tags:
|
||||
|
|
@ -913,6 +752,9 @@ workflows:
|
|||
when:
|
||||
equal: [ scheduled_pipeline, << pipeline.trigger_source >> ]
|
||||
jobs:
|
||||
- 'lint-linux'
|
||||
- 'lint-macos'
|
||||
- 'lint-windows'
|
||||
- 'test-go-linux'
|
||||
- 'test-go-linux-386'
|
||||
- 'test-go-mac'
|
||||
|
|
|
|||
|
|
@ -5,8 +5,7 @@ set -eux
|
|||
GO_VERSION="1.21.5"
|
||||
|
||||
setup_go () {
|
||||
choco upgrade golang --allow-downgrade --force --version=${GO_VERSION}
|
||||
git config --system core.longpaths true
|
||||
choco upgrade golang --allow-downgrade --version=${GO_VERSION}
|
||||
}
|
||||
|
||||
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