telegraf/.circleci/config.yml

601 lines
14 KiB
YAML
Raw Normal View History

version: 2.1
orbs:
win: circleci/windows@2.4.0
2021-03-18 02:52:26 +08:00
aws-cli: circleci/aws-cli@1.4.0
executors:
go-1_16:
working_directory: '/go/src/github.com/influxdata/telegraf'
docker:
- image: 'quay.io/influxdb/telegraf-ci:1.16.7'
environment:
GOFLAGS: -p=8
go-1_17:
working_directory: '/go/src/github.com/influxdata/telegraf'
2020-10-08 02:51:49 +08:00
docker:
- image: 'quay.io/influxdb/telegraf-ci:1.17.0'
environment:
GOFLAGS: -p=8
mac:
2020-02-21 06:23:13 +08:00
macos:
xcode: 12.4.0
2020-02-21 06:23:13 +08:00
working_directory: '~/go/src/github.com/influxdata/telegraf'
environment:
HOMEBREW_NO_AUTO_UPDATE: 1
GOFLAGS: -p=8
commands:
generate-config:
parameters:
os:
type: string
default: "linux"
steps:
- checkout
- attach_workspace:
at: '/build'
- run: ./scripts/generate_config.sh << parameters.os >>
- store_artifacts:
path: './new-config'
destination: 'new-config'
- persist_to_workspace:
root: './new-config'
paths:
- '*'
check-changed-files-or-halt:
steps:
- run: ./scripts/check-file-changes.sh
test-go:
parameters:
os:
type: string
default: "linux"
gotestsum:
type: string
default: "gotestsum"
cache_version:
type: string
default: "v3"
steps:
- checkout
- check-changed-files-or-halt
- 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/Go
- restore_cache:
key: windows-go-<< parameters.cache_version >>-{{ checksum "go.sum" }}
- run: 'sh ./scripts/installgo_windows.sh'
- run: mkdir -p test-results
- run: ./scripts/install_gotestsum.sh << parameters.os >> << parameters.gotestsum >>
- run: |
PACKAGE_NAMES=$(go list ./... | circleci tests split --split-by=timings --timings-type=classname)
./<< parameters.gotestsum >> --junitfile test-results/gotestsum-report.xml -- -short $PACKAGE_NAMES
- store_test_results:
path: test-results
- when:
condition:
equal: [ linux, << parameters.os >> ]
steps:
- save_cache:
name: 'Saving cache'
key: linux-go-<< parameters.cache_version >>-{{ checksum "go.sum" }}
paths:
- '~/go/src/github.com/influxdata/telegraf/gotestsum'
- when:
condition:
equal: [ darwin, << parameters.os >> ]
steps:
- save_cache:
name: 'Saving cache'
key: darwin-go-<< parameters.cache_version >>-{{ 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 cache'
key: windows-go-<< parameters.cache_version >>-{{ checksum "go.sum" }}
paths:
- 'C:\Go'
- 'C:\Users\circleci\project\gotestsum.exe'
package-build:
parameters:
release:
type: boolean
default: false
type:
type: string
default: ""
steps:
- checkout
- check-changed-files-or-halt
- attach_workspace:
at: '/go'
- when:
condition: << parameters.release >>
steps:
- run: 'make package'
- unless:
2021-06-03 03:19:33 +08:00
condition:
or:
- << parameters.release >>
steps:
- run: 'make package include_packages="$(make << parameters.type >>)"'
- store_artifacts:
path: './build/dist'
destination: 'build/dist'
- persist_to_workspace:
root: './build'
paths:
- 'dist'
2018-02-02 07:05:39 +08:00
jobs:
deps:
executor: go-1_17
2018-02-02 07:05:39 +08:00
steps:
- checkout
- restore_cache:
key: go-mod-v1-{{ checksum "go.sum" }}
- check-changed-files-or-halt
2018-04-03 05:13:15 +08:00
- run: 'make deps'
- run: 'make tidy'
- run: 'make check'
- run: 'make check-deps'
- save_cache:
name: 'go module cache'
key: go-mod-v1-{{ checksum "go.sum" }}
paths:
- '/go/pkg/mod'
- persist_to_workspace:
root: '/go'
paths:
- '*'
test-go-1_16:
executor: go-1_16
steps:
- test-go
parallelism: 4
test-go-1_16-386:
executor: go-1_16
steps:
- test-go
parallelism: 4
test-go-1_17:
executor: go-1_17
steps:
- test-go
parallelism: 4
test-go-1_17-386:
executor: go-1_17
2018-10-20 02:01:31 +08:00
steps:
- test-go
parallelism: 4
2021-03-17 03:23:44 +08:00
test-go-mac:
executor: mac
2020-02-21 06:23:13 +08:00
steps:
- test-go:
os: darwin
parallelism: 4
test-go-windows:
executor:
name: win/default
shell: bash.exe
steps:
- test-go:
os: windows
gotestsum: "gotestsum.exe"
parallelism: 4
windows-package:
executor: go-1_17
steps:
- package-build:
type: windows
darwin-package:
executor: go-1_17
steps:
- package-build:
type: darwin
i386-package:
executor: go-1_17
steps:
- package-build:
type: i386
ppc64le-package:
executor: go-1_16
steps:
- package-build:
type: ppc64le
s390x-package:
executor: go-1_17
steps:
- package-build:
type: s390x
armel-package:
executor: go-1_17
steps:
- package-build:
type: armel
amd64-package:
executor: go-1_17
steps:
- package-build:
type: amd64
arm64-package:
executor: go-1_17
steps:
- package-build:
type: arm64
mipsel-package:
executor: go-1_17
steps:
- package-build:
type: mipsel
mips-package:
executor: go-1_17
steps:
- package-build:
type: mips
static-package:
executor: go-1_17
steps:
- package-build:
type: static
armhf-package:
executor: go-1_17
steps:
- package-build:
type: armhf
2018-02-02 07:05:39 +08:00
release:
executor: go-1_17
2018-02-02 07:05:39 +08:00
steps:
- package-build:
release: true
2018-02-02 07:05:39 +08:00
nightly:
executor: go-1_17
2018-02-02 07:05:39 +08:00
steps:
- attach_workspace:
at: '/build'
- run:
command: |
aws s3 sync /build/dist s3://dl.influxdata.com/telegraf/nightlies/ \
--exclude "*" \
--include "*.tar.gz" \
--include "*.deb" \
--include "*.rpm" \
--include "*.zip" \
--acl public-read
package-consolidate:
executor:
name: win/default
shell: powershell.exe
steps:
- attach_workspace:
at: '/build'
- store_artifacts:
path: './build/dist'
destination: 'build/dist'
package-sign-windows:
executor:
name: win/default
shell: powershell.exe
steps:
- checkout
- check-changed-files-or-halt
- attach_workspace:
at: '/build'
- run:
name: "Sign Windows Executables"
shell: powershell.exe
command: |
./scripts/windows-signing.ps1
- persist_to_workspace:
root: './build'
paths:
- 'dist'
- store_artifacts:
path: './build/dist'
destination: 'build/dist'
package-sign-mac:
macos:
xcode: "11.3"
working_directory: /Users/distiller/project
environment:
FL_OUTPUT_DIR: output
FASTLANE_LANE: test
shell: /bin/bash --login -o pipefail
steps:
- checkout
- check-changed-files-or-halt
- attach_workspace:
at: '.'
- run:
command: |
sh ./scripts/mac-signing.sh
- store_artifacts:
path: './dist'
destination: 'build/dist'
test-awaiter:
executor: go-1_17
steps:
- run:
command: |
echo "Go tests complete."
2021-03-18 02:52:26 +08:00
share-artifacts:
executor: aws-cli/default
2021-03-18 02:52:26 +08:00
steps:
- run:
command: |
PR=${CIRCLE_PULL_REQUEST##*/}
printf -v payload '{ "pullRequestNumber": "%s" }' "$PR"
curl -X POST "https://182c7jdgog.execute-api.us-east-1.amazonaws.com/prod/shareArtifacts" --data "$payload"
generate-config:
executor: go-1_17
steps:
- generate-config
generate-config-win:
executor:
name: win/default
shell: bash.exe
steps:
- generate-config:
os: windows
update-config:
executor: go-1_17
steps:
- checkout
- attach_workspace:
at: '/new-config'
- run: ./scripts/update_config.sh ${UPDATE_CONFIG_TOKEN}
commonjobs:
- &test-awaiter
'test-awaiter':
requires:
- 'test-go-1_16'
- 'test-go-1_16-386'
- 'test-go-1_17'
- 'test-go-1_17-386'
- &windows-package
'windows-package':
requires:
- 'test-go-windows'
- &darwin-package
'darwin-package':
requires:
- 'test-go-mac'
- &i386-package
'i386-package':
requires:
- 'test-awaiter'
- &ppc64le-package
'ppc64le-package':
requires:
- 'test-awaiter'
- &s390x-package
's390x-package':
requires:
- 'test-awaiter'
- &armel-package
'armel-package':
requires:
- 'test-awaiter'
- &amd64-package
'amd64-package':
requires:
- 'test-awaiter'
- &arm64-package
'arm64-package':
requires:
- 'test-awaiter'
- &armhf-package
'armhf-package':
requires:
- 'test-awaiter'
- &static-package
'static-package':
requires:
- 'test-awaiter'
- &mipsel-package
'mipsel-package':
requires:
- 'test-awaiter'
- &mips-package
'mips-package':
requires:
- 'test-awaiter'
2018-02-02 07:05:39 +08:00
workflows:
version: 2
check:
2018-02-02 07:05:39 +08:00
jobs:
- 'deps':
filters:
tags:
only: /.*/
- 'test-go-1_16':
requires:
- 'deps'
filters:
tags:
only: /.*/
- 'test-go-1_16-386':
2018-10-20 02:01:31 +08:00
requires:
- 'deps'
filters:
tags:
only: /.*/
- 'test-go-1_17':
requires:
- 'deps'
filters:
tags:
only: /.*/
- 'test-go-1_17-386':
requires:
- 'deps'
filters:
tags:
only: /.*/
2021-03-17 03:23:44 +08:00
- 'test-go-mac':
2020-02-21 06:23:13 +08:00
filters:
tags: # only runs on tags if you specify this filter
only: /.*/
- 'test-go-windows':
filters:
tags:
only: /.*/
- *test-awaiter
- *windows-package
- *darwin-package
- *i386-package
- *ppc64le-package
- *s390x-package
- *armel-package
- *amd64-package
- *arm64-package
- *armhf-package
- *static-package
- *mipsel-package
- *mips-package
- 'generate-config':
requires:
- 'amd64-package'
filters:
branches:
only:
- master
- 'generate-config-win':
requires:
- 'windows-package'
filters:
branches:
only:
- master
- 'update-config':
requires:
- 'generate-config-win'
- 'generate-config'
filters:
branches:
only:
- master
2021-03-18 02:52:26 +08:00
- 'share-artifacts':
requires:
- 'i386-package'
- 'ppc64le-package'
- 's390x-package'
- 'armel-package'
- 'amd64-package'
- 'mipsel-package'
- 'mips-package'
- 'darwin-package'
- 'windows-package'
- 'static-package'
- 'arm64-package'
- 'armhf-package'
2021-03-18 02:52:26 +08:00
filters:
branches:
ignore:
- master
2018-02-02 07:05:39 +08:00
- 'release':
requires:
- 'test-go-windows'
2021-03-17 03:23:44 +08:00
- 'test-go-mac'
- 'test-go-1_16'
- 'test-go-1_16-386'
- 'test-go-1_17'
- 'test-go-1_17-386'
filters:
tags:
only: /.*/
branches:
ignore: /.*/
- 'package-sign-windows':
requires:
- 'release'
filters:
tags:
only: /.*/
- 'package-sign-mac':
requires:
- 'package-sign-windows'
filters:
tags:
only: /.*/
2018-02-02 07:05:39 +08:00
nightly:
jobs:
- 'deps'
- 'test-go-1_16':
requires:
- 'deps'
- 'test-go-1_16-386':
2018-10-20 02:01:31 +08:00
requires:
- 'deps'
- 'test-go-1_17':
requires:
- 'deps'
- 'test-go-1_17-386':
requires:
- 'deps'
2021-03-17 03:23:44 +08:00
- 'test-go-mac'
- 'test-go-windows'
- *test-awaiter
- *windows-package
- *darwin-package
- *i386-package
- *ppc64le-package
- *s390x-package
- *armel-package
- *amd64-package
- *arm64-package
- *armhf-package
- *static-package
- *mipsel-package
- *mips-package
- nightly:
requires:
- 'i386-package'
- 'ppc64le-package'
- 's390x-package'
- 'armel-package'
- 'amd64-package'
- 'mipsel-package'
- 'mips-package'
- 'darwin-package'
- 'windows-package'
- 'static-package'
- 'arm64-package'
- 'armhf-package'
2018-02-02 07:05:39 +08:00
triggers:
- schedule:
2018-04-25 04:42:42 +08:00
cron: "0 7 * * *"
2018-02-02 07:05:39 +08:00
filters:
branches:
only:
2021-07-27 09:39:23 +08:00
- master