node_exporter/.circleci/config.yml

105 lines
2.2 KiB
YAML
Raw Normal View History

2018-03-08 11:43:49 +00:00
---
version: 2.1
2018-03-08 11:43:49 +00:00
orbs:
prometheus: prometheus/prometheus@0.1.0
executors:
# Whenever the Go version is updated here, .promu.yml should
# also be updated.
golang:
2018-03-08 11:43:49 +00:00
docker:
- image: circleci/golang:1.13
jobs:
test:
executor: golang
2018-03-08 11:43:49 +00:00
steps:
- prometheus/setup_environment
2018-03-08 11:43:49 +00:00
- run: make
- prometheus/store_artifact:
file: node_exporter
2018-03-08 11:43:49 +00:00
codespell:
docker:
- image: circleci/python
steps:
- checkout
- run: sudo pip install codespell
- run: codespell --skip=".git,./vendor,ttar,go.mod,go.sum" -L uint,packages\',uptodate
2018-03-08 11:43:49 +00:00
build:
machine:
image: ubuntu-1604:201903-01
2018-03-08 11:43:49 +00:00
environment:
DOCKER_TEST_IMAGE_NAME: quay.io/prometheus/golang-builder:1.11-base
2018-03-08 11:43:49 +00:00
REPO_PATH: github.com/prometheus/node_exporter
steps:
- checkout
- run: docker run --privileged linuxkit/binfmt:v0.6
2018-03-08 11:43:49 +00:00
- run: make promu
- run: promu crossbuild
- run: promu --config .promu-cgo.yml crossbuild
2018-03-08 11:43:49 +00:00
- persist_to_workspace:
root: .
paths:
- .build
- store_artifacts:
path: .build
destination: /build
2018-03-08 11:43:49 +00:00
- run:
command: |
if [ -n "$CIRCLE_TAG" ]; then
make docker DOCKER_IMAGE_TAG=$CIRCLE_TAG
2018-03-08 11:43:49 +00:00
else
make docker
2018-03-08 11:43:49 +00:00
fi
- run: docker images
- run: docker run --rm -t -v "$(pwd):/app" "${DOCKER_TEST_IMAGE_NAME}" -i "${REPO_PATH}" -T
- run:
command: |
if [ -n "$CIRCLE_TAG" ]; then
make test-docker DOCKER_IMAGE_TAG=$CIRCLE_TAG
else
make test-docker
fi
workflows:
version: 2
node_exporter:
jobs:
- test:
filters:
tags:
only: /.*/
- build:
filters:
tags:
only: /.*/
- codespell:
filters:
tags:
only: /.*/
- prometheus/publish_master:
context: org-context
2018-03-08 11:43:49 +00:00
requires:
- test
- build
filters:
branches:
only: master
- prometheus/publish_release:
context: org-context
2018-03-08 11:43:49 +00:00
requires:
- test
- build
filters:
2018-03-09 13:18:13 +00:00
tags:
only: /^v.*/
2018-03-08 11:43:49 +00:00
branches:
ignore: /.*/