Skip to content

Commit 34c45cd

Browse files
committed
Build for windows 7
1 parent f77369f commit 34c45cd

File tree

2 files changed

+69
-0
lines changed

2 files changed

+69
-0
lines changed

.github/workflows/on_push.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,60 @@ 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+
run: go version
239+
-
240+
name: Replace go version in go.mod
241+
uses: jacobtomlinson/gha-find-replace@v3
242+
with:
243+
find: "(?m)^go\\s[0-9\\.]+$"
244+
replace: "go 1.20.14"
245+
include: "go.mod"
246+
-
247+
run: cat go.mod
248+
-
249+
run: go mod tidy
250+
-
251+
name: Build binaries
252+
env:
253+
VERSION: 1.2.3
254+
shell: bash
255+
# 2 is the number of virtual cpus for Linux. macOS is 3.
256+
run: make -j2 build-all-windows-7
257+
-
258+
name: Upload artifacts
259+
uses: actions/upload-artifact@v4
260+
with:
261+
name: binaries-windows
262+
path: build/
263+
# -
264+
# name: Remove tag if failure
265+
# if: ${{ failure() }}
266+
# uses: actions/github-script@v7
267+
# with:
268+
# github-token: ${{ github.token }}
269+
# script: |
270+
# github.rest.git.deleteRef({
271+
# owner: context.repo.owner,
272+
# repo: context.repo.repo,
273+
# ref: "tags/${{ needs.version.outputs.semver_tag }}"
274+
# })
275+
222276
version:
223277
name: Version
224278
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)