Skip to content

Commit

Permalink
Revert "chore: Cache rework for .circleci jobs (influxdata#13753)"
Browse files Browse the repository at this point in the history
This reverts commit 904db01.
  • Loading branch information
powersj committed Dec 15, 2023
1 parent a2d44ff commit d8b2470
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 99 deletions.
130 changes: 31 additions & 99 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,66 +37,51 @@ commands:
default: "gotestsum"
cache_version:
type: string
default: "v2"
goversion:
type: string
default: 1.21.5
default: "v3"
steps:
- checkout
- check-changed-files-or-halt
- restore_cache:
name: "Restore binaries from cache"
key: << parameters.os >>-<< parameters.arch >>-go<< parameters.goversion >>-<< parameters.cache_version >>-{{ checksum "go.sum" }}
- when:
condition:
equal: [ linux, << parameters.os >> ]
steps:
- restore_cache:
key: linux-go-<< parameters.cache_version >>-{{ checksum "go.sum" }}
- attach_workspace:
at: '/go'
- when:
condition:
equal: [ darwin, << parameters.os >> ]
steps:
- restore_cache:
key: darwin-go-<< parameters.cache_version >>-{{ checksum "go.sum" }}
- run: 'sh ./scripts/installgo_mac.sh'
- when:
condition:
equal: [ windows, << parameters.os >> ]
steps:
- run: rm -rf '/c/Program Files/Go'
- run: rm -rf /c/Go
- run: choco feature enable -n allowGlobalConfirmation
- restore_cache:
key: windows-go-<< parameters.cache_version >>-{{ checksum "go.sum" }}
- run: 'sh ./scripts/installgo_windows.sh'
- run: choco install mingw --version=12.2.0.03042023
- run: go env
- run: go install github.com/golangci/golangci-lint/cmd/[email protected]
- run: choco install mingw
- run: go install github.com/golangci/golangci-lint/cmd/[email protected]
- 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
- run: 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
- run: $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: $HOME/go/bin/golangci-lint.exe run --verbose
- run: ./scripts/install_gotestsum.sh << parameters.os >> << parameters.gotestsum >>
- unless:
condition:
Expand Down Expand Up @@ -126,19 +111,19 @@ commands:
equal: [ linux, << parameters.os >> ]
steps:
- save_cache:
name: 'Saving binaries to cache'
key: << parameters.os >>-<< parameters.arch >>-go<< parameters.goversion >>-<< parameters.cache_version >>-{{ checksum "go.sum" }}
name: 'Saving cache'
key: linux-go-<< parameters.cache_version >>-{{ checksum "go.sum" }}
paths:
- '/go/src/github.com/influxdata/telegraf/gotestsum'
- '~/go/src/github.com/influxdata/telegraf/gotestsum'
- when:
condition:
equal: [ darwin, << parameters.os >> ]
steps:
- save_cache:
name: 'Saving binaries to cache'
key: << parameters.os >>-<< parameters.arch >>-go<< parameters.goversion >>-<< parameters.cache_version >>-{{ checksum "go.sum" }}
name: 'Saving cache'
key: darwin-go-<< parameters.cache_version >>-{{ checksum "go.sum" }}
paths:
- '~/go/src/github.com/influxdata/telegraf/gotestsum'
- '/go/src/github.com/influxdata/telegraf/gotestsum'
- '/usr/local/Cellar/go'
- '/usr/local/bin/go'
- '/usr/local/bin/gofmt'
Expand All @@ -147,11 +132,11 @@ commands:
equal: [ windows, << parameters.os >> ]
steps:
- save_cache:
name: 'Saving binaries to cache'
key: << parameters.os >>-<< parameters.arch >>-go<< parameters.goversion >>-<< parameters.cache_version >>-{{ checksum "go.sum" }}
name: 'Saving cache'
key: windows-go-<< parameters.cache_version >>-{{ checksum "go.sum" }}
paths:
- '~\project\gotestsum.exe'
- 'C:\Program Files\Go'
- 'C:\Go'
- 'C:\Users\circleci\project\gotestsum.exe'
package-build:
parameters:
type:
Expand Down Expand Up @@ -191,22 +176,17 @@ commands:
root: './build'
paths:
- 'dist'

