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 e59ad1d
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 5 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 }} -t test32bit --target source .
docker run --rm test32bit 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

9 changes: 8 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# syntax=docker/dockerfile:1.8-labs
FROM --platform=linux/amd64 golang:1.22-alpine AS build
FROM golang:1.22-alpine AS source

ARG TARGETOS
ARG TARGETARCH
Expand All @@ -18,6 +18,13 @@ RUN --mount=type=cache,id=go-build-${TARGETOS}-${TARGETARCH}${TARGETVARIANT},tar

COPY . /go/src/github.com/hairyhenderson/gomplate

FROM source AS build

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

RUN --mount=type=cache,id=go-build-${TARGETOS}-${TARGETARCH}${TARGETVARIANT},target=/root/.cache/go-build \
--mount=type=cache,id=go-pkg-${TARGETOS}-${TARGETARCH}${TARGETVARIANT},target=/go/pkg \
make build
Expand Down
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 e59ad1d

Please sign in to comment.