From db5e6f61e527d66b3bd96cef32714a32456cfb53 Mon Sep 17 00:00:00 2001 From: Marten Seemann Date: Wed, 18 Nov 2020 18:35:52 +0700 Subject: [PATCH] cross compile quic-go for all platforms / architectures --- .github/workflows/cross-compile.sh | 17 +++++++++++++++++ .github/workflows/cross-compile.yml | 19 +++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100755 .github/workflows/cross-compile.sh create mode 100644 .github/workflows/cross-compile.yml diff --git a/.github/workflows/cross-compile.sh b/.github/workflows/cross-compile.sh new file mode 100755 index 000000000..1b7f0dcb6 --- /dev/null +++ b/.github/workflows/cross-compile.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +set -e + +GOVERSION=$(go version | cut -d " " -f 3 | cut -b 3-6) + +for dist in $(go tool dist list); do + goos=$(echo $dist | cut -d "/" -f1) + goarch=$(echo $dist | cut -d "/" -f2) + if [[ "$goos" == "android" ]]; then continue; fi # cross-compiling for android is a pain... + if [[ "$goos" == "darwin" && $goarch == "arm64" ]]; then continue; fi # ... darwin/arm64 neither + if [[ $GOVERSION == "1.14" && $goos == "darwin" && $goarch == "arm" ]]; then continue; fi # Go 1.14 lacks syscall.IPV6_RECVTCLASS + + echo "$dist" + GOOS=$goos GOARCH=$goarch go build -o main example/main.go + rm main +done diff --git a/.github/workflows/cross-compile.yml b/.github/workflows/cross-compile.yml new file mode 100644 index 000000000..f3216f6b0 --- /dev/null +++ b/.github/workflows/cross-compile.yml @@ -0,0 +1,19 @@ +on: [push, pull_request] +jobs: + crosscompile: + strategy: + matrix: + go: [ "1.14.x", "1.15.x" ] + runs-on: ubuntu-latest + name: "Cross Compilation (Go ${{matrix.go}})" + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-go@v2 + with: + go-version: ${{ matrix.go }} + - name: Install build utils + run: sudo apt-get install -y gcc-multilib + - name: Install dependencies + run: go build example/main.go + - name: Run cross compilation + run: .github/workflows/cross-compile.sh