From 36a8751c9116e8dc0b11a98bf47f78b83c4e5fe6 Mon Sep 17 00:00:00 2001 From: Pedro Tanaka Date: Sat, 22 Feb 2025 14:19:42 +0100 Subject: [PATCH 1/3] (chore): update golangci-lint version Signed-off-by: Pedro Tanaka --- Makefile.common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.common b/Makefile.common index d1576bb..55d44ff 100644 --- a/Makefile.common +++ b/Makefile.common @@ -61,7 +61,7 @@ PROMU_URL := https://github.com/prometheus/promu/releases/download/v$(PROMU_ SKIP_GOLANGCI_LINT := GOLANGCI_LINT := GOLANGCI_LINT_OPTS ?= -GOLANGCI_LINT_VERSION ?= v1.63.4 +GOLANGCI_LINT_VERSION ?= v1.64.5 # golangci-lint only supports linux, darwin and windows platforms on i386/amd64/arm64. # windows isn't included here because of the path separator being different. ifeq ($(GOHOSTOS),$(filter $(GOHOSTOS),linux darwin)) From 9176dc56474bd138180dcea56aee889b8993d287 Mon Sep 17 00:00:00 2001 From: Pedro Tanaka Date: Sat, 22 Feb 2025 14:27:20 +0100 Subject: [PATCH 2/3] trying move to gh actions Signed-off-by: Pedro Tanaka --- .circleci/config.yml | 53 +++++++++++-------------------- .github/workflows/ci.yml | 67 ++++++++++++++++++++++++++++++++++++++++ Makefile.common | 2 +- go.mod | 2 +- 4 files changed, 87 insertions(+), 37 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.circleci/config.yml b/.circleci/config.yml index 6807695..46bf19c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,48 +1,31 @@ +# This project has switched to GitHub Actions. +# CircleCI is not disabled repository-wise so that previous pull requests +# continue working. +# This file does not generate any CircleCI workflow. + version: 2.1 -orbs: - prometheus: prometheus/prometheus@0.17.1 + executors: - # Whenever the Go version is updated here, .promu.yml should also be updated. golang: docker: - - image: cimg/go:1.23 + - image: busybox + jobs: - test: + noopjob: executor: golang steps: - - prometheus/setup_environment - - run: make - - run: git diff --exit-code - - prometheus/store_artifact: - file: statsd_exporter + - run: + command: "true" + workflows: version: 2 statsd_exporter: jobs: - - test: - filters: - tags: - only: /.*/ - - prometheus/build: - name: build - filters: - tags: - only: /.*/ - - prometheus/publish_master: - context: org-context - requires: - - test - - build + - noopjob + triggers: + - schedule: + cron: "0 0 30 2 *" filters: branches: - only: master - - prometheus/publish_release: - context: org-context - requires: - - test - - build - filters: - tags: - only: /^v[0-9]+(\.[0-9]+){2}(-.+|[^-.]*)$/ - branches: - ignore: /.*/ + only: + - master diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..5874c51 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,67 @@ +name: CI +on: # yamllint disable-line rule:truthy + push: + branches: + - main + tags: + - v* + pull_request: + +jobs: + test: + name: Test + runs-on: ubuntu-latest + # Whenever the Go version is updated here, .promu.yml + # should also be updated. + container: + image: quay.io/prometheus/golang-builder:1.23-base + steps: + - uses: actions/checkout@v4 + - uses: prometheus/promci@c3c93a50d581b928af720f0134b2b2dad32a6c41 + - uses: ./.github/promci/actions/setup_environment + - run: make SKIP_GOLANGCI_LINT=1 + + build: + name: Build + runs-on: ubuntu-latest + strategy: + matrix: + thread: [ 0, 1, 2, 3, 4, 5 ] + steps: + - uses: actions/checkout@v4 + - uses: prometheus/promci@c3c93a50d581b928af720f0134b2b2dad32a6c41 + - uses: ./.github/promci/actions/build + with: + parallelism: 6 + thread: ${{ matrix.thread }} + + publish_main: + name: Publish main branch artifacts + runs-on: ubuntu-latest + needs: [test, build] + if: github.event_name == 'push' && github.event.ref == 'refs/heads/main' + steps: + - uses: actions/checkout@v4 + - uses: prometheus/promci@v0.0.2 + - uses: ./.github/promci/actions/publish_main + with: + docker_hub_login: ${{ secrets.docker_hub_login }} + docker_hub_password: ${{ secrets.docker_hub_password }} + quay_io_login: ${{ secrets.quay_io_login }} + quay_io_password: ${{ secrets.quay_io_password }} + + publish_release: + name: Publish release artifacts + runs-on: ubuntu-latest + needs: [test, build] + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') + steps: + - uses: actions/checkout@v4 + - uses: prometheus/promci@v0.0.2 + - uses: ./.github/promci/actions/publish_release + with: + docker_hub_login: ${{ secrets.docker_hub_login }} + docker_hub_password: ${{ secrets.docker_hub_password }} + quay_io_login: ${{ secrets.quay_io_login }} + quay_io_password: ${{ secrets.quay_io_password }} + github_token: ${{ secrets.PROMBOT_GITHUB_TOKEN }} diff --git a/Makefile.common b/Makefile.common index 55d44ff..d1576bb 100644 --- a/Makefile.common +++ b/Makefile.common @@ -61,7 +61,7 @@ PROMU_URL := https://github.com/prometheus/promu/releases/download/v$(PROMU_ SKIP_GOLANGCI_LINT := GOLANGCI_LINT := GOLANGCI_LINT_OPTS ?= -GOLANGCI_LINT_VERSION ?= v1.64.5 +GOLANGCI_LINT_VERSION ?= v1.63.4 # golangci-lint only supports linux, darwin and windows platforms on i386/amd64/arm64. # windows isn't included here because of the path separator being different. ifeq ($(GOHOSTOS),$(filter $(GOHOSTOS),linux darwin)) diff --git a/go.mod b/go.mod index a8917ec..ffb9368 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/prometheus/statsd_exporter -go 1.22 +go 1.23 require ( github.com/alecthomas/kingpin/v2 v2.4.0 From 2f910c54176346f944dabe29bee5a47018fc1d8e Mon Sep 17 00:00:00 2001 From: Pedro Tanaka Date: Sat, 22 Feb 2025 14:46:14 +0100 Subject: [PATCH 3/3] fixing release Signed-off-by: Pedro Tanaka --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5874c51..91e6407 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,11 +35,11 @@ jobs: parallelism: 6 thread: ${{ matrix.thread }} - publish_main: - name: Publish main branch artifacts + publish_master: + name: Publish master branch artifacts runs-on: ubuntu-latest needs: [test, build] - if: github.event_name == 'push' && github.event.ref == 'refs/heads/main' + if: github.event_name == 'push' && github.event.ref == 'refs/heads/master' steps: - uses: actions/checkout@v4 - uses: prometheus/promci@v0.0.2 @@ -57,7 +57,7 @@ jobs: if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') steps: - uses: actions/checkout@v4 - - uses: prometheus/promci@v0.0.2 + - uses: prometheus/promci@c3c93a50d581b928af720f0134b2b2dad32a6c41 - uses: ./.github/promci/actions/publish_release with: docker_hub_login: ${{ secrets.docker_hub_login }}