File tree Expand file tree Collapse file tree 4 files changed +72
-1
lines changed Expand file tree Collapse file tree 4 files changed +72
-1
lines changed Original file line number Diff line number Diff line change 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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
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
File renamed without changes.
Original file line number Diff line number Diff line change 44 - binary : mongodb_exporter
55 id : mongodb_exporter
66 env :
7+ - CGO_ENABLED=0
78 goos :
89 - linux
910 - darwin
Original file line number Diff line number Diff line change 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
22default : help
33
44GO_TEST_PATH ?= ./...
@@ -83,6 +83,21 @@ release: ## Build the binaries using goreleaser
8383 -w /go/src/github.com/user/repo \
8484 goreleaser/goreleaser release --snapshot --skip=publish --clean
8585
86+ release-dry-run : # # Build cross-platform binaries locally without publishing
87+ @echo " Building cross-platform binaries with GoReleaser..."
88+ @if command -v goreleaser > /dev/null 2>&1 ; then \
89+ goreleaser build --snapshot --clean; \
90+ else \
91+ echo " GoReleaser not found. Installing via Docker..." ; \
92+ docker run --rm --privileged \
93+ -v ${PWD} :/go/src/github.com/percona/mongodb_exporter \
94+ -v /var/run/docker.sock:/var/run/docker.sock \
95+ -w /go/src/github.com/percona/mongodb_exporter \
96+ goreleaser/goreleaser build --snapshot --clean; \
97+ fi
98+ @find build -name mongodb_exporter -type f | sort
99+
100+
86101FILES = $(shell find . -type f -name '* .go' -not -path "./vendor/* ")
87102
88103format : # # Format source code
You can’t perform that action at this time.
0 commit comments