From 36bafcf8a275d8f350511d638fa5b54008e345b3 Mon Sep 17 00:00:00 2001 From: Dave Henderson Date: Sun, 23 Jun 2024 19:55:51 -0400 Subject: [PATCH] ci(test): Add 32-bit CI tests (#2126) Signed-off-by: Dave Henderson --- .github/workflows/build.yml | 25 ++++++++++++------------- Makefile | 6 +++++- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1ec9fe305..3327431ce 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,7 +11,16 @@ jobs: runs-on: ubuntu-latest container: image: ghcr.io/hairyhenderson/gomplate-ci-build + strategy: + fail-fast: false + matrix: + goarch: [ '386', 'amd64', 'arm', 'arm64' ] + include: + - goarch: 'arm' + goarm: '7' steps: + - name: Set up QEMU + uses: docker/setup-qemu-action@v3.0.0 - run: | git config --global user.email "bogus@example.com" git config --global user.name "Someone" @@ -19,14 +28,9 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 - - run: make build - - name: Save binary - uses: actions/upload-artifact@v4 - with: - name: gomplate - path: bin/gomplate - - run: make test - - run: make integration + - run: make build GOARCH=${{ matrix.goarch }} GOARM=${{ matrix.goarm }} + - run: make test GOARCH=${{ matrix.goarch }} GOARM=${{ matrix.goarm }} + - run: make integration GOARCH=${{ matrix.goarch }} GOARM=${{ matrix.goarm }} windows-build: runs-on: windows-latest env: @@ -45,10 +49,5 @@ jobs: git config --global user.email "bogus@example.com" git config --global user.name "Someone" - run: make build - - name: Save binary - uses: actions/upload-artifact@v4 - with: - name: gomplate.exe - path: bin/gomplate.exe - run: make test - run: make integration diff --git a/Makefile b/Makefile index 046092da6..b1a9381ea 100644 --- a/Makefile +++ b/Makefile @@ -147,7 +147,11 @@ $(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' 'darwin/amd64' 'darwin/arm64' +ifeq (,$(findstring '$(GOOS)/$(GOARCH)',$(race_platforms))) +export CGO_ENABLED=0 test: $(GO) test -coverprofile=c.out ./... else