Skip to content

Commit

Permalink
ci(test): Add 32-bit CI tests
Browse files Browse the repository at this point in the history
Signed-off-by: Dave Henderson <[email protected]>
  • Loading branch information
hairyhenderson committed Jun 22, 2024
1 parent e3b86e8 commit 71f431e
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 4 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,21 @@ jobs:
path: bin/gomplate
- run: make test
- run: make integration
linux-32bit-build:
runs-on: ubuntu-latest
strategy:
matrix:
platform: [ linux/386, linux/armhf ]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up QEMU
uses: docker/[email protected]
- name: Test on ${{ matrix.platform }}
run: |
docker build --platform ${{ matrix.platform }} --iidfile test32bit.iid -f Dockerfile.test32bit .
docker run --rm $(<test32bit.iid) make test
windows-build:
runs-on: windows-latest
env:
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,3 @@ jobs:
with:
version: latest
args: --verbose --max-same-issues=0 --max-issues-per-linter=0

16 changes: 16 additions & 0 deletions Dockerfile.test32bit
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM golang:1.22-alpine

ARG TARGETOS
ARG TARGETARCH
ARG TARGETVARIANT
ENV GOOS=$TARGETOS GOARCH=$TARGETARCH

RUN apk add --no-cache make git

WORKDIR /go/src/github.com/hairyhenderson/gomplate
COPY go.mod /go/src/github.com/hairyhenderson/gomplate
COPY go.sum /go/src/github.com/hairyhenderson/gomplate

RUN go mod download -x

COPY . /go/src/github.com/hairyhenderson/gomplate
9 changes: 6 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,15 @@ $(PREFIX)/bin/$(PKG_NAME)$(call extension,$(GOOS)): $(PREFIX)/bin/$(PKG_NAME)_$(

build: $(PREFIX)/bin/$(PKG_NAME)_$(GOOS)-$(GOARCH)$(TARGETVARIANT)$(call extension,$(GOOS)) $(PREFIX)/bin/$(PKG_NAME)$(call extension,$(GOOS))

ifeq ($(OS),Windows_NT)
# test with race detector on supported platforms
# windows/amd64 is supported in theory, but in practice it requires a C compiler
race_platforms := linux/amd64 linux/ppc64le linux/arm64 linux/s390x freebsd/amd64 netbsd/amd64 darwin/amd64 darwin/arm64
ifneq (,$(findstring $(GOOS)/$(GOARCH),$(race_platforms)))
test:
$(GO) test -coverprofile=c.out ./...
$(GO) test -race -coverprofile=c.out ./...
else
test:
$(GO) test -race -coverprofile=c.out ./...
$(GO) test -coverprofile=c.out ./...
endif

.SECONDEXPANSION:
Expand Down

0 comments on commit 71f431e

Please sign in to comment.