From d0612019e07f166d168997ae57d70c5469d46098 Mon Sep 17 00:00:00 2001 From: Fernandez Ludovic Date: Wed, 26 Jun 2024 19:47:59 +0200 Subject: [PATCH] chore: build on multiple GOOS/GOARCH --- .github/workflows/test.yml | 17 ++++++++++++++--- build.sh | 19 +++++++++++++++++++ 2 files changed, 33 insertions(+), 3 deletions(-) create mode 100755 build.sh diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index cbb016d..0d4341d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,4 +1,4 @@ -name: Run tests +name: Tests and Build on: push: @@ -9,8 +9,8 @@ on: jobs: - cross: - name: Go + tests: + name: Tests strategy: matrix: go-version: [ stable, oldstable ] @@ -33,3 +33,14 @@ jobs: - name: Test run: go test -v -race ./... + + build: + name: Build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: stable + - name: compile for all supported GOOS/GOARCH + run: ./build.sh diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..b644f21 --- /dev/null +++ b/build.sh @@ -0,0 +1,19 @@ +#!/bin/bash -e + +# Not supported by flock: +# - plan9/* +# - solaris/* +# - js/wasm +# - wasp1/wasm + +for row in $(go tool dist list -json | jq -r '.[] | select( .GOOS != "plan9" and .GOOS != "solaris" and .GOARCH != "wasm") | @base64'); do + _jq() { + echo ${row} | base64 --decode | jq -r ${1} + } + + GOOS=$(_jq '.GOOS') + GOARCH=$(_jq '.GOARCH') + + echo "$GOOS/$GOARCH" + GOOS=$GOOS GOARCH=$GOARCH go build +done