Skip to content

Commit 80497ba

Browse files
authored
Merge branch 'main' into docker-build
2 parents a5547a0 + bb5ed80 commit 80497ba

File tree

8 files changed

+79
-8
lines changed

8 files changed

+79
-8
lines changed

.github/workflows/build.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- release-0.1x
8+
tags:
9+
- v[0-9]+.[0-9]+.[0-9]+*
10+
pull_request:
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
build:
17+
name: Build
18+
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
24+
with:
25+
fetch-depth: 0
26+
27+
- name: Set up Go
28+
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
29+
with:
30+
go-version-file: ${{ github.workspace }}/go.mod
31+
32+
- name: Set up QEMU
33+
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
34+
35+
- name: Set up Docker Buildx
36+
id: buildx
37+
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
38+
39+
- name: Dry-run GoReleaser
40+
run: |
41+
make release-dry-run
42+
43+
- name: Run debug commands on failure
44+
if: ${{ failure() }}
45+
run: |
46+
echo "--- Environment variables ---"
47+
env | sort
48+
echo "--- GO Environment ---"
49+
go env | sort
50+
echo "--- Git status ---"
51+
git status
52+
echo "--- Docker logs ---"
53+
docker compose logs
54+
echo "--- Docker ps ---"
55+
docker compose ps -a

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020

2121
steps:
2222
- name: Checkout code
23-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
23+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
2424

2525
- name: Set up Go
2626
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
runs-on: ubuntu-latest
2222
steps:
2323
- name: Checkout
24-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
24+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
2525
with:
2626
fetch-depth: 0
2727

@@ -31,13 +31,13 @@ jobs:
3131
go-version-file: ${{ github.workspace }}/go.mod
3232

3333
- name: Login to Docker Hub
34-
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
34+
uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0
3535
with:
3636
username: ${{ secrets.DOCKERHUB_USERNAME }}
3737
password: ${{ secrets.DOCKERHUB_TOKEN }}
3838

3939
- name: Login to GitHub Container Registry
40-
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
40+
uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0
4141
with:
4242
registry: ghcr.io
4343
username: ${{ github.actor }}

.github/workflows/scorecard.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323

2424
steps:
2525
- name: Checkout code
26-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
26+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
2727
with:
2828
persist-credentials: false
2929

.github/workflows/go.yml renamed to .github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838

3939
steps:
4040
- name: Checkout code
41-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
41+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
4242

4343
- name: Set up Go
4444
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0

.github/workflows/version-check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212

1313
steps:
1414
- name: Checkout code
15-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
15+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
1616
with:
1717
fetch-depth: 0
1818

.goreleaser.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ builds:
44
- binary: mongodb_exporter
55
id: mongodb_exporter
66
env:
7+
- CGO_ENABLED=0
78
goos:
89
- linux
910
- darwin

Makefile

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: all build clean default help init test format check-license
1+
.PHONY: all build clean default help init test format check-license release-dry-run
22
default: help
33

44
GO_TEST_PATH ?= ./...
@@ -87,6 +87,21 @@ release: ## Build the binaries using goreleaser
8787
-w /go/src/github.com/user/repo \
8888
goreleaser/goreleaser release --snapshot --skip=publish --clean
8989

90+
release-dry-run: ## Build cross-platform binaries locally without publishing
91+
@echo "Building cross-platform binaries with GoReleaser..."
92+
@if command -v goreleaser >/dev/null 2>&1; then \
93+
goreleaser build --snapshot --clean; \
94+
else \
95+
echo "GoReleaser not found. Installing via Docker..."; \
96+
docker run --rm --privileged \
97+
-v ${PWD}:/go/src/github.com/percona/mongodb_exporter \
98+
-v /var/run/docker.sock:/var/run/docker.sock \
99+
-w /go/src/github.com/percona/mongodb_exporter \
100+
goreleaser/goreleaser build --snapshot --clean; \
101+
fi
102+
@find build -name mongodb_exporter -type f | sort
103+
104+
90105
FILES = $(shell find . -type f -name '*.go' -not -path "./vendor/*")
91106

92107
format: ## Format source code

0 commit comments

Comments
 (0)