File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -113,13 +113,17 @@ jobs:
113113 - uses : extractions/setup-just@v4
114114
115115 - name : Generate build files (${{ matrix.goarch }})
116- env :
117- CC : ${{ matrix.cc }}
118- GOOS : linux
119- GOARCH : ${{ matrix.goarch }}
120116 run : |
121117 OUTPUT_BIN="dist/zfs-file-history-linux-${{ matrix.goarch }}"
122- just OUTPUT_BIN="${OUTPUT_BIN}" ${{ matrix.just_target }}
118+
119+ # Pass cross-compilation variables explicitly as arguments to just
120+ just \
121+ GOOS="linux" \
122+ GOARCH="${{ matrix.goarch }}" \
123+ CC="${{ matrix.cc }}" \
124+ OUTPUT_BIN="${OUTPUT_BIN}" \
125+ ${{ matrix.just_target }}
126+
123127 file "${OUTPUT_BIN}"
124128
125129 - name : Upload artifacts
Original file line number Diff line number Diff line change 1+ # Explicitly define variables so they accept command-line/matrix overrides
2+ GOOS := " linux"
3+ GOARCH := " amd64"
4+ CC := " gcc"
5+ CGO_ENABLED := " 1"
6+
17GO_FLAGS := " "
28NAME := " zfs-file-history"
39OUTPUT_BIN := " bin/" + NAME
@@ -21,9 +27,11 @@ coverage-html:
2127 go test -coverprofile=coverage.out ./ ...
2228 go tool cover -html=coverage.out
2329
24- # Builds the CLI
30+ # Builds the CLI with explicit architecture/compiler environment variables
2531build :
26- @ go build {{ GO_FLAGS}} \
32+ @ mkdir -p $(dirname {{OUTPUT_BIN}})
33+ CGO_ENABLED={{ CGO_ENABLED}} GOOS={{ GOOS}} GOARCH={{ GOARCH}} CC={{ CC}} \
34+ go build {{ GO_FLAGS}} \
2735 - ldflags " -w -s \
2836 -X {{ NAME}} /cmd/global.Version={{ VERSION}} \
2937 -X {{ PACKAGE}} /cmd/global.Version={{ VERSION}} \
@@ -43,6 +51,7 @@ run: build
4351
4452# Deploy to custom bin directory
4553deploy-custom : clean build
54+ mkdir -p ~/ .custom/ bin/
4655 cp ./ {{ OUTPUT_BIN}} ~/ .custom/ bin/
4756
4857# Deploy to /usr/local/bin
You can’t perform that action at this time.
0 commit comments