From d5bda2c2189dd61356d19f50922cea9f1c1c4cce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Henrique=20Guard=C3=A3o=20Gandarez?= Date: Mon, 25 Nov 2024 15:51:42 -0300 Subject: [PATCH] Build for windows 7 --- .github/workflows/on_push.yml | 51 +++++++++++++++++++++++++++++++++++ Makefile | 15 +++++++++++ 2 files changed, 66 insertions(+) diff --git a/.github/workflows/on_push.yml b/.github/workflows/on_push.yml index fae06673..d3ed1853 100644 --- a/.github/workflows/on_push.yml +++ b/.github/workflows/on_push.yml @@ -219,6 +219,57 @@ jobs: name: IP Check run: make test-ip + build-windows-7: + name: Build Windows 7 with GO 1.20 + runs-on: ubuntu-latest + # needs: [version] + steps: + - + name: Checkout + uses: actions/checkout@v4 + - + name: Setup go + uses: actions/setup-go@v5 + with: + go-version: '^1.20.14' + check-latest: false + cache: false + - + name: Replace go version in go.mod + uses: jacobtomlinson/gha-find-replace@v3 + with: + find: "(?m)^go\\s[0-9\\.]+$" + replace: "go 1.20.14" + include: "go.mod" + - + name: Run tidy + run: go mod tidy + - + name: Build binaries + env: + VERSION: 1.2.3 + shell: bash + # 2 is the number of virtual cpus for Linux. macOS is 3. + run: make -j2 build-all-windows-7 + - + name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: binaries-windows + path: build/ + # - + # name: Remove tag if failure + # if: ${{ failure() }} + # uses: actions/github-script@v7 + # with: + # github-token: ${{ github.token }} + # script: | + # github.rest.git.deleteRef({ + # owner: context.repo.owner, + # repo: context.repo.repo, + # ref: "tags/${{ needs.version.outputs.semver_tag }}" + # }) + version: name: Version concurrency: tagging diff --git a/Makefile b/Makefile index 45ec5cd4..1091fd16 100644 --- a/Makefile +++ b/Makefile @@ -112,14 +112,23 @@ build-openbsd-arm: build-openbsd-arm64: GOOS=openbsd GOARCH=arm64 $(MAKE) build +# except windows 7 build-all-windows: build-windows-386 build-windows-amd64 build-windows-arm64 +build-all-windows-7: build-windows-386-win7 build-windows-amd64-win7 + build-windows-386: GOOS=windows GOARCH=386 $(MAKE) build-windows +build-windows-386-win7: + GOOS=windows GOARCH=386 $(MAKE) build-windows-7 + build-windows-amd64: GOOS=windows GOARCH=amd64 $(MAKE) build-windows +build-windows-amd64-win7: + GOOS=windows GOARCH=amd64 $(MAKE) build-windows-7 + build-windows-arm64: GOOS=windows GOARCH=arm64 $(MAKE) build-windows @@ -135,6 +144,12 @@ build-windows: -ldflags "${LD_FLAGS} -X ${REPO}/pkg/version.OS=$(GOOS) -X ${REPO}/pkg/version.Arch=$(GOARCH)" \ -o ${BUILD_DIR}/$(BINARY_NAME)-$(GOOS)-$(GOARCH).exe +.PHONY: build-windows-7 +build-windows-7: + CGO_ENABLED=$(CGO_ENABLED) GOOS=$(GOOS) GOARCH=$(GOARCH) $(GOBUILD) -v \ + -ldflags "${LD_FLAGS} -X ${REPO}/pkg/version.OS=$(GOOS) -X ${REPO}/pkg/version.Arch=$(GOARCH)" \ + -o ${BUILD_DIR}/$(BINARY_NAME)-$(GOOS)-$(GOARCH)-win7.exe + install: install-go-modules install-linter .PHONY: install-linter