Skip to content

Commit 8778f9b

Browse files
committed
Build for windows 7
1 parent 7a7af6a commit 8778f9b

File tree

2 files changed

+57
-0
lines changed

2 files changed

+57
-0
lines changed

.github/workflows/on_push.yml

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

Makefile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@ build-windows-386:
120120
build-windows-amd64:
121121
GOOS=windows GOARCH=amd64 $(MAKE) build-windows
122122

123+
build-windows-amd64-win7:
124+
GOOS=windows GOARCH=amd64 $(MAKE) build-windows-7
125+
123126
build-windows-arm64:
124127
GOOS=windows GOARCH=arm64 $(MAKE) build-windows
125128

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

141+
.PHONY: build-windows-7
142+
build-windows-7:
143+
CGO_ENABLED=$(CGO_ENABLED) GOOS=$(GOOS) GOARCH=$(GOARCH) $(GOBUILD) -v \
144+
-ldflags "${LD_FLAGS} -X ${REPO}/pkg/version.OS=$(GOOS) -X ${REPO}/pkg/version.Arch=$(GOARCH)" \
145+
-o ${BUILD_DIR}/$(BINARY_NAME)-$(GOOS)-$(GOARCH)-win7.exe
146+
138147
install: install-go-modules install-linter
139148

140149
.PHONY: install-linter

0 commit comments

Comments
 (0)