jobs:
test-go-linux:
executor: telegraf-ci
parameters:
goversion:
type: string
default: 1.21.5
cache_version:
type: string
default: "v2"
steps:
- checkout
- restore_cache:
name: "Restore Go caches"
key: linux-amd64-go<< parameters.goversion >>-cache-<< parameters.cache_version >>-{{ checksum "go.sum" }}
key: go-mod-v1-{{ checksum "go.sum" }}
- check-changed-files-or-halt
- run: ./scripts/make_docs.sh
- run: 'make deps'
Expand All @@ -215,43 +195,30 @@ jobs:
- run: 'make check-deps'
- test-go
- save_cache:
name: "Save Go caches"
key: linux-amd64-go<< parameters.goversion >>-<< parameters.cache_version >>-{{ checksum "go.sum" }}
name: 'go module cache'
key: go-mod-v1-{{ checksum "go.sum" }}
paths:
- '/go/pkg/mod'
- '~/.cache/golangci-lint'
- '~/.cache/go-build'
- persist_to_workspace:
root: '/go'
paths:
- '*'
test-go-linux-386:
executor: telegraf-ci
parameters:
goversion:
type: string
default: 1.21.5
cache_version:
type: string
default: "v2"
steps:
- checkout
- restore_cache:
name: "Restore Go caches"
key: linux-386-go<< parameters.goversion >>-cache-<< parameters.cache_version >>-{{ checksum "go.sum" }}
key: go-mod-v1-{{ 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: linux-386-go<< parameters.goversion >>-cache-<< parameters.cache_version >>-{{ checksum "go.sum" }}
paths:
- '/go/pkg/mod'
- '~/.cache/golangci-lint'
- '~/.cache/go-build'
test-integration:
machine:
image: ubuntu-2204:current
Expand All @@ -265,32 +232,14 @@ jobs:
test-go-mac:
executor: mac
parameters:
goversion:
type: string
default: 1.21.5
cache_version:
type: string
default: "v2"
steps:
- checkout
- restore_cache:
name: "Restore Go caches"
key: darwin-arm64-go<< parameters.goversion >>-cache-<< parameters.cache_version >>-{{ checksum "go.sum" }}
- test-go:
os: darwin
arch: arm64
- save_cache:
name: "Save Go caches"
key: darwin-arm64-go<< parameters.goversion >>-cache-<< parameters.cache_version >>-{{ checksum "go.sum" }}
paths:
- '~/go/pkg/mod'
- '~/Library/Caches/golangci-lint'
- '~/Library/Caches/go-build'
test-go-windows:
parameters:
goversion:
type: string
default: 1.21.5
cache_version:
type: string
default: "v2"
Expand All @@ -299,45 +248,28 @@ jobs:
shell: bash.exe
size: xlarge
steps:
- checkout
- restore_cache:
name: "Restore Go caches"
key: windows-amd64-go<< parameters.goversion >>-cache-<< parameters.cache_version >>-{{ checksum "go.sum" }}
- test-go:
os: windows
gotestsum: "gotestsum.exe"
- save_cache:
name: "Save Go caches"
key: windows-amd64-go<< parameters.goversion >>-cache-<< parameters.cache_version >>-{{ 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: "v2"
steps:
- checkout
- restore_cache:
name: "Restore Go caches"
key: linux-amd64-go<< parameters.goversion >>-cache-<< parameters.cache_version >>-{{ checksum "go.sum" }}
key: go-mod-v1-{{ 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: linux-amd64-go<< parameters.goversion >>-cache-<< parameters.cache_version >>-{{ checksum "go.sum" }}
name: 'go module cache'
key: go-mod-v1-{{ checksum "go.sum" }}
paths:
- '/go/pkg/mod'
- '~/.cache/golangci-lint'
- '~/.cache/go-build'

windows-package:
parameters:
Expand Down
2 changes: 2 additions & 0 deletions scripts/installgo_windows.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ setup_go () {
choco upgrade golang --allow-downgrade --version=${GO_VERSION}
choco install make
git config --system core.longpaths true
rm -rf /c/Go
cp -r /c/Program\ Files/Go /c/
}

if command -v go >/dev/null 2>&1; then
Expand Down

0 comments on commit d8b2470

Please sign in to comment.