File tree Expand file tree Collapse file tree 8 files changed +79
-8
lines changed Expand file tree Collapse file tree 8 files changed +79
-8
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@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
Original file line number Diff line number Diff line change 20
20
21
21
steps :
22
22
- name : Checkout code
23
- uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
23
+ uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
24
24
25
25
- name : Set up Go
26
26
uses : actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
Original file line number Diff line number Diff line change 21
21
runs-on : ubuntu-latest
22
22
steps :
23
23
- name : Checkout
24
- uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
24
+ uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
25
25
with :
26
26
fetch-depth : 0
27
27
@@ -31,13 +31,13 @@ jobs:
31
31
go-version-file : ${{ github.workspace }}/go.mod
32
32
33
33
- name : Login to Docker Hub
34
- uses : docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4 .0
34
+ uses : docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5 .0
35
35
with :
36
36
username : ${{ secrets.DOCKERHUB_USERNAME }}
37
37
password : ${{ secrets.DOCKERHUB_TOKEN }}
38
38
39
39
- name : Login to GitHub Container Registry
40
- uses : docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4 .0
40
+ uses : docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5 .0
41
41
with :
42
42
registry : ghcr.io
43
43
username : ${{ github.actor }}
Original file line number Diff line number Diff line change 23
23
24
24
steps :
25
25
- name : Checkout code
26
- uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
26
+ uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
27
27
with :
28
28
persist-credentials : false
29
29
Original file line number Diff line number Diff line change 38
38
39
39
steps :
40
40
- name : Checkout code
41
- uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
41
+ uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
42
42
43
43
- name : Set up Go
44
44
uses : actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
Original file line number Diff line number Diff line change 12
12
13
13
steps :
14
14
- name : Checkout code
15
- uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
15
+ uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
16
16
with :
17
17
fetch-depth : 0
18
18
Original file line number Diff line number Diff line change 4
4
- binary : mongodb_exporter
5
5
id : mongodb_exporter
6
6
env :
7
+ - CGO_ENABLED=0
7
8
goos :
8
9
- linux
9
10
- 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
2
2
default : help
3
3
4
4
GO_TEST_PATH ?= ./...
@@ -87,6 +87,21 @@ release: ## Build the binaries using goreleaser
87
87
-w /go/src/github.com/user/repo \
88
88
goreleaser/goreleaser release --snapshot --skip=publish --clean
89
89
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
+
90
105
FILES = $(shell find . -type f -name '* .go' -not -path "./vendor/* ")
91
106
92
107
format : # # Format source code
You can’t perform that action at this time.
0 commit comments