Skip to content

Commit d5bda2c

Browse files
committed
Build for windows 7
1 parent f77369f commit d5bda2c

File tree

2 files changed

+66
-0
lines changed

2 files changed

+66
-0
lines changed

.github/workflows/on_push.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,57 @@ jobs:
219219
name: IP Check
220220
run: make test-ip
221221

222+
build-windows-7:
223+
name: Build Windows 7 with GO 1.20
224+
runs-on: ubuntu-latest
225+
# needs: [version]
226+
steps:
227+
-
228+
name: Checkout
229+
uses: actions/checkout@v4
230+
-
231+
name: Setup go
232+
uses: actions/setup-go@v5
233+
with:
234+
go-version: '^1.20.14'
235+
check-latest: false
236+
cache: false
237+
-
238+
name: Replace go version in go.mod
239+
uses: jacobtomlinson/gha-find-replace@v3
240+
with:
241+
find: "(?m)^go\\s[0-9\\.]+$"
242+
replace: "go 1.20.14"
243+
include: "go.mod"
244+
-
245+
name: Run tidy
246+
run: go mod tidy
247+
-
248+
name: Build binaries
249+
env:
250+
VERSION: 1.2.3
251+
shell: bash
252+
# 2 is the number of virtual cpus for Linux. macOS is 3.
253+
run: make -j2 build-all-windows-7
254+
-
255+
name: Upload artifacts
256+
uses: actions/upload-artifact@v4
257+
with:
258+
name: binaries-windows
259+
path: build/
260+
# -
261+
# name: Remove tag if failure
262+
# if: ${{ failure() }}
263+
# uses: actions/github-script@v7
264+
# with:
265+
# github-token: ${{ github.token }}
266+
# script: |
267+
# github.rest.git.deleteRef({
268+
# owner: context.repo.owner,
269+
# repo: context.repo.repo,
270+
# ref: "tags/${{ needs.version.outputs.semver_tag }}"
271+
# })
272+
222273
version:
223274
name: Version
224275
concurrency: tagging

Makefile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,14 +112,23 @@ build-openbsd-arm:
112112
build-openbsd-arm64:
113113
GOOS=openbsd GOARCH=arm64 $(MAKE) build
114114

115+
# except windows 7
115116
build-all-windows: build-windows-386 build-windows-amd64 build-windows-arm64
116117

118+
build-all-windows-7: build-windows-386-win7 build-windows-amd64-win7
119+
117120
build-windows-386:
118121
GOOS=windows GOARCH=386 $(MAKE) build-windows
119122

123+
build-windows-386-win7:
124+
GOOS=windows GOARCH=386 $(MAKE) build-windows-7
125+
120126
build-windows-amd64:
121127
GOOS=windows GOARCH=amd64 $(MAKE) build-windows
122128

129+
build-windows-amd64-win7:
130+
GOOS=windows GOARCH=amd64 $(MAKE) build-windows-7
131+
123132
build-windows-arm64:
124133
GOOS=windows GOARCH=arm64 $(MAKE) build-windows
125134

@@ -135,6 +144,12 @@ build-windows:
135144
-ldflags "${LD_FLAGS} -X ${REPO}/pkg/version.OS=$(GOOS) -X ${REPO}/pkg/version.Arch=$(GOARCH)" \
136145
-o ${BUILD_DIR}/$(BINARY_NAME)-$(GOOS)-$(GOARCH).exe
137146

147+
.PHONY: build-windows-7
148+
build-windows-7:
149+
CGO_ENABLED=$(CGO_ENABLED) GOOS=$(GOOS) GOARCH=$(GOARCH) $(GOBUILD) -v \
150+
-ldflags "${LD_FLAGS} -X ${REPO}/pkg/version.OS=$(GOOS) -X ${REPO}/pkg/version.Arch=$(GOARCH)" \
151+
-o ${BUILD_DIR}/$(BINARY_NAME)-$(GOOS)-$(GOARCH)-win7.exe
152+
138153
install: install-go-modules install-linter
139154

140155
.PHONY: install-linter

0 commit comments

Comments
 (0)