Skip to content

Commit

Permalink
Merge pull request #127 from prometheus/repo_sync
Browse files Browse the repository at this point in the history
Synchronize common files from prometheus/prometheus
  • Loading branch information
SuperQ authored Jan 8, 2022
2 parents fda0c86 + 516aa3d commit 2458f73
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 46 deletions.
79 changes: 37 additions & 42 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,59 +1,54 @@
---
version: 2.1

orbs:
prometheus: prometheus/[email protected]

prometheus: prometheus/[email protected]
executors:
# Whenever the Go version is updated here, .promu.yml should also be updated.
golang:
docker:
- image: circleci/golang:1.17
- image: circleci/golang:1.17
golang_memcached:
docker:
- image: circleci/golang:1.17
- image: memcached

- image: circleci/golang:1.17
- image: memcached
jobs:
test:
executor: golang_memcached

steps:
- prometheus/setup_environment
- setup_remote_docker
- run: make
- prometheus/store_artifact:
file: memcached_exporter
- run: git diff --exit-code

- prometheus/setup_environment
- setup_remote_docker
- run: make
- prometheus/store_artifact:
file: memcached_exporter
- run: git diff --exit-code
workflows:
version: 2
memcached_exporter:
jobs:
- test:
filters:
tags:
only: /.*/
- prometheus/build:
name: build
filters:
tags:
only: /.*/
- prometheus/publish_master:
context: org-context
requires:
- test
- build
filters:
branches:
only: master
- prometheus/publish_release:
context: org-context
requires:
- test
- build
filters:
tags:
only: /^v[0-9]+(\.[0-9]+){2}(-.+|[^-.]*)$/
branches:
ignore: /.*/
- test:
filters:
tags:
only: /.*/
- prometheus/build:
name: build
filters:
tags:
only: /.*/
- prometheus/publish_master:
context: org-context
requires:
- test
- build
filters:
branches:
only: master
- prometheus/publish_release:
context: org-context
requires:
- test
- build
filters:
tags:
only: /^v[0-9]+(\.[0-9]+){2}(-.+|[^-.]*)$/
branches:
ignore: /.*/
31 changes: 31 additions & 0 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: golangci-lint
on:
push:
paths:
- "go.sum"
- "go.mod"
- "**.go"
- "scripts/errcheck_excludes.txt"
- ".github/workflows/golangci-lint.yml"
- ".golangci.yml"
pull_request:
paths:
- "go.sum"
- "go.mod"
- "**.go"
- "scripts/errcheck_excludes.txt"
- ".github/workflows/golangci-lint.yml"
- ".golangci.yml"

jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Lint
uses: golangci/golangci-lint-action@v2
with:
version: v1.42.0
14 changes: 10 additions & 4 deletions Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,23 @@ ifneq ($(shell which gotestsum),)
endif
endif

PROMU_VERSION ?= 0.12.0
PROMU_VERSION ?= 0.13.0
PROMU_URL := https://github.com/prometheus/promu/releases/download/v$(PROMU_VERSION)/promu-$(PROMU_VERSION).$(GO_BUILD_PLATFORM).tar.gz

GOLANGCI_LINT :=
GOLANGCI_LINT_OPTS ?=
GOLANGCI_LINT_VERSION ?= v1.39.0
GOLANGCI_LINT_VERSION ?= v1.42.0
# golangci-lint only supports linux, darwin and windows platforms on i386/amd64.
# windows isn't included here because of the path separator being different.
ifeq ($(GOHOSTOS),$(filter $(GOHOSTOS),linux darwin))
ifeq ($(GOHOSTARCH),$(filter $(GOHOSTARCH),amd64 i386))
GOLANGCI_LINT := $(FIRST_GOPATH)/bin/golangci-lint
# If we're in CI and there is an Actions file, that means the linter
# is being run in Actions, so we don't need to run it here.
ifeq (,$(CIRCLE_JOB))
GOLANGCI_LINT := $(FIRST_GOPATH)/bin/golangci-lint
else ifeq (,$(wildcard .github/workflows/golangci-lint.yml))
GOLANGCI_LINT := $(FIRST_GOPATH)/bin/golangci-lint
endif
endif
endif

Expand Down Expand Up @@ -154,7 +160,7 @@ endif
update-go-deps:
@echo ">> updating Go dependencies"
@for m in $$($(GO) list -mod=readonly -m -f '{{ if and (not .Indirect) (not .Main)}}{{.Path}}{{end}}' all); do \
$(GO) get $$m; \
$(GO) get -d $$m; \
done
GO111MODULE=$(GO111MODULE) $(GO) mod tidy
ifneq (,$(wildcard vendor))
Expand Down

0 comments on commit 2458f73

Please sign in to comment.